fix(summarizer): isolate MCP servers and settings in summarizer subprocess#107
Open
madorb wants to merge 1 commit into
Open
fix(summarizer): isolate MCP servers and settings in summarizer subprocess#107madorb wants to merge 1 commit into
madorb wants to merge 1 commit into
Conversation
…ocess
The background summarizer runs each archived conversation through the
Claude Agent SDK with resume + the conversation's cwd. The SDK loads all
filesystem settings by default, so each summarization booted the user's
entire global MCP fleet — one set of MCP server subprocesses per
conversation. Servers that open a GUI (e.g. Serena's web dashboard) pop a
window per conversation; the rest start and tear down silently, churning
CPU/RAM. With a backlog of N conversations, one SessionStart sync fans
out to N x (whole MCP fleet).
Pass settingSources: [] (the SDK's documented isolation mode) and
mcpServers: {} so the summarizer subprocess loads no filesystem settings
or MCP servers. A summarizer needs neither.
Fixes obra#106
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The background summarizer (
summarizer.ts→buildSummarizerQueryOptions) runs each archived conversation through the Claude Agent SDK withresume+ the conversation'scwd. The SDK loads all filesystem settings by default, so every summarization boots the user's entire global MCP server set — one MCP fleet spawned per conversation. MCP servers that open a GUI (e.g. Serena's web dashboard) pop a window per conversation; the rest start and tear down silently, churning CPU/RAM. With a backlog of N conversations, a singleSessionStartsync fans out to N × (whole MCP fleet).Same root mechanism as #83 (
resume→ full Claude Code session subprocess) and the MCP-config analog of #104 (summarizer inheriting global env).Change
Two options added to the summarizer's
query():settingSources: []— the SDK's documented isolation mode ("Pass[]to disable filesystem settings (SDK isolation mode)"). This is the actual leak: the option is currently omitted, and the SDK docs note that when omitted, all sources are loaded.mcpServers: {}— makes the empty server set explicit.A summarizer needs no tools or MCP servers. This sits alongside the existing
persistSession: falseisolation (#83).Testing
npm run build— clean (tsc+esbuild).npm test— 209 passed. One unrelated failure: abeforeEachhook timeout insearch-metadata-filtersfrom a cold embedding-model load exceeding the 10s hook limit (not touched by this change; later tests in that same file pass).test/summarizer-options.test.tscoveringsettingSources: []andmcpServers: {}on both fresh and resumed option builds.Notes
dist/for the changed module (dist/summarizer.js,dist/summarizer.d.ts), perCLAUDE.md.dist/version.*/dist/mcp-server.jsversion-string drift (committed1.4.1vspackage.json1.4.2) untouched to keep this PR focused on the fix.Fixes #106