fix(honcho): honcho_search returns empty in directional observation mode - #48602
fix(honcho): honcho_search returns empty in directional observation mode#48602keislij wants to merge 3 commits into
Conversation
search_context() resolved observer->target as hermes-about-Jesse, whose representation slot is empty in directional mode; the peer's own self-representation holds the data. Unlike get_peer_card(), search_context() had no fallback, so honcho_search returned '' for every query while honcho_profile/context/reasoning worked. Mirror the get_peer_card() target-peer fallback: when the directional fetch yields no representation and no card, refetch directly against the target peer. Preserves directional precedence (only falls back when empty) and is a no-op for the ai-peer path where observer == target. Verified against the live backend: queries that returned 0 chars now return 1840-2949 char representations.
Regression test for the honcho_search empty-result fix: in directional observation mode the assistant->user slot is empty (representation and card), so search_context must fall back to the user peer's own self-context. Mirrors test_get_peer_card_falls_back_to_target_peer_own_card.
There was a problem hiding this comment.
Pull request overview
Fixes honcho_search returning empty results in Honcho “directional observation mode” by adding a fallback: when the observer→target slot yields neither representation nor card, refetch the target peer’s own self-context (mirroring the existing get_peer_card() fallback behavior). This aligns honcho_search with how Honcho-derived (auto-built) user representations are actually stored.
Changes:
- Add a fallback in
HonchoSessionManager.search_context()to query the target peer’s self-context when the directional observer→target context is empty. - Add a regression test covering the “directional empty → target self-context” fallback behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| plugins/memory/honcho/session.py | Adds a guarded fallback in search_context() to retrieve target peer self-context when directional context is empty. |
| tests/honcho_plugin/test_session.py | Adds a regression test validating the fallback behavior and call ordering. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…al slot populated Complements the fallback test by locking in the happy path: when the observer->target directional fetch returns data, no second fetch against the target peer is made. Prevents regression and redundant network calls. (Addresses independent code-review suggestion.)
|
Thanks for the focused regression fix. Current The proposed conditional fallback preserves the existing directional result when populated and avoids a duplicate self-fetch for the assistant peer. The added tests cover both the empty directional slot and the no-fallback populated case. Automated hermes-sweeper review. |
|
Superseded on main by #62290 (commit 8d1c96f): honcho_search was rewritten to do real cross-session message search via honcho.search() with a char budget — it no longer reads the directional observer→target representation slot at all, so the empty-directional-mode bug this PR patched can no longer occur. Thanks @keislij for the diagnosis and fix; the mechanism it targeted was replaced wholesale. |
Summary
honcho_searchreturns empty for every query in directional observation mode (the default), even when Honcho has rich data about the user.honcho_profile,honcho_context, andhoncho_reasoningall work — onlyhoncho_searchcomes back empty.Root cause
In directional mode,
_resolve_observer_target("user")resolves to observer=assistant, target=user, sosearch_context()queries the assistant→user directional slot viapeer.context(target=user, search_query=...).That slot is only populated when conclusions are written through the directional path (
create_conclusionin directional mode). But the user's substantive data — the auto-derived representation and peer card — lives on the user peer's own self-representation, which Honcho builds from the message stream. So the directional fetch returns empty andsearch_context()returns"".get_peer_card()already anticipates exactly this split and has a target-peer fallback (added in a118b94):search_context()was missing the equivalent fallback, which is whyhoncho_profileworks buthoncho_searchdoesn't.Fix
Mirror the
get_peer_card()fallback insearch_context(): when the directional fetch yields no representation and no card, refetch the target peer's own self-context.aipeer path, where observer == target (the condition short-circuits)._fetch_peer_contexthelper and matches the pattern already shipping inget_peer_card.Validation
Reproduced against a live Honcho cloud workspace in directional mode. Before the fix,
peer.context(target=user, search_query=q)returnsrepresentation len: 0for every query. The user's ownpeer.context(search_query=q)returns 1840–2949 chars for the same queries. After the fix,honcho_searchreturns those results.New regression test
test_search_context_falls_back_to_target_self_context_when_directional_emptycovers the directional-empty → user-self-context fallback (parallel to the existingtest_get_peer_card_falls_back_to_target_peer_own_card).Full
tests/honcho_plugin/test_session.pypasses. (3 unrelated failures intest_pin_peer_name.py::TestPinTransitionare pre-existing onmain— confirmed by stashing this change and re-running; they concern cache-busting signatures, not retrieval.)Prior art
This is a recurrence of the symptom from #5667 / PR #5658 ("align honcho_search retrieval with observation direction"), which was closed unmerged and superseded by the tool-surface overhaul in #10619. That overhaul absorbed the
target=plumbing but dropped the fallback, reintroducing empty results for users whose data is Honcho-derived rather than written viahoncho_conclude. This fix restores read/write alignment while also covering the auto-derived-representation case that #5658 would not have (it read the directional slot only).