github / github/copilot-cli

Make `--name` create or resume a session

Open
#4,642 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
Shell
Stars
11.2k
Forks
1.9k
Avg merge
14h 16m
Merged PRs (30d)
6

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the CLI handling for --name and --resume, then inspect the relaunch paths used by /restart and /update. Compare the behavior with issue #3332 and verify the four proposed cases: create when unmatched, resume on one match, preserve current ambiguity handling, and avoid conflicts during relaunch.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.