Skip to content

fix(honcho): skip Honcho writes for cron sessions#4053

Closed
erosika wants to merge 3 commits into
NousResearch:mainfrom
erosika:eri/fix-honcho-cron-misattribution
Closed

fix(honcho): skip Honcho writes for cron sessions#4053
erosika wants to merge 3 commits into
NousResearch:mainfrom
erosika:eri/fix-honcho-cron-misattribution

Conversation

@erosika

@erosika erosika commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Cron sessions auto-activate Honcho and write the cron prompt to Honcho as a user message via _honcho_sync(), causing the dialectic model to misattribute agent traits (e.g. "You are Hermes, an AI assistant...") to the user peer. This corrupts the user representation over time.

Root cause

  1. cron/scheduler.py creates AIAgent without skip_memory=True or any Honcho guard
  2. AIAgent.__init__ reads global Honcho config and activates Honcho normally
  3. At end-of-turn, _honcho_sync(original_user_message, final_response) writes the cron prompt as a user peer message
  4. Honcho's observation system attributes the system instructions to the user

The gateway's _flush_memories_for_session already has a cron_ prefix guard for local memory, but the Honcho write path had no equivalent.

Fix

Guard both Honcho write paths with platform == "cron" checks:

  • _honcho_sync(): early return, no messages written
  • _honcho_save_user_observation(): returns error JSON, no observation created

Honcho read access (context injection into system prompt) is preserved for cron sessions — only writes are blocked.

Tests

6 new tests in tests/test_honcho_cron_write_guard.py:

  • Cron sessions skip sync / reject observations
  • Non-cron sessions (telegram, cli, None) sync normally
  • Observation content and prefix verified

Closes #4052
Related: #3276

erosika added 3 commits March 30, 2026 18:06
…ck path

- test_browser_camofox: mock response now uses snapshot format (accessibility tree)
- test_trajectory_compressor: mock _get_async_client instead of setting async_client directly
Cron prompts contain system instructions ('You are Hermes...') that
get written to Honcho as user messages via _honcho_sync(), causing
the dialectic model to misattribute agent traits to the user peer.

Guard both write paths:
- _honcho_sync(): skip when platform == 'cron'
- _honcho_save_user_observation(): reject when platform == 'cron'

This preserves Honcho read access (context injection) for cron
sessions while blocking the writes that corrupt user representations.

Closes NousResearch#4052
erosika added a commit to erosika/hermes-agent that referenced this pull request Apr 2, 2026
Implements all features from the post-merge Honcho plugin spec:

B1: recall_mode support (context/tools/hybrid)
B2: peer_memory_mode gating (stub for ABC suppression mechanism)
B3: resolve_session_name() session key resolution
B4: first-turn context baking in system_prompt_block()
B5: cost-awareness (cadence, injection frequency, reasoning cap)
B6: memory file migration in initialize()
B7: pre-warming context at init

Ports from open PRs:
- NousResearch#3265: token budget enforcement in prefetch()
- NousResearch#4053: cron guard (skip activation for cron/flush sessions)
- NousResearch#2645: baseUrl-only flow verified in is_available()
- NousResearch#1969: aiPeer sync from SOUL.md
- NousResearch#1957: lazy session init in tools mode

Single file change: plugins/memory/honcho/__init__.py
No modifications to client.py, session.py, or any files outside the plugin.
teknium1 pushed a commit that referenced this pull request Apr 3, 2026
Implements all features from the post-merge Honcho plugin spec:

B1: recall_mode support (context/tools/hybrid)
B2: peer_memory_mode gating (stub for ABC suppression mechanism)
B3: resolve_session_name() session key resolution
B4: first-turn context baking in system_prompt_block()
B5: cost-awareness (cadence, injection frequency, reasoning cap)
B6: memory file migration in initialize()
B7: pre-warming context at init

Ports from open PRs:
- #3265: token budget enforcement in prefetch()
- #4053: cron guard (skip activation for cron/flush sessions)
- #2645: baseUrl-only flow verified in is_available()
- #1969: aiPeer sync from SOUL.md
- #1957: lazy session init in tools mode

Single file change: plugins/memory/honcho/__init__.py
No modifications to client.py, session.py, or any files outside the plugin.
zebster-cmd added a commit to zebster-cmd/hermes-agent that referenced this pull request Apr 7, 2026
Ported from erosika's PR NousResearch#4053. The cron guard logic was already in
the plugin architecture (_cron_skipped flag), but lacked test coverage.
Added comprehensive tests for the cron write guard.

Original run_agent.py changes are superseded by the plugin migration.
@erosika

erosika commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

Closing — cron write guard needs to be ported to the plugin architecture (plugins/memory/honcho/) introduced in #9884. Will open a fresh PR after #9884 merges.

@erosika erosika closed this Apr 15, 2026
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
Implements all features from the post-merge Honcho plugin spec:

