Skip to content

app-server: experimental thread listener cleanup and archive state teardown - #12505

Closed
vincentkoc wants to merge 1 commit into
openai:mainfrom
vincentkoc:vincentkoc-code/exp-thread-listener-cleanup
Closed

vincentkoc wants to merge 1 commit into
openai:mainfrom
vincentkoc:vincentkoc-code/exp-thread-listener-cleanup

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Feb 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add experimental feature flag features.thread_listener_cleanup (default false)
  • when enabled, clear per-thread listener state when the last subscriber disconnects or unsubscribes
  • always clear ThreadStateManager state during archive teardown, even if the thread was already removed from ThreadManager
  • skip event JSON serialization work when no subscribers are attached

Scope and relationship

  • complementary to app-server: retain thread listener across disconnects #12373 (retain thread listener across disconnects): default behavior remains unchanged
  • adds a controlled /experimental option for high-memory-pressure sessions where listener retention may be costly
  • focused on app-server in-memory retention only (does not attempt MCP process lifecycle cleanup in the desktop app process)

Why

  • targets retained thread/listener state and background memory pressure patterns reported in app sessions with many threads (including my local 5+ concurrent thread usage)
  • low risk: default behavior is unchanged unless experimental flag is enabled

Fixes: #12491
Related: #12414

Local validation

  • just fmt
  • did not run full test/build locally in this pass

@github-actions

github-actions Bot commented Feb 22, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@vincentkoc

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Feb 22, 2026
@etraut-openai

Copy link
Copy Markdown
Contributor

We've updated our contribution guidelines to indicate that we're no longer accepting unsolicited code contributions. All code contributions are by invitation only. To read more about why we've taken this step, please refer to this announcement.

@vincentkoc

Copy link
Copy Markdown
Contributor Author

Per docs/contributing.md (invitation-only external code contributions), I am treating this as a draft patch proposal linked from #12491. If maintainers want this path, I can run full validation and iterate scope quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codex.app GUI: MCP child processes not reaped after task completion — 1300+ zombies, 37GB memory leak

2 participants