Skip to content

Extensions don't start for sessions created with create_session until the user switches to them #5380

Open

Description

@nima-ap

Describe the bug

A session created with the session management tool create_session starts with no extension processes. Its model has none of the extensions' tools, none of the skills extensions register, and no extension hooks. Extensions start only when the user first switches to that session in the Sessions sidebar or with /resume, or when /restart restores it. Sessions the user starts directly, and prompt mode (copilot -p), load extensions within a second or two.

A created session is meant to work without the user watching, so it can spend minutes on its task without the tools it was asked to use.

Affected version

GitHub Copilot CLI 1.0.108-1 (also seen in 1.0.105, 1.0.106, and 1.0.107)

Steps to reproduce the behavior

  1. Turn on session management tools (sessionManagementTools in ~/.copilot/settings.json).
  2. Add a user extension, for example ~/.copilot/extensions/probe/extension.mjs, that calls joinSession({ tools: [{ name: "probe_ping", ... }] }).
  3. In session A, ask the agent to call create_session with the prompt "Search your tools for probe_ping and say whether it exists." Stay in session A.
  4. Session B reports that probe_ping doesn't exist. The process log has no extension launch for B's session ID, and B's events.jsonl has no extension events.
  5. Switch to B in the sidebar. The log shows Registering foreground session: <B>, then Session changed (<A> → <B>), reloading extensions, followed by extension bootstrap lines for B. Send B any message; probe_ping is now available.

Expected behavior

A session created with create_session gets the same extensions as any interactive session from the moment it's created, since the host supervises it and it is meant to work without the user watching.

Additional context

  • macOS on Apple silicon (arm64).
  • Over two days on one machine, 10 sessions created by other sessions received their extensions between 36 seconds and 26 minutes after creation, each time when the user first opened the session.
  • copilot-sdk/docs/extensions.md says joinSession() "attaches to the user's current foreground session", which may explain it.
  • Possibly related: Switching sessions in the Sessions sidebar leaks plugin MCP servers and extension hosts (OOM) #5164 (switching sessions in the sidebar starts a set of extension hosts per session).

Activity

  1. added
    area:pluginsPlugin system, marketplace, hooks, skills, extensions, and custom agents
    area:sessionsSession management, resume, history, session picker, and session state
    and removed on Nov 8, 2026
  2. nima-ap commented on Nov 8, 2026

    @nima-ap
    Author

    Switching to a created session while it is still working leaves its extension tools broken, even though the switch starts its extensions. We narrowed it down on 1.0.108-1 with test sessions and a test extension.

    Steps, using the probe extension from this issue:

    1. In session A, call create_session to make session B with a prompt that keeps it busy, such as "Run sleep 120, then reply ready."
    2. While B's first turn is still running, switch to B, then back to A. The log shows reloading extensions and Installed N native extension(s) for B.
    3. The rest of B's turn has none of the extension tools, including extensions_manage and extensions_reload. B's extension processes keep running.
    4. From A, send B a message asking it to search its tools for probe_ping. B doesn't find it, even if you switch to B while it runs.
    5. Type any message in B. That turn finds probe_ping, and so does every later turn, including turns that A starts while B is in the background.

    Variations:

    • If the first switch to B happens after its first turn ends, every later turn has the extension tools, in the foreground or background.
    • If the first switch happens during a later busy turn, only the rest of that turn lacks them, and the next turn has them.
    • A turn that B's own extension starts with session.send once B is idle also has the tools and fixes later turns, the same as typing.

    Flows where one session starts another on a task hit this often, because the new session starts working at once and the user switches to it to watch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:pluginsPlugin system, marketplace, hooks, skills, extensions, and custom agentsarea:sessionsSession management, resume, history, session picker, and session state

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions