/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
-
Add .gitignore可能已有人在做 @ajeanmahoney 今天認領。 未關閉
難度 1/5 1 小時以內 新手友好度 88/100
-
難度 1/5 1 小時以內 新手友好度 75/100
tesseract-ocr/tesseract#4653 ·
維護者通常 1 天內回覆
-
complexity::1-low effort::1-hours priority::1-must
難度 2/5 1-3 小時 新手友好度 72/100
jumpingrivers/audit.workbench#36 ·
維護者通常 1 天內回覆
-
area:install bug needs-triage
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
johnno1962/InjectionNext#175 · 2 則留言 ·