Skip to content

fix(honcho): cleanly shutdown one-shot memory - #58292

Open
motoblurr wants to merge 1 commit into
NousResearch:mainfrom
motoblurr:fernando/honcho-oneshot-clean-shutdown
Open

motoblurr wants to merge 1 commit into
NousResearch:mainfrom
motoblurr:fernando/honcho-oneshot-clean-shutdown

Conversation

@motoblurr

@motoblurr motoblurr commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • flush/shutdown Honcho memory provider from oneshot paths before process exit
  • gracefully stop Honcho session async writer during shutdown
  • expose safer honcho_conclude cleanup helpers (list_recent, delete_text, delete_tag, dry-run, IDs)
  • add regression coverage for one-shot active-session release before hard exit
  • add Honcho sync hygiene guard: exact-response probes and configured temporary verification patterns are not persisted

Verification

  • source .venv/bin/activate && python -m pytest tests/honcho_plugin/test_session.py::TestConcludeToolDispatch tests/test_honcho_client_config.py tests/test_honcho_session_context.py tests/test_honcho_startup_fail_open.py tests/agent/test_oneshot.py tests/cli/test_cli_shutdown_memory_messages.py tests/cli/test_single_query_session_finalize.py -q -o 'addopts=' --tb=short → 65 passed in 1.06s
  • source .venv/bin/activate && ruff check plugins/memory/honcho/__init__.py plugins/memory/honcho/client.py tests/honcho_plugin/test_session.py tests/test_honcho_client_config.py → passed
  • python scripts/check-windows-footguns.py --all → passed
  • git diff --check → passed
  • Live smoke: hermes chat -q 'Reply exactly: SKIPMEM-20260704' --toolsets safe -Q → SKIPMEM-20260704, EXIT_CODE=0
  • hermes honcho status → Enabled True, workspace fernando-ai-memory, recall hybrid, write freq async, connection OK

Notes

  • Upstream GitHub Actions currently requires maintainer approval for the fork PR (action_required / no jobs started).

@motoblurr
motoblurr force-pushed the fernando/honcho-oneshot-clean-shutdown branch from c9dd5a3 to c5d7418 Compare July 4, 2026 13:44
@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 labels Jul 4, 2026
@motoblurr
motoblurr force-pushed the fernando/honcho-oneshot-clean-shutdown branch from c5d7418 to 3fe79e6 Compare July 4, 2026 14:00
@motoblurr

Copy link
Copy Markdown
Contributor Author

Local verification is green for the affected Python/Honcho paths. GitHub Actions did not start jobs because this fork PR is in action_required state and needs maintainer approval. Latest run: https://github.com/NousResearch/hermes-agent/actions/runs/28708541617

@motoblurr
motoblurr force-pushed the fernando/honcho-oneshot-clean-shutdown branch from 3fe79e6 to ab6b33f Compare July 4, 2026 14:48

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Comment

Cleans up one-shot memory after a Honcho one-shot task completes. The one-shot memory was not being released, causing potential memory buildup on long-running agents.

Observations

  • 6 files, 308 additions — this is a reasonable scope for a memory lifecycle fix.
  • The finally block pattern is correct for guaranteed cleanup.

Looks Good

  • No hardcoded secrets
  • No debug artifacts
  • Memory cleanup is well-placed

Reviewed by Hermes Agent

@teknium1

Copy link
Copy Markdown
Collaborator

Thanks for addressing the missing one-shot memory boundary; the premise remains valid on current main: hermes_cli/oneshot.py:425-426 returns directly after run_conversation() without calling the agent lifecycle shutdown.

Problems

  • The new os._exit(0) in cli.py's _finalize_single_query() masks failures. Current main invokes that finalizer in the finally around cli.chat() (cli.py:16456-16459), so a failed human single-query run with Honcho configured would terminate with status 0 instead of propagating its error.
  • The one-shot lifecycle change needs direct coverage. The existing -z tests at tests/hermes_cli/test_tui_resume_flow.py:633-718 stub _run_agent(), so they cannot verify that _run_agent() calls shutdown_memory_provider() after success and failure.

Suggested changes

  • Remove the unconditional hard exit and retain the existing bounded cleanup watchdog (cli.py:994-1049) as the forced-exit backstop.
  • Add focused _run_agent() lifecycle tests for both normal and exception paths.

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 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