Skip to content

fix(honcho): preserve memory when backend rejects conclusions#26484

Open
atmigtnca wants to merge 1 commit into
NousResearch:mainfrom
atmigtnca:fix/honcho-memory-fallback
Open

fix(honcho): preserve memory when backend rejects conclusions#26484
atmigtnca wants to merge 1 commit into
NousResearch:mainfrom
atmigtnca:fix/honcho-memory-fallback

Conversation

@atmigtnca

Copy link
Copy Markdown

What does this PR do?

Fixes two Honcho memory reliability failures seen in normal Hermes sessions:

  1. sync_turn now normalizes structured/multimodal message content before calling sanitize_context, so image/audio/list-style provider payloads do not raise TypeError: expected string or bytes-like object, got 'list' and drop the whole turn.
  2. honcho_conclude now preserves explicit durable facts in the target peer card when a self-hosted Honcho backend can store/search raw messages but rejects conclusion creation because backend LLM credentials are missing.

The fallback keeps the same observer/target relationship used by the normal conclusion path and deduplicates the fact before appending it to the peer card.

Related Issue

No linked GitHub issue.

Related open PRs found while checking for duplicates:

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
    • Add _content_to_text() to coerce strings, dicts, and OpenAI-style content lists into safe text before Honcho ingest.
    • Preserve text parts and replace media parts with compact placeholders such as [image attachment] and [audio attachment].
  • plugins/memory/honcho/session.py
    • Track the observer peer used for conclusion creation.
    • If the conclusion API rejects the write, append the fact to the observer's target peer card as a fallback.
  • tests/honcho_plugin/test_session.py
    • Add regression coverage for multimodal sync_turn normalization.
    • Add regression coverage for conclusion-to-peer-card fallback behavior.

How to Test

  1. python -m pytest tests/honcho_plugin/test_session.py -q -o 'addopts='
  2. git diff --check
  3. python -m compileall -q plugins/memory/honcho tests/honcho_plugin
  4. python -m ruff check plugins/memory/honcho/__init__.py plugins/memory/honcho/session.py tests/honcho_plugin/test_session.py

Full-suite note: I also attempted scripts/run_tests.sh for CI parity. It reached 93% before the 600s local command timeout and had unrelated failures outside this Honcho change area, so this PR reports the focused checks above rather than claiming a full-suite pass.

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: Ubuntu Linux 6.8.0-39-generic / Python 3.11.15

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

Screenshots / Logs

$ python -m pytest tests/honcho_plugin/test_session.py -q -o 'addopts='
117 passed in 3.66s

$ git diff --check && python -m compileall -q plugins/memory/honcho tests/honcho_plugin
# no output

$ python -m ruff check plugins/memory/honcho/__init__.py plugins/memory/honcho/session.py tests/honcho_plugin/test_session.py
All checks passed!

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins tool/memory Memory tool and memory providers labels May 15, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

The sync_turn multimodal normalization part of this PR overlaps with #22768 (sync_turn crashes on list input from image-bearing messages). The conclusion fallback to peer cards overlaps with #17124 (fallback to durable peer cards for profiles).

Related: #22768, #17124, #23022, #24270.

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

2 participants