# NousResearch/hermes-agent · Fix post-terminal stream close race in Codex

## Open now

- Nothing open on GitHub.

These items address a concurrency bug in Codex where closing a stream from the owner thread while a drain thread is still reading it causes file-descriptor recycling corruption. The fix transfers stream-close ownership to the drain thread and limits the owner thread to a socket shutdown.

## TL;DR

- 6 member(s): 0 open issue(s), 1 closed issue(s), 0 open PR(s), 1 merged PR(s), 4 PR(s) closed without merging.
- A fix was merged to main in PR #130555. Verify it addresses your case.
- **Recommended:** read PR #130555 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `resolved` · deciding PR(s): `pr-130555`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_SPANNING`): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
- Pairwise link density `0.33`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Closed / duplicate issues

- #127390: Codex Responses post-terminal drain: closing the stream from the owner thread while the drain thread reads it releases the fd under the reader's SSL BIO (fd-recycle corruption, same class as #29507)

## Prior & competing PRs

- **#130555: Codex Responses: a slow post-reply stream drain no longer risks corrupting other open files (#127390, salvage #127615)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`; implication `superseded`
  - files: `agent/agent_runtime_helpers.py`, `agent/chat_completion_helpers.py`, `agent/codex_runtime.py`, `tests/agent/test_run_agent_codex_responses.py`
- **#127391: fix(codex): the post-terminal drain thread owns the stream close; the owner thread only shuts the socket down (#127390)**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#130555`, `#127390`
- **#127503: fix(P1): fix(codex): post-terminal drain thread owns the stream close**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#127615`, `#127390`, `#130555`
- **#127504: fix(P1): Bug: Codex Responses post-terminal drain fd-recycle corruption**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#127615`, `#127390`, `#130555`
- **#127615: fix(codex): keep post-terminal cleanup on the reader thread**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `cdb8fd3ef2`, `#130555`

## Fix status

- Merged to main in PR #130555 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-10-03`.
