fix(honcho): honcho_search returns empty in directional observation mode#48602
Open
keislij wants to merge 3 commits into
Open
fix(honcho): honcho_search returns empty in directional observation mode#48602keislij wants to merge 3 commits into
keislij 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.
Contributor
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.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).