You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MCP credential is still revoked when a thread switches provider instance #36453
After a thread goes A → B → A between provider instances, A's T3 tool calls fail with 401 or parent_not_active, because opening B revoked A's MCP credential.
Follows #16565, which was closed as a duplicate of #23198. #23198 is merged and included in current main (eb14ddb), but this still happens there: #23198 fixes a different path.
#23198 releases the old provider session when a thread moves to another provider instance. This bug is in the MCP credential store: McpProviderSessions keeps one credential per thread, and opening instance B calls mcpSessionRegistry.revokeThread(threadId) (ProviderSessionManager.ts:598 on eb14ddb). A's process keeps its old token, so after A → B → A its T3 tool calls get 401 or parent_not_active. bompus found the same thing on fc2b5de (in #16565).
Repro with fake adapters and no provider login: apply only the test-file hunk of #35331 to main and run its regression test.
git checkout eb14ddb7992
git fetch https://github.com/pingdotgg/t3code pull/35331/head
git diff 2482b03a01c FETCH_HEAD -- apps/server/src/orchestration-v2/ProviderSessionManager.test.ts | git apply -3
cd apps/server
vp test run src/orchestration-v2/ProviderSessionManager.test.ts -t "A → B → A"
× ProviderSessionManagerV2 preserves MCP access through A → B → A and isolates cleanup
AssertionError: expected undefined to equal 'thread-provider-session-manager-switc…'
- Expected: "thread-provider-session-manager-switch-back"
+ Received: undefined
❯ src/orchestration-v2/ProviderSessionManager.test.ts:3020:18
const caller = yield* registry.resolve(token);
assert.equal(caller?.thread.threadId, threadId);
Tests 1 failed | 70 skipped (71)
It fails at the first access check after B opens: A's token no longer resolves. The test opens A, detaches it with "Provider or model selection changed." the way the orchestrator does, then opens B. The fix is in #35331.
I tried to reproduce this on the current build and could not.
Commit a6d9140 (origin/main). Seen in the ProviderSessionManager test with fake adapters, not in a live app run with two real provider instances. (1) Applied the test-file hunk of the closed, unmerged PR #35331 and ran vp test run src/orchestration-v2/ProviderSessionManager.test.ts -t "A → B → A" in apps/server. It failed exactly as the issue shows: expected undefined to equal 'thread-provider-session-manager-switch-back' at the first access check after B opens. (2) That hunk depends on #35331's new mcpSessions.read(threadId, instanceId) API, so I wrote a smaller test against main's API. The test harness gets an optional second fake adapter under instance codex-other. The test opens instance A, detaches it with "Provider or model selection changed." the way the orchestrator does, opens instance B, then resolves A's token through McpSessionRegistry. It gets undefined, so A's credential was revoked. Full file: 1 failed (the new test), 70 passed. Server typecheck and lint pass. Code: ProviderSessionManager.ts:598 calls mcpSessionRegistry.revokeThread(threadId) before issuing B's credential, and McpProviderSessions stores one credential per thread.
Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.
This still happens on current main (60e4be4). It was first reported in #16565 on 0.0.46-nightly.20261005.2702.
Steps:
Run a turn in a thread on Claude.
Switch the thread to Codex (a different provider instance) and run a turn.
Switch back to Claude and have it call a T3 tool such as delegate_task. The call fails with parent_not_active or 401 Authentication required.
The live run is the maintainer reproduction on #16565, on main at 3b95e78: Claude Opus 5.5 → Codex GPT-6.1-Sol → Claude Opus 5.5 in one thread, then delegate_task failed with parent_not_active. I didn't do a new live run. On 60e4be4, #35331's test fails the same way the closing comment shows: A's token resolves to undefined after B opens, because ProviderSessionManager revokes the thread's credential before issuing B's.
#36801 ports the fix to current main, replacing #35331. With it, that test passes.
Activity
juliusmarminge commentedon Nov 14, 2026
I tried to reproduce this on the current build and could not.
Commit a6d9140 (origin/main). Seen in the ProviderSessionManager test with fake adapters, not in a live app run with two real provider instances. (1) Applied the test-file hunk of the closed, unmerged PR #35331 and ran
vp test run src/orchestration-v2/ProviderSessionManager.test.ts -t "A → B → A"in apps/server. It failed exactly as the issue shows:expected undefined to equal 'thread-provider-session-manager-switch-back'at the first access check after B opens. (2) That hunk depends on #35331's newmcpSessions.read(threadId, instanceId)API, so I wrote a smaller test against main's API. The test harness gets an optional second fake adapter under instancecodex-other. The test opens instance A, detaches it with "Provider or model selection changed." the way the orchestrator does, opens instance B, then resolves A's token through McpSessionRegistry. It gets undefined, so A's credential was revoked. Full file: 1 failed (the new test), 70 passed. Server typecheck and lint pass. Code: ProviderSessionManager.ts:598 callsmcpSessionRegistry.revokeThread(threadId)before issuing B's credential, and McpProviderSessions stores one credential per thread.Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.
Alb11747 commentedon Nov 14, 2026
This still happens on current
main(60e4be4). It was first reported in #16565 on 0.0.46-nightly.20261005.2702.Steps:
delegate_task. The call fails withparent_not_activeor401 Authentication required.The live run is the maintainer reproduction on #16565, on
mainat 3b95e78: Claude Opus 5.5 → Codex GPT-6.1-Sol → Claude Opus 5.5 in one thread, thendelegate_taskfailed withparent_not_active. I didn't do a new live run. On 60e4be4, #35331's test fails the same way the closing comment shows: A's token resolves toundefinedafter B opens, becauseProviderSessionManagerrevokes the thread's credential before issuing B's.#36801 ports the fix to current
main, replacing #35331. With it, that test passes.Posted by Claude Opus 5.5 on behalf of Alb11747.
docs(fork): link replacement upstream PR pingdotgg#36801 for per-prov…