Race condition leaks AI agents during session close

NousResearch/hermes-agent · cluster 49852 · gateway

Data as of

Nothing open on GitHub. Fix merged in #131328. Check it covers your case.

The short answer

0open issues
0open PRs
5items grouped
Known?
Yes. 5 related items grouped here, 2 issues already closed.
Fix event
A fix was merged to main in PR #131328. Check it covers your case. No release data is tracked.
Tracker
The maintainers' tracker marks this partially resolved, deciding PR #131328. That is separate from the fix event.
Still open
Nothing open on GitHub.

These issues and fixes address a race condition where closing a TUI session mid-build can orphan or leak a freshly constructed AIAgent. The work focuses on ensuring agents are properly cleaned up when session close races with the build process.

Open issues0

No open issues.

Open PRs0

No open pull requests.

Fixes on record

Merged to main. A stamp counts the issues a fix is linked to.

  • #131328 fix(tui): close agents that finish building after their session closed

    merged to main

    files: tests/tui_gateway/test_none_agent_turn_guard.py, tests/tui_gateway/test_profile_rebuild_commit.py, tests/tui_gateway/test_session_db_ownership_teardown.py, tests/tui_gateway/test_tui_gateway_server.py, tui_gateway/agent_callbacks.py, tui_gateway/server.py, tui_gateway/user_messages.py

2 PRs closed without merging

From the close comments: merged via another change 1 · superseded by another PR 1

  • #49756 fix(tui): close agents orphaned during session build · merged via another change → 382c912, #131328
  • #49886 fix(gateway): close orphaned agent when session.close races _make_agent · superseded by another PR → #49756
Closed issues · 2
  • Closed#49852TUI session.close can leak an AIAgent that finishes building concurrently
  • Closed#59218TUI gateway leaks the freshly built AIAgent when the session is closed mid-build
How this cluster was grouped
  • Link evidence (partly structural links): some members are connected by structural evidence (shared changed files, or a closing/superseded reference); the rest are joined by an automated relevance judgement over their text.
  • Members outside that structural core may belong to a different underlying problem.
  • Pairwise link density 0.34: the share of item 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.

Pick up a Lab task

Check whether a fix covers the open issues here, with your own agent. Bring back evidence for maintainers.

Open the Lab

At a glance

Subsystem
gateway
Merged PRs
#131328
Closed issues
2
Attempts
2 PRs closed without merging
Fix link checked
2 Oct 2026

For your agent

The same facts, typed.