Repository navigation
Conversation
The ephemeral thread that generates a session title was never unsubscribed, and session/close unsubscribes only the session's own thread. Codex keeps a subscribed thread loaded, so the title thread and the MCP servers started for it stayed until codex-acp exited. Unsubscribe the ephemeral thread once its turn has settled, whether the turn succeeded or failed. Fixes agentclientprotocol#628 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017izEynabPeSUBT573AtvaZ
This branch has not been deployed
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.
Problem
After the first turn of a new session,
TitleGenerator.generateAndPersiststarts an ephemeral thread, runs one turn on it to generate a title, and renames the main thread. Nothing releases that thread:closeSessionunsubscribes only the session's own thread id, and it is the only caller ofthreadUnsubscribe.Codex unloads a thread only when it has no subscribers and is idle (
thread_unload_delay_secs, 60 s by default). So the title thread stays loaded until codex-acp exits, together with every MCP server process Codex started for it from the user's config. A client that opens and closes many sessions over one codex-acp process accumulates one set of those processes per session (#628).Change
TitleGenerator.generateAndPersistunsubscribes the ephemeral thread in afinallyaround the title turn, so it is released whether the turn succeeds or fails.Tests
TitleGenerator.test.ts: the ephemeral thread is unsubscribed after the title turn and when the title turn fails (both fail without the change); the title is still written when the unsubscribe fails; no unsubscribe whenthread/startfails.session-fork-prompt.test.tsasserted that nothread/unsubscribeis sent at all. It now asserts that none is sent for the fork or its source, which is what the test is about.npm run typecheck,npm run buildandnpm testpass: 121 files and 1728 tests pass, 7 files and 36 tests are skipped.mainone is left until codex-acp exits.Fixes #628
🤖 Generated with Claude Code
https://claude.ai/code/session_017izEynabPeSUBT573AtvaZ