Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#5,147 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cli, javascript
Lĩnh vực
cli

Hướng nghiên cứu

argv khởi động lại được tạo trong cli-main.js (1.0.98): tìm hàm hỗ trợ strip loại bỏ --session-id, --resume và các cờ liên quan khỏi process.argv.slice(2). Thêm --new-session-id và --new-session-id= vào danh sách đó, và với dạng không có dấu = thì tiêu thụ giá trị theo sau. Kiểm chứng bằng cách khởi chạy với --new-session-id <uuid> rồi chạy /restart; argv được dựng lại chỉ nên chứa một cờ phiên.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Shell
Star
11.3k
Fork
2k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của github/copilot-cli

Tất cả issue của github/copilot-cli

Issue tương tự

Thêm issue về Shell/Bash

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.