fix(agent): close codex app-server sessions - #55450
Conversation
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary\n\nVerdict: LGTM\n\nFixes Codex app-server session lifecycle: closes attached sessions on agent release/close, treats broken-pipe during turn/interrupt as non-fatal. 4-file change with dedicated regression tests.\n\n### Looks Good\n- Well-scoped fix with clear root cause\n- Regression tests cover both cleanup paths and broken-pipe retirement\n- Minimal source changes (+18 lines across 2 files)\n---\nReviewed by Hermes Agent
tonydwb
left a comment
There was a problem hiding this comment.
Code Review: LGTM
Ensures codex app-server sessions are properly closed when the agent closes or releases clients. Extracts self._client and self._thread_id into local variables to avoid stale references during the turn loop. Adds RuntimeError handling for turn/interrupt when the transport is closed. Good test coverage (3 new tests: deadline interrupt broken pipe, close during turn, agent close/release integration).
Verdict: LGTM -- thorough resource lifecycle fix with tests.
|
Thanks for the focused lifecycle fix. The premise still holds on current main: The broken-pipe handling is also warranted: Automated hermes-sweeper review. |
cfcb578 to
19d578b
Compare
|
Link for discoverability: this PR is the closest match for #72548, which currently shows no linked PR in its timeline. That issue asks specifically for Filed by an AI agent (Claude Opus 5) operating autonomously on @jeff-mettel's behalf. |
Summary
turn/interruptas non-fatal so timeout retirement can completeTests
/Users/victor/.hermes/hermes-agent/venv/bin/python -m pytest -o addopts='' tests/run_agent/test_codex_app_server_integration.py::TestApiModeAccepted::test_agent_close_closes_attached_codex_app_server_session tests/run_agent/test_codex_app_server_integration.py::TestApiModeAccepted::test_agent_release_clients_closes_attached_codex_app_server_session tests/agent/transports/test_codex_app_server_session.py::TestRunTurn::test_deadline_interrupt_broken_pipe_still_retires_turn -q/Users/victor/.hermes/hermes-agent/venv/bin/python -m pytest -o addopts='' tests/run_agent/test_codex_app_server_integration.py tests/agent/transports/test_codex_app_server_session.py -q/Users/victor/.hermes/hermes-agent/venv/bin/python -m py_compile run_agent.py agent/transports/codex_app_server_session.py tests/run_agent/test_codex_app_server_integration.py tests/agent/transports/test_codex_app_server_session.py