Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

/restart fails when the CLI was launched with --new-session-id

未關閉 適合新手
#5,147 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 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 內容生成。

描述

area:sessions
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
  1. copilot --new-session-id 11111111-2222-4333-8444-555555555555 (any fresh UUID)
  2. 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 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

github/copilot-cli 的其他 Issue

查看 github/copilot-cli 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。