B1: recall_mode support (context/tools/hybrid)
B2: peer_memory_mode gating (stub for ABC suppression mechanism)
B3: resolve_session_name() session key resolution
B4: first-turn context baking in system_prompt_block()
B5: cost-awareness (cadence, injection frequency, reasoning cap)
B6: memory file migration in initialize()
B7: pre-warming context at init

Ports from open PRs:
- NousResearch#3265: token budget enforcement in prefetch()
- NousResearch#4053: cron guard (skip activation for cron/flush sessions)
- NousResearch#2645: baseUrl-only flow verified in is_available()
- NousResearch#1969: aiPeer sync from SOUL.md
- NousResearch#1957: lazy session init in tools mode

Single file change: plugins/memory/honcho/__init__.py
No modifications to client.py, session.py, or any files outside the plugin.
Kye-AI-Kye added a commit to Kye-AI-Kye/hermes-agent that referenced this pull request May 12, 2026
The Port NousResearch#4053 guard skipped Honcho init for both `cron` and `flush`
contexts (and `platform == "cron"`). That hid the memory-provider
tools (honcho_profile/search/context/reasoning/conclude) from scheduled
jobs like daily-learning-review, which need them to read and update
peer profiles.

Narrow the guard to `agent_context == "flush"` only — cron jobs now
get the same Honcho surface as interactive sessions. The `_cron_skipped`
flag and its downstream short-circuits are kept for the flush case.

Tool-call short-circuit message updated to drop the now-misleading
"(cron context)" suffix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
Implements all features from the post-merge Honcho plugin spec:

B1: recall_mode support (context/tools/hybrid)
B2: peer_memory_mode gating (stub for ABC suppression mechanism)
B3: resolve_session_name() session key resolution
B4: first-turn context baking in system_prompt_block()
B5: cost-awareness (cadence, injection frequency, reasoning cap)
B6: memory file migration in initialize()
B7: pre-warming context at init

Ports from open PRs:
- NousResearch#3265: token budget enforcement in prefetch()
- NousResearch#4053: cron guard (skip activation for cron/flush sessions)
- NousResearch#2645: baseUrl-only flow verified in is_available()
- NousResearch#1969: aiPeer sync from SOUL.md
- NousResearch#1957: lazy session init in tools mode

Single file change: plugins/memory/honcho/__init__.py
No modifications to client.py, session.py, or any files outside the plugin.
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
Implements all features from the post-merge Honcho plugin spec:

B1: recall_mode support (context/tools/hybrid)
B2: peer_memory_mode gating (stub for ABC suppression mechanism)
B3: resolve_session_name() session key resolution
B4: first-turn context baking in system_prompt_block()
B5: cost-awareness (cadence, injection frequency, reasoning cap)
B6: memory file migration in initialize()
B7: pre-warming context at init

Ports from open PRs:
- NousResearch#3265: token budget enforcement in prefetch()
- NousResearch#4053: cron guard (skip activation for cron/flush sessions)
- NousResearch#2645: baseUrl-only flow verified in is_available()
- NousResearch#1969: aiPeer sync from SOUL.md
- NousResearch#1957: lazy session init in tools mode

Single file change: plugins/memory/honcho/__init__.py
No modifications to client.py, session.py, or any files outside the plugin.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
Implements all features from the post-merge Honcho plugin spec:

B1: recall_mode support (context/tools/hybrid)
B2: peer_memory_mode gating (stub for ABC suppression mechanism)
B3: resolve_session_name() session key resolution
B4: first-turn context baking in system_prompt_block()
B5: cost-awareness (cadence, injection frequency, reasoning cap)
B6: memory file migration in initialize()
B7: pre-warming context at init

Ports from open PRs:
- NousResearch#3265: token budget enforcement in prefetch()
- NousResearch#4053: cron guard (skip activation for cron/flush sessions)
- NousResearch#2645: baseUrl-only flow verified in is_available()
- NousResearch#1969: aiPeer sync from SOUL.md
- NousResearch#1957: lazy session init in tools mode

Single file change: plugins/memory/honcho/__init__.py
No modifications to client.py, session.py, or any files outside the plugin.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
Implements all features from the post-merge Honcho plugin spec:

B1: recall_mode support (context/tools/hybrid)
B2: peer_memory_mode gating (stub for ABC suppression mechanism)
B3: resolve_session_name() session key resolution
B4: first-turn context baking in system_prompt_block()
B5: cost-awareness (cadence, injection frequency, reasoning cap)
B6: memory file migration in initialize()
B7: pre-warming context at init

Ports from open PRs:
- NousResearch#3265: token budget enforcement in prefetch()
- NousResearch#4053: cron guard (skip activation for cron/flush sessions)
- NousResearch#2645: baseUrl-only flow verified in is_available()
- NousResearch#1969: aiPeer sync from SOUL.md
- NousResearch#1957: lazy session init in tools mode

Single file change: plugins/memory/honcho/__init__.py
No modifications to client.py, session.py, or any files outside the plugin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(honcho): cron sessions write system instructions to Honcho as user messages, corrupting user representation

1 participant