Skip to content

Commit 659c360

Browse files
鲁工鲁工
authored andcommitted
fix: give legacy-gateway users a working way out, release 1.8.4
A Windows user upgrading over a live v1.8.0 gateway hit a dead end: `ccmr claude` refused the old gateway and pointed at `ccmr stop`, whose no_pid branch suggested pkill - which does not exist on Windows. The manual-stop hint is now platform-aware (netstat + taskkill on win32), and both refusal paths offer the zero-risk alternative of starting a fresh gateway on another port.
1 parent 6d8b625 commit 659c360

5 files changed

Lines changed: 27 additions & 4 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,12 @@ DeepSeek Anthropic 兼容接口会忽略 `metadata` 字段,但某些 Claude Co
472472

473473
## 更新日志
474474

475+
### v1.8.4
476+
477+
- **修复 v1.8.3 回归**:网关不再校验单条消息的 role/content——Claude Code v2.1+ 会在 `messages` 中携带 `role: "system"` 的上下文条目,v1.8.3 的白名单校验导致所有真实会话在本地报 `400 messages[1].role must be user or assistant`。网关现在只校验路由自身依赖的结构,消息协议交由上游判定
478+
- `ccmr stop` 遇到无法自报 PID 的旧网关(v1.8.1 及更早)时,按平台给出手动停止命令(Windows 用 `netstat` + `taskkill`,不再显示无效的 `pkill`),并提示可改用其他端口
479+
- `ccmr claude` 拒绝复用旧网关时,同时给出"换端口直接启动新网关"的出路,不再只有先停旧网关一条指引
480+
475481
### v1.8.3
476482

477483
- 阻止 detached 网关跨项目复用错误的配置、端点或 API Key

dist/cli.js

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cli.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "claude-code-model-router",
3-
"version": "1.8.3",
3+
"version": "1.8.4",
44
"description": "A lightweight API gateway for routing Claude Code requests to multiple AI models",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/cli.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,13 @@ program
275275
`\x1b[31m[ERROR]\x1b[0m The gateway on port ${port} (v${result.version}) is too old to` +
276276
' report its pid.'
277277
);
278-
console.error(` Stop it with: pkill -f "cli.js start --port ${port}"`);
278+
if (process.platform === 'win32') {
279+
console.error(` Find its PID (the LISTENING line): netstat -ano | findstr :${port}`);
280+
console.error(' Then stop it with: taskkill /PID <pid> /F');
281+
} else {
282+
console.error(` Stop it with: pkill -f "cli.js start --port ${port}"`);
283+
}
284+
console.error(` Or leave it alone and use another port: ccmr claude --gateway-port ${port + 1}`);
279285
break;
280286
case 'unverified_gateway':
281287
failed = true;
@@ -518,6 +524,8 @@ program
518524
);
519525
console.error(' Stop it, then rerun - a fresh gateway will start with your current config:');
520526
console.error(` ccmr stop --port ${gatewayPort}`);
527+
console.error(' Or leave it alone and start fresh on another port:');
528+
console.error(` ccmr claude --gateway-port ${Number(gatewayPort) + 1}`);
521529
} else {
522530
console.error(
523531
`\x1b[31m[ERROR]\x1b[0m The gateway on port ${gatewayPort} belongs to a different config source.`

0 commit comments

Comments
 (0)