Skip to content

fix(honcho): make startup fail open#24847

Merged
teknium1 merged 2 commits into
NousResearch:mainfrom
stephenschoettler:fix/honcho-startup-fail-open
Jun 2, 2026
Merged

fix(honcho): make startup fail open#24847
teknium1 merged 2 commits into
NousResearch:mainfrom
stephenschoettler:fix/honcho-startup-fail-open

Conversation

@stephenschoettler

@stephenschoettler stephenschoettler commented May 13, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Makes the Honcho memory provider fail open during Hermes startup when network-backed session creation is slow, unavailable, or stuck in Honcho peer setup. Context and hybrid modes now resolve the session key without network I/O, start session setup in a daemon thread, and return empty memory context until Honcho is ready instead of blocking agent construction.

The change preserves the existing tools-mode contracts: lazy tools mode still waits for the first Honcho tool call before initializing, while init_on_session_start=true remains eager and ready on return when startup succeeds.

Related Issue

Fixes #5726

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • plugins/memory/honcho/__init__.py
    • Resolve Honcho session keys without touching the network.
    • Move context/hybrid session creation, migration, and prewarm into guarded background startup.
    • Add _session_ready() so hooks do not use a manager that was assigned before get_or_create() and startup setup completed.
    • Keep tools lazy mode from starting background initialization in prefetch, queue_prefetch, sync_turn, and on_memory_write.
    • Clear partial managers on failed eager/lazy startup.
    • Guard on_session_end and shutdown while background init is still in flight.
  • tests/test_honcho_startup_fail_open.py
    • Add regressions for slow hybrid startup, first-turn context fail-open behavior, tools eager and lazy contracts, partial background startup readiness, eager failure cleanup, and init-lock race handling.

Duplicate search before opening found #5726 as the matching open issue. No open competing PRs were found for _do_session_init, HonchoSessionManager.get_or_create, Honcho session is still initializing, or Honcho add_peers. Related open PR #2164 is a stale tools-mode startup-context feature, not this fail-open fix.

How to Test

  1. Reproduce the slow-start path from Slow startup: Honcho memory provider blocks initialization for ~60s+ per step #5726 with Honcho enabled in context or hybrid mode and a slow or unavailable Honcho backend.
  2. Start Hermes. Agent construction should proceed while Honcho initializes in the background.
  3. Run validation:
git diff --check origin/main...HEAD
python -m pytest tests/test_honcho_startup_fail_open.py -q -o 'addopts='
python -m pytest tests/honcho_plugin -q -o 'addopts='
python -m ruff check plugins/memory/honcho/__init__.py tests/test_honcho_startup_fail_open.py tests/honcho_plugin/test_session.py
python -m py_compile plugins/memory/honcho/__init__.py tests/test_honcho_startup_fail_open.py
python scripts/check-windows-footguns.py --diff origin/main

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Arch Linux

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

N/A, this PR does not add a skill.

Screenshots / Logs

== git diff --check origin/main...HEAD ==

== pytest startup fail-open ==
.........                                                                [100%]
9 passed in 1.12s

== pytest honcho_plugin ==
266 passed in 3.06s

== ruff ==
All checks passed!

== py_compile ==

ALL_VALIDATION_PASSED
python scripts/check-windows-footguns.py --diff origin/main
✓ No Windows footguns found (2 file(s) scanned).

Infographic

honcho-startup-fails-open

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins labels May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slow startup: Honcho memory provider blocks initialization for ~60s+ per step

3 participants