Skip to content

SSH session stuck on client tools #324261

Closed
Closed

Description

@roblourens

Logs shared offline


Root cause

High confidence: this is a three-bug chain, not a missing permission UI response.

  1. A nested-chat unsubscribe incorrectly removed the client from the whole session.
    The client remained subscribed to the session/default chat, but unsubscribing one nested subagent chat triggered session/activeClientRemoved:

    • ahp-...jsonl:19283 — nested chat unsubscribe
    • ahp-...jsonl:19289 — client 15ea... removed
    • Faulty session-wide release: protocolServerHandler.ts:1468-1492
  2. The provider retained that removed client’s tools.
    Server-originated actions bypass AgentSideEffects.handleAction; its envelope listener only mirrors ChatToolCallComplete, not SessionActiveClientRemoved (agentSideEffects.ts:158-177). Therefore ActiveClientToolSet still attributed toolSearch to dead client 15ea....

  3. The retry hit a completion-before-permission race.

    • First toolSearch waited for the 30-second disconnected-client timeout, then failed cleanly (remote-agenthost.log:18801-18809).
    • The model retried.
    • Retry failure arrived at 01:49:55.623, before permission registration at 01:49:55.625 (remote-agenthost.log:18811-18815).
    • handleClientToolCallComplete() called respondToPermissionRequest(), but no deferred existed yet (copilotAgentSession.ts:997-999).
    • Two milliseconds later _handlePermissionRequest() created the deferred and waited forever (copilotAgentSession.ts:1824-1825,1889).

That is the unmatched final event at events.jsonl:18658.

Recommended fixes

  1. Only remove an active client when it has no remaining session or chat subscriptions for that session.
  2. Mirror server-originated SessionActiveClientRemoved into agent.removeActiveClient(...).
  3. Buffer early client-tool completion for the permission gate too, not only for the eventual SDK tool handler.

The knowledge docs don’t capture this exact chain. No code was changed.

Activity

  1. added
    bug
    agent-host
    on Jul 6, 2026
  2. connor4312 commented on Jul 24, 2026

    @connor4312
    Member

    This should be fixed with #326049

  3. added this to the 1.131.0 milestone on Jul 24, 2026
  4. joshspicer commented on Jul 27, 2026

    @joshspicer
    Contributor

    Client tools (integrated browser) appear to work. Tested after a reconnection too

  5. added
    verified
    on Jul 27, 2026
  6. locked and limited conversation to collaborators on Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agent-hostbugverified

Type

No type

Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions