Repository navigation
fix: start the title thread with the configured MCP servers disabled - #661
Pearcekieser wants to merge 1 commit into
Conversation
|
This is also a correctness and isolation problem, on top of the resource cost. The title thread ignores the session config, so it starts MCP servers the client explicitly disabled. What we seeOur ACP client launches codex-acp with ReproducedReproduced on codex-acp 2.6.0 with bundled Codex 0.166.0, on Windows 11:
A client that sets the title explicitly via This PR fixes the startup half, and #629 fixes the lifetime half. Could a maintainer take a look at both? Something the client disabled should not start anywhere in the session, and that seems worth a patch release. |
Problem
TitleGenerator.generateAndPersiststarts its ephemeral thread withthreadStart({cwd, ephemeral: true})and noconfig. Codex then loads the user's config.toml and starts every server in[mcp_servers]for that thread. The title turn uses an output schema and no tools, so those processes do nothing. A user with ten configured servers pays ten extra processes per titled session.#629 releases the title thread after the turn, so these processes exit 60 s later instead of living until codex-acp exits. It does not stop them from starting. This PR is the other half and does not depend on #629.
Change
thread/start,TitleGeneratorreads the effective config for the session's cwd withconfig/readand passesconfig: {mcp_servers: {<name>: {enabled: false}, ...}}for every configured name.config/readfails, the thread starts as before, with noconfig. Title generation stays best-effort.mcp_servers: {}disables nothing. Disabling a name no layer defines fails the wholethread/startwithinvalid transport in mcp_servers.<name>, so a hard-coded list or a union of all layers would be unsafe.Tests
TitleGenerator.test.ts: the title thread is started with each configured server disabled, with noconfigwhen none is configured, and with noconfigwhenconfig/readfails. The first test fails without the change.npm run typecheckandnpm run buildpass.npm test: 1869 passed, 36 skipped, 1 failed. The failure isJsonSnapshot.test.ts > leaves values nested thousands deep to JSON.stringify, which fails the same way onmain(636b082) on this host.session/newwith a session MCP server, one prompt andsession/close:In every run the main thread's servers started and stopped the same way, 60 s after
session/close.codex app-serverprobe ofthread/start {ephemeral: true}with 2 configured servers: noconfigstarted 2,{"mcp_servers": {}}started 2, nested{name: {enabled: false}}started 0, the dottedmcp_servers.<name>.enabledform started 0, and an undefined name failedthread/startwith-32600.Related to #628 and #629.