Skip to content

fix(run_agent): shut down background review memory providers (salvage #15289)#16204

Merged
teknium1 merged 4 commits into
mainfrom
hermes/hermes-d7874f79
Apr 26, 2026
Merged

fix(run_agent): shut down background review memory providers (salvage #15289)#16204
teknium1 merged 4 commits into
mainfrom
hermes/hermes-d7874f79

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Shuts down the fork's memory provider before close so Hindsight's aiohttp session doesn't leak once per turn.

Salvage of #15289 by @mrhwick. Cherry-picked all three contributor commits onto current main; author attribution preserved via rebase merge.

Changes

  • run_agent.py _spawn_background_review: call review_agent.shutdown_memory_provider() in finally before review_agent.close(). Guarded with try/except Exception: pass.
  • tests/run_agent/test_background_review.py: new regression test asserting order init → run_conversation → shutdown_memory_provider → close.
  • scripts/release.py: AUTHOR_MAP entry (already in original PR).
  • Follow-up (ours): extended the test's bare-agent helper with session_id, _parent_session_id, _credential_pool, base_url/api_key/api_mode, and status_callback — live-runtime attrs the review fork started touching after fix(run_agent): background review fork inherits parent's live runtime #16099 landed.

Validation

Before After
run_agent.py finally block close() only shutdown_memory_provider() then close()
Targeted test passes (2.6s)
E2E method trace init → run → close init → run → shutdown → close

Closes #15289 (original PR, merged via salvage).

mrhwick and others added 4 commits April 26, 2026 12:42
Temporary background review agents can initialize Hindsight-backed memory clients, but close() alone skips provider teardown. Shut the memory provider down before closing so aiohttp sessions do not leak at process exit.

Made-with: Cursor
Background review fork now inherits session_id, credential_pool, and
status_callback from the parent (added in #16099 after this PR was
written). Extend the bare-agent helper so the regression test keeps
reaching the cleanup assertions instead of failing in the runtime
resolver.

Signed-off-by: Teknium <8425893+teknium1@users.noreply.github.com>
@teknium1 teknium1 merged commit 45bfcb9 into main Apr 26, 2026
10 of 11 checks passed
@teknium1 teknium1 deleted the hermes/hermes-d7874f79 branch April 26, 2026 19:45
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder labels Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants