Repository navigation
refactor(provider-core): MCP provider sessions live in a McpProviderSessions service - #17446
juliusmarminge wants to merge 1 commit into
Conversation
…essions service The per-thread MCP credentials were a module-level Map in mcpSession.ts. The session manager now writes them through McpProviderSessions and adapters yield it, reading the session once per launch and handing it to their pure option builders. The server provides one instance; tests get a fresh one per layer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR replaces global per-thread MCP credential state with an Effect service and threads it through the session manager and numerous provider launch and runtime paths. Because the shared-infrastructure refactor changes credential lifecycle and authentication-sensitive behavior across 48 files, human review is warranted. You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
The per-thread T3 MCP credentials lived in a module-level
Mapinprovider-core/server/mcpSession.ts, behindset/read/clearMcpProviderSessionfunctions that any module could call. That's hidden global state, and it leaked between tests.This PR adds
@t3tools/provider-core/server/McpProviderSessions, a service withset,readandclear. The server provides it once, soProviderSessionManagerand every adapter share one instance.claudeMcpQueryOverrides,codexThreadRuntimeParams,cursorMcpServers,acpMcpContext) take the session they're given instead of looking it up.makeClaudeAdapterV2andmakeCodexAdapterV2are nowEffect.fn, so they can yield the service.McpProviderSessions. Tests get a fresh instance per layer, which replaces the old manual set/clear on the global.Part of the provider-package audit (stack #17428).
Model: Claude Opus 5.5 via Claude Code in T3 Code.
🤖 Generated with Claude Code