# NousResearch/hermes-agent · Agent close prematurely kills in-flight shared client

## Open now

- 1 issue, 2 PRs open on GitHub.
- #107475: \`agent_close\` closes the shared OpenAI/httpx client without the in-use check the per-request path already performs, killing a concurrent auxiliary stream
- PR #107604: fix(agent): retire the shared client instead of closing it mid-request
- PR #107608: fix(agent): retire the shared client in close() instead of hard-closing it (#107475)

These items address a bug where closing an agent tears down the shared HTTP/OpenAI client while concurrent requests are still using it. The fix replaces hard-close with a retire/drain approach that waits for in-flight requests to finish.

## TL;DR

- 4 member(s): 1 open issue(s), 0 closed issue(s), 2 open PR(s), 0 merged PR(s), 1 PR(s) closed without merging.
- No fix has been merged to main; one or more PRs were attempted (see below).
- **Recommended:** review the prior/competing PR(s) below. A fix was attempted but not merged; your case may extend or revive that work.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `unresolved`. 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.50`: 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.

## Open related issues

- #107475: \`agent_close\` closes the shared OpenAI/httpx client without the in-use check the per-request path already performs, killing a concurrent auxiliary stream

## Prior & competing PRs

- **#107604: fix(agent): retire the shared client instead of closing it mid-request**. open
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#107632`, `#107475`, `#107604`, `#107632`, `#107604`, `#107632`, `#107632`, `#107604`
  - files: `agent/chat_completion_helpers.py`, `agent/client_lifecycle.py`, `agent/codex_runtime.py`, `run_agent.py`, `tests/run_agent/test_107475_agent_close_shared_client_in_flight.py`
- **#107608: fix(agent): retire the shared client in close() instead of hard-closing it (#107475)**. open
  - maintainer direction: category `uncategorized`; implication `needs_llm`; refs `49e6c51d5755ce7977609ae83d6a6f2eda53deff`, `cebf83e1492b9c698b0bc9a87b3680010e88e638`, `#107475`, `#107604`
  - files: `run_agent.py`, `tests/run_agent/test_agent_close_shared_client_race.py`
- **#107632: fix(agent): keep the shared client open while requests are in flight during agent_close**. closed without merge
  - maintainer direction: category `uncategorized`; implication `needs_llm`; refs `#107604`

## Fix status

- No merged fix on record.
- Subsystem: `agent`
