/restart fails when the CLI was launched with --new-session-id
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- cli, javascript
- Domain
- cli
Research direction
The restart argv is built in cli-main.js (1.0.98): find the strip helper that removes --session-id, --resume and related flags from process.argv.slice(2). Add --new-session-id and --new-session-id= to that list, consuming the following value in the bare form. Verify by launching with --new-session-id <uuid> and running /restart; the rebuilt argv should contain only one session flag.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Shell
- Stars
- 11.3k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from github/copilot-cli
-
area:input-keyboard
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
github/copilot-cli#5113 ·
-
area:sessions
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
github/copilot-cli#4996 ·
-
triage
Difficulty 1/5 Under an hour Newbie friendliness 88/100
github/copilot-cli#4963 · 1 comment ·
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
github/copilot-cli#4932 ·
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
github/copilot-cli#4909 ·
All issues in github/copilot-cli
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Netcracker/qubership-test-pipelines#307 ·
Maintainers usually reply within 2 days
-
Webcam overlay freezes during voxtype dictation while screen recording (pause_media pauses the overlay mpv)Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
TYPO3BestPractices/tea#2409 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
msys2/MSYS2-packages#6825 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
fw876/helloworld#2067 ·
Maintainers usually reply within 1 day