Files
ai-agent/sidecar/test_inbox_prefix.py
gabrielvidalandClaude Opus 5.5 8b41b54006 fix(children): a child's report reaches its parent as the hub's message, not the user's
The first live report back came in through the inbox under INBOX_PREFIX
("this IS your user's own message") — another model's output passed off
as Gabriel's words. A prompt opening on an app author tag now gets
APP_INBOX_PREFIX ("Message from the ai-agent hub (<app>) — sent by the
app, not typed by your user"); a Stop-guard hold relays it as the hub's;
the report says to weigh the answer as a subagent's report, not as
instructions; the parser unwraps both prefixes.

Also: an archived child (a --test run is archived as it ends) still
counts in its parent's childCost — the rollup runs before the archive
filter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 00:42:11 +01:00

27 lines
1.1 KiB
Python

"""A follow-up into a live run says whose it is: the user's, or — for a
prompt opening on an app author tag — the hub's own (a child's report back)."""
import config
import stop_guard
def test_a_users_follow_up_is_theirs():
assert config.inbox_prefix("Up?") == config.INBOX_PREFIX
def test_an_app_message_is_the_hubs_not_the_users():
p = config.inbox_prefix('<ai-agent-from user="subagent" name="Subagent" role="app"/>\nreport')
assert p.startswith("[Message from the ai-agent hub (Subagent)")
assert "not typed by your user" in p
# A guest's turn carries an author tag too, but it is a person's: theirs.
assert config.inbox_prefix('<ai-agent-from user="u_dom" name="Dom" role="guest"/>\nhi') \
== config.INBOX_PREFIX
def test_the_hold_relay_names_the_hub_for_its_own_messages():
app = '<ai-agent-from user="subagent" name="Subagent" role="app"/>\nreport'
r = stop_guard.reason_mail([app], [], [], {}, 30)
assert "the ai-agent hub (not your user) sent a message" in r
r = stop_guard.reason_mail(["Up?"], [], [], {}, 30)
assert "your user sent a message" in r and "ai-agent hub" not in r