Skip to content

Bug: Honcho Context block leaking into user-visible messages via vision auto-analysis #5719

@veverkananobot

Description

@veverkananobot

Bug Description

When a user sends a photo via Telegram, the gateway auto-analyzes it with _enrich_message_with_vision() (gateway/run.py). The description returned by the auxiliary vision LLM sometimes includes a trailing ## Honcho Context block — which then becomes visible to the user as part of the bot's response or is injected into the enriched message text that the agent receives.

The ## Honcho Context\n{result} string is generated in plugins/memory/honcho/__init__.py:483 as a system-prompt injection for the main agent. However, the auxiliary LLM used for vision analysis appears to be called with a system prompt that includes this Honcho memory block, causing the model to echo it back in its output.

Steps to Reproduce

  1. Have Honcho memory plugin configured and active (hybrid mode)
  2. Send a photo via Telegram
  3. The ## Honcho Context text (Honcho's dialectic memory synthesis response) appears at the bottom of the image description in the enriched message — visible to the user

Actual Behavior

The [The user sent an image~ Here's what I can see: ... ## Honcho Context\n...] block leaks Honcho memory text into user-visible messages. The user sees something like:

## Honcho Context
I'd be happy to help investigate and fix a bug, but I need more information. Could you please provide details about:
1. What bug are you referring to?...

Expected Behavior

The vision analysis description should contain ONLY the image description. The ## Honcho Context block is intended solely for system prompt injection into the main agent — it should never appear in vision analysis output or be visible to the user.

Root Cause Analysis

The auxiliary vision LLM call chain:

gateway/run.py:_enrich_message_with_vision()tools/vision_tools.py:vision_analyze_tool()

...appears to be using a system prompt that includes the Honcho memory injection. The Honcho prefetch_all() result (formatted as ## Honcho Context\n{result}) is included in the auxiliary model's context, causing it to leak into the image description output.

In run_agent.py lines 6737-6740, _ext_prefetch_cache is appended to the user message for the API call. If the vision tool is invoked in a context where this injection is present, it carries into the auxiliary LLM response.

Proposed Fix

Option 1 (correct fix): In agent/auxiliary_client.py, ensure vision analysis calls use a clean, minimal system prompt with NO memory plugin injection. Auxiliary LLM calls (vision, summarization, compression) should be completely isolated from the Honcho/memory system prompt block.

Option 2 (defensive fallback): In gateway/run.py:_enrich_message_with_vision(), strip any text at or after a ## Honcho Context marker from the vision description before using it.

Files Involved

  • gateway/run.py_enrich_message_with_vision() at line ~5048
  • tools/vision_tools.pyvision_analyze_tool() at line 264
  • agent/auxiliary_client.py — auxiliary LLM client used for vision calls
  • plugins/memory/honcho/__init__.py — line 483 generates the ## Honcho Context\n string
  • run_agent.py — lines 6737-6740 inject _ext_prefetch_cache into user message for API call

Environment

  • Platform: Telegram gateway
  • Memory plugin: Honcho (hybrid mode — auto-inject + tools)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliverycomp/pluginsPlugin system and bundled pluginsplatform/telegramTelegram bot adaptertool/visionVision analysis and image generationtype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions