Skip to content

Agent Host: first-turn config refresh leaves new chat permanently active #331118

Open

Description

  • Copilot Chat Extension Version: N/A (built-in Agent Host)
  • VS Code Version: 1.134.0-insider
  • OS Version: macOS 26.6.1 arm64
  • Feature (e.g. agent/edit/ask mode): Agent mode, new worktree-isolated session
  • Selected model (e.g. GPT 4.1, Claude 3.7 Sonnet): GPT-5.6 Sol
  • Logs: Agent Host debug bundle captured locally. The bundle did not include the Copilot runtime process log containing the terminal failure, so the relevant redacted excerpt from process-1786891402662-64463.log is included below. Affected Copilot CLI runtime: 1.0.79.

Steps to Reproduce:

  1. Create a new worktree-isolated Agent Host session with active client tools and synced customizations.
  2. Send the first prompt so the provisional chat materializes while the worktree-scoped customization bundle is republished.
  3. Observe that the chat remains active indefinitely with no assistant response or terminal error.

Expected

The first turn completes normally, or a runtime failure produces a terminal chat/error/chat/turnComplete transition so the UI stops showing the chat as active.

Actual

The turn remains permanently active. In the captured run:

  • Host session: copilotcli:/98345434-f968-419e-bc34-dd191b28e382
  • SDK session: 265899d1-d87c-4303-b143-26355624c196
  • Turn: request_dec9bbae-59c0-463b-99d4-015c2a95d36b

The AHP turn opened optimistically at 20:24:57.249Z, before an SDK session existed. The provisional SDK session was created at 20:25:01.105Z. Its worktree-scoped synced-customization bundle was then republished with a new content nonce while the client tool set remained unchanged. During the same first-send call, ActiveClient.requiresRestart detected the updated plugin snapshot and refreshed the session.

Agent Host log:

Session configuration changed, refreshing session
SDK resumeSession failed: Session not found: 265899d1-d87c-4303-b143-26355624c196
Resume reported no session history; falling back to createSession with same ID
Fallback createSession succeeded
session.send() returned

Copilot runtime process log:

20:25:01.105Z Created session: 265899d1-d87c-4303-b143-26355624c196
20:25:01.364Z Closing session 265899d1-d87c-4303-b143-26355624c196
20:25:01.372Z Destroyed session 265899d1-d87c-4303-b143-26355624c196 after last owner detached
20:25:01.380Z Session not found: 265899d1-d87c-4303-b143-26355624c196
20:25:01.403Z Created session: 265899d1-d87c-4303-b143-26355624c196
20:25:11.338Z Agentic loop failed: Error: CompactionProcessorHandle has already been disposed

No session.error, session.idle, assistant turn event, or matching AHP chat/turnComplete reached Agent Host afterward. The only chat actions after chat/turnStarted were worktree-creation activity and one response-part placeholder.

Root cause

The primary trigger is deterministic in VS Code:

  1. The first send materializes a provisional SDK session.
  2. The worktree-scoped customization snapshot changes before that same send reaches the model.
  3. _sendMessageOnce destroys the just-created empty session and attempts to resume the same SDK ID.
  4. Disconnecting the last owner destroys that empty runtime session, so resume reports Session not found.
  5. CopilotSessionLauncher falls back to createSession with the same ID.

The recreated runtime then reports that its CompactionProcessorHandle is disposed. The logs prove the failure follows same-ID destroy/recreate, but do not prove the precise internal mechanism. The replacement may be observing state retained from the first instance, or late teardown from the first instance may be disposing a resource used by the replacement.

The runtime catches the agentic-loop failure but no terminal SDK event reaches Agent Host, leaving the optimistic AHP turn active.

Existing hang detection

AgentHostTurnTracker already classifies a turn with no observed provider progress as noProgress after TURN_HANG_THRESHOLD_MS (five minutes), but this watchdog only emits telemetry. It does not terminate or recover the active turn.

Potential fixes

  1. Avoid destroy→resume for a newly materialized, unused session during its first send. Reconcile the final worktree-scoped customization snapshot before creating the SDK session, or recreate the empty backing without reusing the destroyed runtime identity.
  2. Use the existing AgentHostTurnTracker no-progress watchdog as a recovery hook so a lost provider turn cannot remain active indefinitely.
  3. Harden same-ID session recreation in the Copilot runtime and ensure agentic-loop failures always produce terminal SDK events.

Unrelated MCP startup/auth warnings occurred concurrently but were not the source of the disposed-handle failure.

Activity

  1. changed the title [-]Agent Host: new chat remains active after same-ID SDK session recreation[/-] [+]Agent Host: first-turn config refresh leaves new chat permanently active[/+] on Aug 16, 2026
  2. added
    bug
    agent-host
    on Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agent-hostbug

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions