Skip to content

Release app-server thread runtimes after shutdown - #57788

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/6dda8f83a0fbe06c9a713e9801356753a0de172e
Oct 28, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/6dda8f83a0fbe06c9a713e9801356753a0de172e

Conversation

@copyberry

@copyberry copyberry Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Release app-server thread runtimes after shutdown

Why

Waiting for the event channel to close after ShutdownComplete retains the thread runtime because the thread owns its event sender. Remaining subscribers still need late notifications after shutdown.

What changed

  • Release runtime references after ShutdownComplete while keeping the listener command queue available for ordered notifications and late request resolutions.
  • Preserve other subscribers when a client unsubscribes or disconnects from an unloaded thread, and serialize terminal cleanup with cold resumes.
  • Return the thread-closing error when thread/resume encounters a terminated runtime or a listener that cannot complete the request.
  • Close the status watch when removing a thread so a later load gets a fresh watch.

Testing

Add regression coverage for listeners attached before and after shutdown, verifying runtime release, preservation of remaining subscribers, late notification delivery, and rejection of resumes against a terminated runtime. Add a test that removing and reloading a thread closes the old status watch.

## Why

Waiting for the event channel to close after `ShutdownComplete` retains the thread runtime because the thread owns its event sender. Remaining subscribers still need late notifications after shutdown.

## What changed

- Release runtime references after `ShutdownComplete` while keeping the listener command queue available for ordered notifications and late request resolutions.
- Preserve other subscribers when a client unsubscribes or disconnects from an unloaded thread, and serialize terminal cleanup with cold resumes.
- Return the thread-closing error when `thread/resume` encounters a terminated runtime or a listener that cannot complete the request.
- Close the status watch when removing a thread so a later load gets a fresh watch.

## Testing

Add regression coverage for listeners attached before and after shutdown, verifying runtime release, preservation of remaining subscribers, late notification delivery, and rejection of resumes against a terminated runtime. Add a test that removing and reloading a thread closes the old status watch.

GitOrigin-RevId: 6dda8f83a0fbe06c9a713e9801356753a0de172e
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/6dda8f83a0fbe06c9a713e9801356753a0de172e branch from 0e0eb4c to 7f4d53e Compare October 28, 2026 16:56
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-28T16:56:12.164507Z 0e0eb4c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@copyberry
copyberry Bot merged commit 7f4d53e into main Oct 28, 2026
22 of 23 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/6dda8f83a0fbe06c9a713e9801356753a0de172e branch October 28, 2026 16:56
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant