fix(run_agent): isolate background review fork from external memory plugins - #27190
Merged
Conversation
…lugins
Pass skip_memory=True to the AIAgent constructor used by
_spawn_background_review() so the review fork's __init__ no longer
rebuilds a _memory_manager wired to honcho / mem0 / supermemory /
etc. under the parent's session_id.
Before this change, the review fork ingested its harness prompt
(the 'Review the conversation above and update the skill library...'
text) into the user's real memory namespace via three sites in
run_conversation():
- on_turn_start(turn_count, prompt) cadence + turn-message
- prefetch_all(prompt) recall query
- sync_all(prompt, review_output, ...) harness + review output
recorded as a
(user, assistant) pair
Built-in MEMORY.md / USER.md state is still rebound from the parent
right after construction, so memory(action='add') writes from the
review continue to land on disk; only the external-plugin side
effects are removed.
Reported by @utku.
Contributor
🔎 Lint report:
|
| Rule | Count |
|---|---|
PLW1514 |
1 |
First entries
hermes_cli/send_cmd.py:61: [PLW1514] `pathlib.Path(...).read_text` without explicit `encoding` argument
✅ Fixed issues (1):
| Rule | Count |
|---|---|
PLW1514 |
1 |
First entries
../../../../../tmp/lint-base/hermes_cli/send_cmd.py:61: [PLW1514] `pathlib.Path(...).read_text` without explicit `encoding` argument
Unchanged: 0 pre-existing issues carried over.
ty (type checker)
Total: 8350 on HEAD, 8350 on base (➖ 0)
🆕 New issues (3):
| Rule | Count |
|---|---|
invalid-argument-type |
3 |
First entries
run_agent.py:14073: [invalid-argument-type] invalid-argument-type: Argument to function `_is_oauth_token` is incorrect: Expected `str`, found `str | dict[Unknown | str, Unknown | str | dict[str, str]] | Any | ... omitted 3 union elements`
run_agent.py:14076: [invalid-argument-type] invalid-argument-type: Argument to function `len` is incorrect: Expected `Sized`, found `(str & ~AlwaysFalsy) | (dict[Unknown | str, Unknown | str | dict[str, str]] & ~AlwaysFalsy) | (Any & ~AlwaysFalsy) | ... omitted 3 union elements`
run_agent.py:7770: [invalid-argument-type] invalid-argument-type: Argument to function `build_anthropic_client` is incorrect: Expected `str`, found `str | dict[Unknown | str, Unknown | str | dict[str, str]] | Any | ... omitted 3 union elements`
✅ Fixed issues (3):
| Rule | Count |
|---|---|
invalid-argument-type |
3 |
First entries
run_agent.py:7754: [invalid-argument-type] invalid-argument-type: Argument to function `build_anthropic_client` is incorrect: Expected `str`, found `str | dict[Unknown, Unknown] | Any | ... omitted 3 union elements`
run_agent.py:14057: [invalid-argument-type] invalid-argument-type: Argument to function `_is_oauth_token` is incorrect: Expected `str`, found `str | dict[Unknown, Unknown] | Any | ... omitted 3 union elements`
run_agent.py:14060: [invalid-argument-type] invalid-argument-type: Argument to function `len` is incorrect: Expected `Sized`, found `(str & ~AlwaysFalsy) | (dict[Unknown, Unknown] & ~AlwaysFalsy) | (Any & ~AlwaysFalsy) | ... omitted 3 union elements`
Unchanged: 4364 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
This comment was marked as spam.
This comment was marked as spam.
Collaborator
|
Competing fix: this PR and #24281 (reopen of #21511) both address #21510 — background review fork leaking harness prompts into external memory plugins. This PR takes a cleaner approach (skip_memory=True with detailed comments + regression test) while #24281 also adds defense-in-depth in the Honcho plugin itself. |
1 task
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…lugins (NousResearch#27190) Pass skip_memory=True to the AIAgent constructor used by _spawn_background_review() so the review fork's __init__ no longer rebuilds a _memory_manager wired to honcho / mem0 / supermemory / etc. under the parent's session_id. Before this change, the review fork ingested its harness prompt (the 'Review the conversation above and update the skill library...' text) into the user's real memory namespace via three sites in run_conversation(): - on_turn_start(turn_count, prompt) cadence + turn-message - prefetch_all(prompt) recall query - sync_all(prompt, review_output, ...) harness + review output recorded as a (user, assistant) pair Built-in MEMORY.md / USER.md state is still rebound from the parent right after construction, so memory(action='add') writes from the review continue to land on disk; only the external-plugin side effects are removed. Reported by @utku.
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…lugins (NousResearch#27190) Original commit 973f27e by Teknium targeted _spawn_background_review in pre-refactor run_agent.py. The body now lives in agent/background_review._spawn_background_review — re-applied there. Co-authored-by: Teknium <127238744+teknium1@users.noreply.github.com>
Seven74AI
pushed a commit
to Seven74AI/hermes-agent
that referenced
this pull request
Jun 13, 2026
…lugins (NousResearch#27190) Pass skip_memory=True to the AIAgent constructor used by _spawn_background_review() so the review fork's __init__ no longer rebuilds a _memory_manager wired to honcho / mem0 / supermemory / etc. under the parent's session_id. Before this change, the review fork ingested its harness prompt (the 'Review the conversation above and update the skill library...' text) into the user's real memory namespace via three sites in run_conversation(): - on_turn_start(turn_count, prompt) cadence + turn-message - prefetch_all(prompt) recall query - sync_all(prompt, review_output, ...) harness + review output recorded as a (user, assistant) pair Built-in MEMORY.md / USER.md state is still rebound from the parent right after construction, so memory(action='add') writes from the review continue to land on disk; only the external-plugin side effects are removed. Reported by @utku.
Seven74AI
pushed a commit
to Seven74AI/hermes-agent
that referenced
this pull request
Jun 13, 2026
…lugins (NousResearch#27190) Original commit 973f27e by Teknium targeted _spawn_background_review in pre-refactor run_agent.py. The body now lives in agent/background_review._spawn_background_review — re-applied there. Co-authored-by: Teknium <127238744+teknium1@users.noreply.github.com>
alt-glitch
pushed a commit
that referenced
this pull request
Jun 14, 2026
…lugins (#27190) Pass skip_memory=True to the AIAgent constructor used by _spawn_background_review() so the review fork's __init__ no longer rebuilds a _memory_manager wired to honcho / mem0 / supermemory / etc. under the parent's session_id. Before this change, the review fork ingested its harness prompt (the 'Review the conversation above and update the skill library...' text) into the user's real memory namespace via three sites in run_conversation(): - on_turn_start(turn_count, prompt) cadence + turn-message - prefetch_all(prompt) recall query - sync_all(prompt, review_output, ...) harness + review output recorded as a (user, assistant) pair Built-in MEMORY.md / USER.md state is still rebound from the parent right after construction, so memory(action='add') writes from the review continue to land on disk; only the external-plugin side effects are removed. Reported by @utku.
T02200059
pushed a commit
to T02200059/hermes-agent
that referenced
this pull request
Jun 18, 2026
…lugins (NousResearch#27190) Pass skip_memory=True to the AIAgent constructor used by _spawn_background_review() so the review fork's __init__ no longer rebuilds a _memory_manager wired to honcho / mem0 / supermemory / etc. under the parent's session_id. Before this change, the review fork ingested its harness prompt (the 'Review the conversation above and update the skill library...' text) into the user's real memory namespace via three sites in run_conversation(): - on_turn_start(turn_count, prompt) cadence + turn-message - prefetch_all(prompt) recall query - sync_all(prompt, review_output, ...) harness + review output recorded as a (user, assistant) pair Built-in MEMORY.md / USER.md state is still rebound from the parent right after construction, so memory(action='add') writes from the review continue to land on disk; only the external-plugin side effects are removed. Reported by @utku.
T02200059
pushed a commit
to T02200059/hermes-agent
that referenced
this pull request
Jun 18, 2026
…lugins (NousResearch#27190) Original commit 9002bb9 by Teknium targeted _spawn_background_review in pre-refactor run_agent.py. The body now lives in agent/background_review._spawn_background_review — re-applied there. Co-authored-by: Teknium <127238744+teknium1@users.noreply.github.com>
liuchanchen
pushed a commit
to liuchanchen/hermes-agent
that referenced
this pull request
Jun 23, 2026
…lugins (NousResearch#27190) Pass skip_memory=True to the AIAgent constructor used by _spawn_background_review() so the review fork's __init__ no longer rebuilds a _memory_manager wired to honcho / mem0 / supermemory / etc. under the parent's session_id. Before this change, the review fork ingested its harness prompt (the 'Review the conversation above and update the skill library...' text) into the user's real memory namespace via three sites in run_conversation(): - on_turn_start(turn_count, prompt) cadence + turn-message - prefetch_all(prompt) recall query - sync_all(prompt, review_output, ...) harness + review output recorded as a (user, assistant) pair Built-in MEMORY.md / USER.md state is still rebound from the parent right after construction, so memory(action='add') writes from the review continue to land on disk; only the external-plugin side effects are removed. Reported by @utku.
liuchanchen
pushed a commit
to liuchanchen/hermes-agent
that referenced
this pull request
Jun 23, 2026
…lugins (NousResearch#27190) Original commit 0422ec6 by Teknium targeted _spawn_background_review in pre-refactor run_agent.py. The body now lives in agent/background_review._spawn_background_review — re-applied there. Co-authored-by: Teknium <127238744+teknium1@users.noreply.github.com>
donbowman
pushed a commit
to donbowman/hermes-agent
that referenced
this pull request
Jul 13, 2026
…lugins (NousResearch#27190) Pass skip_memory=True to the AIAgent constructor used by _spawn_background_review() so the review fork's __init__ no longer rebuilds a _memory_manager wired to honcho / mem0 / supermemory / etc. under the parent's session_id. Before this change, the review fork ingested its harness prompt (the 'Review the conversation above and update the skill library...' text) into the user's real memory namespace via three sites in run_conversation(): - on_turn_start(turn_count, prompt) cadence + turn-message - prefetch_all(prompt) recall query - sync_all(prompt, review_output, ...) harness + review output recorded as a (user, assistant) pair Built-in MEMORY.md / USER.md state is still rebound from the parent right after construction, so memory(action='add') writes from the review continue to land on disk; only the external-plugin side effects are removed. Reported by @utku.
donbowman
pushed a commit
to donbowman/hermes-agent
that referenced
this pull request
Jul 13, 2026
…lugins (NousResearch#27190) Original commit 973f27e by Teknium targeted _spawn_background_review in pre-refactor run_agent.py. The body now lives in agent/background_review._spawn_background_review — re-applied there. Co-authored-by: Teknium <127238744+teknium1@users.noreply.github.com>
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
…lugins (NousResearch#27190) Pass skip_memory=True to the AIAgent constructor used by _spawn_background_review() so the review fork's __init__ no longer rebuilds a _memory_manager wired to honcho / mem0 / supermemory / etc. under the parent's session_id. Before this change, the review fork ingested its harness prompt (the 'Review the conversation above and update the skill library...' text) into the user's real memory namespace via three sites in run_conversation(): - on_turn_start(turn_count, prompt) cadence + turn-message - prefetch_all(prompt) recall query - sync_all(prompt, review_output, ...) harness + review output recorded as a (user, assistant) pair Built-in MEMORY.md / USER.md state is still rebound from the parent right after construction, so memory(action='add') writes from the review continue to land on disk; only the external-plugin side effects are removed. Reported by @utku.
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
…lugins (NousResearch#27190) Original commit 973f27e by Teknium targeted _spawn_background_review in pre-refactor run_agent.py. The body now lives in agent/background_review._spawn_background_review — re-applied there. Co-authored-by: Teknium <127238744+teknium1@users.noreply.github.com>
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
Background memory/skill review forks no longer leak harness prompts into external memory plugin namespaces (honcho, mem0, supermemory, etc.).
Reported by @utku — the review harness prompts (
Review the conversation above and update the skill library...) were getting ingested by memory plugins as if they were real user conversation.Root cause
_spawn_background_review()creates a freshAIAgentto do the review. That__init__rebuilds its own_memory_managerfrommemory.providerin config, scoped to the parent'ssession_id. Thenrun_conversation()triggers three ingestion sites against the user's real memory namespace:on_turn_start(turn_count, prompt)prefetch_all(prompt)sync_all(prompt, review_output, session_id)(user, assistant)pairChanges
run_agent.py_spawn_background_review()— passskip_memory=Trueto the fork'sAIAgent(...)constructortests/run_agent/test_background_review.py— regression test asserting the kwarg is setWhy this works
skip_memory=Trueshort-circuits both_memory_storeand_memory_managerconstruction in__init__. The existing fork-setup block at L4310-4314 explicitly rebinds_memory_store,_memory_enabled,_user_profile_enabled, and the nudge intervals from the parent right after construction — so:MEMORY.md/USER.mdwrites via thememorytool still land on disk ✓if self._memory_manager:✓shutdown_memory_provider()on the fork becomes a no-op (nothing to shut down) ✓Validation
_memory_manager(with honcho configured)_memory_storeafter rebinding_memory_enabledafter rebindingon_turn_start/prefetch_all/sync_allgatesE2E verified with a stubbed honcho provider in an isolated
HERMES_HOME: withskip_memory=Truethe fork constructs with_memory_manager=Noneeven thoughmemory.provider=honchois set in config; without it, the fork builds a manager wired to the stub.Test plan
scripts/run_tests.sh tests/run_agent/test_background_review.py tests/run_agent/test_background_review_cache_parity.py tests/run_agent/test_background_review_toolset_restriction.py tests/run_agent/test_review_prompt_class_first.py— 28 passed.