github / github/copilot-cli

Make `--name` create or resume a session

未关闭
#4,642 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

triage
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

Describe the feature or problem you'd like to solve

copilot --name <name> creates a new named session, but it does not resume an existing session with that name. After the first launch, users and automation must know whether the session exists before selecting --name <name> or --resume <name>.

The same distinction breaks CLI relaunches. A session started with copilot --name project-a can fail during /update when the replacement process receives both the original --name and an internal --session-id:

error: option '-n, --name <name>' cannot be used with option '--session-id <id>' when it resolves to an existing or remote session or task.
--name only names a brand-new session created by --session-id=<new-uuid>; the resolved session was not renamed.
Proposed solution

Give copilot --name <name> create-or-resume behavior. --name should use the same name lookup and matching rules as --resume <name>:

  1. If no session matches, create a session with that name.
  2. If exactly one session matches, resume that session.
  3. If multiple sessions match, follow the current --resume <name> ambiguity behavior. Do not create another session.
  4. Resume the selected session when /restart, /update, or another command relaunches the CLI. A retained --name should not fail because the session now exists or because the relaunch also carries an internal session ID.

--resume should remain available for three uses: session IDs, the session picker, and existing workflows. Users and automation could then use one repeatable command whenever a stable name identifies the session.

Example prompts or workflows
  1. The first copilot --name project-a invocation creates a named session.
  2. A later copilot --name project-a invocation resumes that session.
  3. /update or /restart resumes that session without a flag conflict.
  4. An alias or script can keep invoking copilot --name project-a without first querying session state.
Additional context

Issue https://github.com/github/copilot-cli/issues/3332 reports /restart failing in a session created with --name. The requested semantics address that failure and the broader need for one repeatable name-based command.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先跟踪 CLI 对 --name 和 --resume 的处理,然后检查 /restart 和 /update 使用的重新启动路径。将行为与 issue #3332 进行比较,并验证提出的四种情况:无匹配时创建、匹配一项时恢复、保留当前的歧义处理方式,以及避免重新启动期间的冲突。

由索引模型根据 Issue 内容生成。

评估

技术栈
shell
领域
cli
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
52/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。