Skip to content

The agent that grows with you

test: verify local automation stays nonhuman and cache stable

Tekniumef071dd371e4
diff --git a/gateway/AGENTS.md b/gateway/AGENTS.md
index 49849749961..855ed306c19 100644
--- a/gateway/AGENTS.md
+++ b/gateway/AGENTS.md
@@ -75,6 +75,12 @@ acceptance. Refused admission refunds every claimed batch sibling without spendi
actual delivery errors keep their bounded retry policy. Recognized raw API routes resolve after
persisted messaging origins and defer quietly when unavailable; malformed routes still warn.
+Canonical local CLI/TUI/Desktop sessions admit completion and watch events into the same durable
+FIFO as human input, retaining the private local launch policy and `internal_notification` display
+kind. Observers neither own nor consume those turns. Accepted local automation survives owner
+restart; an interrupted started turn remains unknown and pauses its followers. Watch hits carry
+separate event IDs even for identical text, but their pre-admission process queue is not durable.
+
Cron deliveries are NOT mirrored into the target gateway session — they land in their own cron
session with a header/footer frame so the main conversation's role alternation stays intact
(`cron/AGENTS.md`).
diff --git a/tests/gateway/fixtures/local_automation_peer.py b/tests/gateway/fixtures/local_automation_peer.py
index d50b7340ef4..16c3b0227e1 100644
--- a/tests/gateway/fixtures/local_automation_peer.py
+++ b/tests/gateway/fixtures/local_automation_peer.py
@@ -82,6 +82,14 @@ def probe(base, source):
texts = [next((m.get('content', '') for m in reversed(r['messages']) if m['role'] == 'user'), '')
for r in model.requests if r.get('messages')]
assert 'REAL_TERMINAL_COMPLETION' in str(texts[-1]), texts
+ assert sum('REAL_TERMINAL_COMPLETION' in str(text) for text in texts) == 1, texts
+ with sqlite3.connect(home / 'state.db') as db:
+ notices = db.execute("SELECT display_kind FROM messages WHERE role='user' AND content LIKE ?",
+ ('%REAL_TERMINAL_COMPLETION%',)).fetchall()
+ assert notices == [('internal_notification',)], notices
+ prefixes = [json.dumps([m for m in r['messages'] if m['role'] in ('system', 'developer')], sort_keys=True)
+ for r in model.requests if r.get('messages')]
+ assert len(set(prefixes)) == 1, 'automation changed the cached system prefix'
assert 'HUMAN_FIFO_FOLLOWER' in str(texts[-2]), texts
async with websocket(home, desc) as ws:
resumed = await rpc(ws, 'session.resume', session_id=sid)