summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJesse Vincent <jesse@fsck.com>2026-10-22 20:52:29 +0000
committerJesse Vincent <jesse@fsck.com>2026-10-22 20:52:29 +0000
commit76b0f89deca5187475e66ad5f63054c22da41bec (patch)
tree34dd46cb3afa0b43f8b6da4ae657b0249b18b478 /tests
parent0f9581f6c1525b51dc1600b14d24f3db1f601446 (diff)
fix(hermes): skip the controller bootstrap for delegate_task children (#2536)fix/2536-hermes-child-bootstrap
pre_llm_call returned the using-superpowers bootstrap whenever is_first_turn was true. Hermes computes is_first_turn from an empty conversation history, and a delegate_task child always starts empty, so every child's first turn got the same 5.7k-char controller bootstrap as the parent and had to rely on <SUBAGENT-STOP> to ignore it. Live Hermes delegations on #2536 show children opening with skill_view / read_file on Superpowers skills instead of their assigned work. Hermes builds delegate_task children with platform="subagent" (tools/delegate_tool.py) and forwards that as the hook's platform argument, so gate injection on it. parent_session_id is not a safe signal: Hermes also sets it on the continuation session it creates on context compression. Verified against a real Hermes install (hermes-agent 484de065) by running its plugin discovery and agent.turn_context._collect_pre_llm_call_context for a parent and a subagent first turn: 5757/5757 chars before, 5757/0 after. Co-authored-by: Twot <twotnguyen@users.noreply.github.com> Claude-Session: https://claude.ai/code/session_01SHANcr4A71nzuU9et4Fnba
Diffstat (limited to 'tests')
-rw-r--r--tests/hermes/test_plugin.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/hermes/test_plugin.py b/tests/hermes/test_plugin.py
index 57d619e..7c896a3 100644
--- a/tests/hermes/test_plugin.py
+++ b/tests/hermes/test_plugin.py
@@ -87,6 +87,24 @@ class TestBootstrapInjection:
assert _fire_pre_llm(mock_ctx, is_first_turn=False) is None
assert _fire_pre_llm(mock_ctx, is_first_turn=None) is None
+ def test_subagent_platform_skips_bootstrap_on_first_turn(self, mock_ctx):
+ plugin = _load_plugin()
+ plugin.register(mock_ctx)
+ assert (
+ _fire_pre_llm(mock_ctx, is_first_turn=True, platform="subagent")
+ is None
+ )
+
+ def test_non_subagent_platforms_receive_bootstrap(self, mock_ctx):
+ plugin = _load_plugin()
+ plugin.register(mock_ctx)
+ for platform in ("cli", "desktop", "cron", "telegram"):
+ result = _fire_pre_llm(
+ mock_ctx, is_first_turn=True, platform=platform
+ )
+ assert isinstance(result, dict)
+ assert BOOTSTRAP_MARKER in result["context"]
+
def test_hook_tolerates_future_kwargs(self, mock_ctx):
plugin = _load_plugin()
plugin.register(mock_ctx)