# NousResearch/hermes-agent · Cancel agent tasks when session ends or stops

## Open now

- Nothing open on GitHub.

These items address a bug where deleting or stopping a session did not interrupt the agent's running turn or background review tasks, allowing runaway model calls to continue. The work involves adding cancellation logic for active turns and background forks on session teardown and stop.

## TL;DR

- 4 member(s): 0 open issue(s), 1 closed issue(s), 0 open PR(s), 1 merged PR(s), 2 PR(s) closed without merging.
- A fix was merged to main in PR #128360. Verify it addresses your case.
- **Recommended:** read PR #128360 (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-128360`. 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.

## Closed / duplicate issues

- #102895: \[Bug\] Deleting a desktop session does not stop its running agent turn — failed-tool retry loop kept calling the model for 70+ min until app restart

## Prior & competing PRs

- **#128360: fix(agent): cancel a session's background review fork on teardown and /stop (#102895)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `agent/background_review.py`, `tests/tui_gateway/test_finalize_session_cancels_background_review.py`, `tests/tui_gateway/test_session_interrupt_cancels_background_review.py`, `tui_gateway/session_lifecycle.py`
- **#102911: session: interrupt running turn when session is deleted**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#75616`, `#102895`
- **#103094: fix(agent): cancel background review when session ends or is stopped**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#128360`

## Fix status

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