/restart fails when the CLI was launched with --new-session-id
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- cli, javascript
- 领域
- cli
调研方向
重启时的 argv 在 cli-main.js(1.0.98)中构建:找到那个会从 process.argv.slice(2) 中移除 --session-id、--resume 及相关标志的 strip 辅助函数。将 --new-session-id 和 --new-session-id= 添加到该列表中,裸形式时应消费其后的值。通过使用 --new-session-id <uuid> 启动并运行 /restart 进行验证;重建后的 argv 应只包含一个会话标志。
由索引模型根据 Issue 内容生成。
描述
What happened
Launching the CLI with --new-session-id <uuid> and then running /restart fails every time:
error: the argument '--new-session-id <id>' cannot be used with '--session-id <id>'
Usage: copilot --log-dir <directory> --plugin-dir <directory> --add-dir <directory> --additional-mcp-config <json> --yolo
For more information, try '--help'.
By the time this surfaces the foreground session has already been shut down, so the restart is not recoverable.
Repro
copilot --new-session-id 11111111-2222-4333-8444-555555555555(any fresh UUID)- Run
/restart
This matters for embedding hosts, which pass --new-session-id on every session launch, so /restart is permanently unusable there rather than occasionally.
Cause
/restart rebuilds the child argv from process.argv.slice(2), strips the session-selection flags, then appends --session-id <current session id>.
In cli-main.js (1.0.98) the strip helper removes -r, --resume, --resume=, --session-id, --session-id=, --continue, --cloud, -i, --interactive, --interactive=, --experimental, --no-experimental, --fleet and -C. --new-session-id is absent from that list, so it survives into the restart argv next to the freshly appended --session-id, and the parser declares the two mutually exclusive.
The same rebuilt argv is persisted for the supervised restart path, so both the supervised and unsupervised paths fail identically.
Expected
The strip helper should drop --new-session-id and --new-session-id=<uuid>, consuming the following value in the bare form, exactly as it already does for --session-id. The session exists by restart time, so re-asserting a creation ID is both wrong and rejected.
Workaround
Patching the strip helper locally to treat --new-session-id like --session-id resolves it, but the file lives in the extracted package folder and the fix is lost on every CLI update.
Version
1.0.98 on Windows, win32-x64.
- 主要语言
- Shell
- 星标
- 11.3k
- 派生
- 2k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/copilot-cli 的其他 Issue
-
area:input-keyboard
难度 2/5 1-3 小时 新手友好度 66/100
github/copilot-cli#5113 ·
-
area:sessions
难度 2/5 1-3 小时 新手友好度 72/100
github/copilot-cli#4996 ·
-
triage
难度 1/5 1 小时以内 新手友好度 88/100
github/copilot-cli#4963 · 1 条评论 ·
-
triage
难度 2/5 1-3 小时 新手友好度 75/100
github/copilot-cli#4932 ·
-
triage
难度 2/5 1-3 小时 新手友好度 78/100
github/copilot-cli#4909 ·
查看 github/copilot-cli 的全部 Issue
相似的 Issue
-
bug needs-triage
难度 1/5 1 小时以内 新手友好度 78/100
mattpocock/skills#1281 ·
维护者通常 1 天内回复
-
github_actions
难度 2/5 1-3 小时 新手友好度 62/100
hiero-ledger/hiero-consensus-node#27621 ·
维护者通常 1 天内回复
-
application-issue
难度 2/5 1-3 小时 新手友好度 72/100
Installomator/Installomator#3427 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
software-mansion/argent#1483 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100