Skip to content

fix: shut down Honcho memory threads in oneshot mode - #52186

Open
pajoric wants to merge 1 commit into
NousResearch:mainfrom
pajoric:fix/honcho-oneshot-shutdown
Open

fix: shut down Honcho memory threads in oneshot mode#52186
pajoric wants to merge 1 commit into
NousResearch:mainfrom
pajoric:fix/honcho-oneshot-shutdown

Conversation

@pajoric

@pajoric pajoric commented Jun 24, 2026

Copy link
Copy Markdown

Summary

This fixes a process shutdown issue affecting Hermes oneshot mode when the Honcho memory provider is active.

The observed behavior was:

  • The oneshot request completed successfully.
  • The expected response was printed.
  • The process then terminated with SIGABRT (exit code 134).

The issue occurred during process teardown rather than request execution.

Reproduction

Using current upstream:

time hermes -z "Reply with exactly: Hermes update validation complete."
echo $?

@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard comp/plugins Plugin system and bundled plugins tool/memory Memory tool and memory providers P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels Jun 24, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #31664 — same mechanism: a try/finally in hermes_cli/oneshot.py that calls agent.shutdown_memory_provider(...), plus Honcho-side thread-join hardening in session.shutdown(), to stop the oneshot SIGABRT (exit 134) when the Honcho memory provider is active. Related: #49498 (atexit-hook + httpx-close variant) and #50217 (skip-prefetch-enqueue variant) attack the same SIGABRT cluster via different mechanisms. Flagging for a maintainer to pick the canonical fix.

@hugoalvespereira

Copy link
Copy Markdown

This was generated by AI during triage.

Duplicate of #31664 — same mechanism: a try/finally in hermes_cli/oneshot.py that calls agent.shutdown_memory_provider(...), plus Honcho-side thread-join hardening in session.shutdown(), to stop the oneshot SIGABRT (exit 134) when the Honcho memory provider is active. Related: #49498 (atexit-hook + httpx-close variant) and #50217 (skip-prefetch-enqueue variant) attack the same SIGABRT cluster via different mechanisms. Flagging for a maintainer to pick the canonical fix.

Ok. I’ll wait for y'alls call on which fix you guys prefer

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for targeting the oneshot memory-worker lifecycle gap; current main still returns from the oneshot agent path without memory-provider teardown.

Problems

  • The PR changes an older agent.chat() call, but current main calls agent.run_conversation() at hermes_cli/oneshot.py:425-426 (introduced by 093f567f0d). The finalizer must be transplanted onto that current tuple-return path.
  • The new prefetch-thread list can still race shutdown: session.shutdown() snapshots it, but no closed-state guard prevents a concurrent prefetch_context() from appending a new daemon afterward. Current provider paths call it at plugins/memory/honcho/__init__.py:677 and :819.
  • The PR adds no regression test. The existing oneshot integration coverage is in tests/hermes_cli/test_tui_resume_flow.py:823-881.

Suggested changes

  • Finalize in a try/finally around current run_conversation(), forwarding _session_messages using the guarded pattern in cli.py:1128-1147.
  • Synchronize shutdown with prefetch registration using a terminal closed state, and add tests for transcript forwarding, exceptional exit, and no post-shutdown prefetch creation.

This is an automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform area/memory Memory subsystem: store, providers, sync, background reviews labels Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/memory Memory subsystem: store, providers, sync, background reviews comp/cli CLI entry point, hermes_cli/, setup wizard comp/plugins Plugin system and bundled plugins duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state tool/memory Memory tool and memory providers type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants