fix(honcho): pass user_message as search_query for topic-relevant context (salvage #17021) - #20178
Merged
Conversation
The user_message parameter was accepted by get_prefetch_context but intentionally discarded, with the rationale that passing it would expose conversation content in server access logs. This rationale is inconsistent: Honcho already persists every message in full via saveMessages. The content is already in the database. A search query in an access log adds negligible additional exposure, and is moot for self-hosted Honcho deployments where the operator owns the logs. Without search_query, Honcho returns the full peer representation - all observations, deductive/inductive layers, and peer card - in insertion order. When contextTokens is set, the most useful parts (peer card, dialectic conclusions) are truncated because raw observations fill the budget first. Passing user_message as search_query enables Honcho's semantic retrieval to return only conclusions relevant to the current session topic, reducing injection noise and improving context quality on cold starts. The _fetch_peer_context method already accepts and passes search_query to the Honcho API. This change simply connects the two.
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.
Salvages @qxxaa's PR #17021 onto current main.
What it does
get_prefetch_context()accepteduser_messagebut intentionally discarded it to avoid exposing content in access logs. The reasoning was inconsistent (Honcho persists every message viasaveMessagesanyway) and meant Honcho returned full peer representations in insertion order — so whencontextTokenswas set, raw observations filled the budget first and the most useful parts (peer card, dialectic conclusions) got truncated.Changes
plugins/memory/honcho/session.py— passuser_messageassearch_queryto_fetch_peer_contextso Honcho's semantic retrieval returns topic-relevant conclusions on cold start.scripts/release.py— AUTHOR_MAP entry for qxxaa._fetch_peer_contextalready acceptssearch_queryand passes it through to the Honcho API — this PR just connects the two.Validation
tests/ -k honcho— 290 passed locally.Closes #17021 via salvage.