Files
codex/codex-rs/code-mode
Charlie Marsh 714bc44f0d Reap idle local code-mode hosts after five seconds (#63537)
## Why

The local code-mode host could stay running after its last session
closed. A short grace period allows nearby sessions to reuse the same
process while releasing it after sustained inactivity.

## What changed

Keep the host active while session leases or operation RPCs are in
flight. Once they drain, start a five-second idle timer. New activity
cancels retirement and starts a fresh grace period when it drains.
Process metrics only sample an existing host and leave the idle timer
untouched. Opening a session after retirement starts a fresh host.

## Testing

Add a lifecycle test that covers overlapping sessions, reuse during the
grace period, retirement despite metrics polling, and startup on the
next session.

GitOrigin-RevId: 2ebf7f7b3b3bf2d5a602b0e5b9085195eee13446
2026-11-24 04:29:16 +00:00
..
2026-03-20 23:36:58 -07:00