Repository navigation
Agent suggestions
Public previewDescription
After a client reconnects, client tool calls created afterwards are still attributed to the client that went away, and fail on arrival. The session never recovers: every subsequent call to that tool fails the same way for as long as the session lives.
What happens
In a dev container session, the window reloaded at 16:45:23Z. The new client ade2f5ea initialized and is the only client ever named in session/activeClientSet (33 tools) for the rest of the log.
At 17:14:38Z — half an hour later — a fresh openBrowserPage call is announced as belonging to the old client:
[1786] 17:14:38.827 s2c chat/toolCallStart clientId=fbac6cdc…
[1790] 17:14:38.830 s2c chat/toolCallComplete Client fbac6cdc-798c-415c-a75e-3a2782d74493 disconnected before completing openBrowserPage
[1798] 17:14:40.646 s2c chat/toolCallComplete The client that was running openBrowserPage disconnected, but another active
client now provides openBrowserPage. You may try calling the tool again.
Three milliseconds from start to failure. The model took the advice and retried; every retry was attributed to fbac6cdc and failed identically. The same thing was still happening at 18:53:20Z, 2 hours and 8 minutes after that client disconnected — so this is not the disconnect-grace window elapsing, it is permanent.
Two calls in the same log carried no clientId on their start line and completed normally (17:10:28, 18:53:37). The failure tracks the stale attribution, not the tool.
From the user's side the tool is simply broken, and the model reasonably concludes the same — in this session it gave up and installed Chromium instead, then reported the integrated browser as failing on every call.
Why it never recovers
_pendingClientToolCalls yields each call's owner from toolCall.contributor.clientId, and _completeDisconnectedClientToolCalls fails the ones whose owner matches a departed client. Nothing re-attributes a new call to a live client that provides the same tool.
The host demonstrably knows a live client provides it: the retry sentence is guarded by _hasReplacementActiveClientTool, which returns true only when a different, active client offers the same tool name. So at the moment of failure the host holds both "this call belongs to a dead client" and "a live client provides this tool", and acts on the first.
Two chat/toolCallComplete actions are also dispatched for the same toolCallId (~2s apart), which looks wrong independent of the attribution.
Expected
A client tool call created after its contributor disconnected should be attributed to an active client that provides the tool. Failing that, the retry advice should not be emitted, since retrying cannot succeed — it currently sends the model into a loop that costs a turn and ends in a wrong conclusion about the tool.
Steps to reproduce
- Open a remote or dev container window and start an agent session that uses a client-contributed tool (the integrated browser tools are convenient).
- Reload the window, so the client reconnects with a new
clientId. - Ask the agent to use that tool.
Version
- VS Code 1.133.0, commit
a5b500951314efd502d07465bd138dfbd714a960 - Windows 11 client, dev container remote (linux-arm64 server)
Disclosure: this agent host is a locally patched build carrying approximations of several of my open PRs (#330683, #330684, #330730, #330746, #330775, #330933). None of them set contributor.clientId — the closest, the single-trigger change, only reads contributor.kind — and both the attribution and the failure path quoted above are unmodified. But #330933 does change when a client tool executes, so it is fair to ask whether it widens the window; I would rather say so than have it discovered later. The log evidence above is from that build.
AI disclosure: this issue was written with the assistance of AI.
Public patches and patcher scripts
Public patch catalog and patcher scripts · Source patch index. The public collection includes the maintained patchers, rollback instructions, regression scripts, and historical snapshots. Build restrictions and exact installer coverage are documented there.
Activity
RyanEwen commentedon Aug 17, 2026
Traced this to the end. There are two registries of "which client provides this tool" and a reconnect can leave them permanently disagreeing.
Where the dead id comes from. A Claude tool call is stamped at
claudeMapSessionEvents.ts:616:clientToolOwneris supplied atclaudeAgentSession.ts:601as(toolName: string) => this.toolDiff.model.ownerOf(toolName)— with nopreferredClientId. Without it,ActiveClientToolSet.ownerOffalls through to "the first-inserted contributor wins":The pre-reload client was inserted first, so it keeps winning for the life of the session.
Why the stale entry is never removed.
toolDiff.modelis only cleaned throughSessionActiveClientRemoved→agentSideEffects.ts:1637→removeActiveClient→removeClientTools. That action is dispatched by_removeActiveClient, which is guarded:So if the client is already out of
state.activeClientswhen release runs, the guard skips the dispatch, and nothing ever tells the tool model to drop it.state.activeClientsandtoolDiff.model._byClientthen disagree permanently — the first knows only the live client, the second still answers with the dead one.That is exactly the contradiction in the original report:
_hasReplacementActiveClientToolconsultsstate.activeClientsand correctly reports a live provider (hence the "you may try again" sentence), whileownerOfconsults_byClientand hands back the corpse. Both are right about their own registry.This is a gap against documented intent, not a missing feature.
ownerOfalready takespreferredClientId("WhenpreferredClientIdcurrently provides the tool it wins"), andActiveClientStatesays exactly what should happen here:That is the scenario in this issue, and the mechanism for it exists. The Claude stamp site just doesn't pass the argument.
canRefineContributorthen makes it terminal: a client contributor may only be refined by the same client, so once a call is stamped with the dead id nothing downstream can re-point it at the live one.Suggested fix, smallest first:
preferredClientIdatclaudeAgentSession.ts:601. Self-healing regardless of how the registries drift, and uses the parameter as designed._byClientcannot outlivestate.activeClients— otherwise the stale entry keeps shadowing any client that is not preferred.The codex path looks like it has the same shape —
codexMapAppServerEvents.ts:748callsstate.clientToolSet.ownerOf(params.item.tool)with no preferred id — though I have not reproduced it there.One inferential step, stated plainly: I did not capture the moment the guard was skipped, so "already out of
state.activeClientswhen release ran" is the mechanism that fits the evidence rather than something I watched happen. The two-registry disagreement itself is directly observed — the log has the host naming one client as active while stamping calls with another, two hours after that other client went away.AI disclosure: this comment was written with the assistance of AI.