# NousResearch/hermes-agent · Fix unpaired agent lifecycle hooks on turn failure

## Open now

- 1 issue, 3 PRs open on GitHub.
- #113057: \[Bug\]: agent:end is not emitted when a turn raises, leaving agent:start unpaired
- PR #113162: fix(gateway): emit agent:end when a turn fails or is abandoned
- PR #113529: fix(gateway): pair agent lifecycle hooks on failed turns
- PR #115660: fix(gateway): emit agent:end when a turn raises (pairs agent:start)

These issues and PRs address a bug where agent:end is not emitted when a turn raises an error or is abandoned, leaving agent:start without a corresponding end event. The fixes ensure agent lifecycle hooks are properly paired in failure and abandonment scenarios.

## TL;DR

- 4 member(s): 1 open issue(s), 0 closed issue(s), 3 open PR(s), 0 merged PR(s), 0 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

- #113057: \[Bug\]: agent:end is not emitted when a turn raises, leaving agent:start unpaired

## Prior & competing PRs

- **#113162: fix(gateway): emit agent:end when a turn fails or is abandoned**. open
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `30cbe29766fd`, `#113529`, `#113529`, `#113057`, `#113057`
  - files: `evals/gateway_completion/delivery_lifecycle.py`, `gateway/run_turn.py`, `tests/gateway/test_gateway_silence_tokens.py`, `website/docs/user-guide/features/hooks.md`
- **#113529: fix(gateway): pair agent lifecycle hooks on failed turns**. open
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#113162`, `#113057`, `#113162`
  - files: `gateway/run_turn.py`, `tests/gateway/test_gateway_silence_tokens.py`
- **#115660: fix(gateway): emit agent:end when a turn raises (pairs agent:start)**. open
  - maintainer direction: category `uncategorized`; implication `needs_llm`
  - files: `gateway/hooks.py`, `gateway/run_turn.py`, `tests/gateway/test_agent_end_on_error.py`

## Fix status

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