From df3eaad37db16b8ac10e435fe6ff2c3f84c32d1e Mon Sep 17 00:00:00 2001 From: Erin Shepherd Date: Thu, 19 Nov 2026 17:15:11 +0100 Subject: [PATCH] agents: remind a child three times before forwarding its words unreviewed A child that ended its turn owing its parent a reply got one reminder, and often answered it with a progress note and stopped, so the parent saw an unreviewed forward that looked like a finished task. Hold the turn up to three times, and say in each reminder and in the child's instructions that a submission means the task is finished, with agents.progress for progress and blocker=True or mail.request for a task it cannot finish. --- e2e/agents_test.py | 6 ++--- .../src/albedo_ext_agents/extension.gleam | 23 +++++++++++++++---- robot-docs/agent-sessions.md | 5 +++- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/e2e/agents_test.py b/e2e/agents_test.py index 39f401443..272d90ddb 100644 --- a/e2e/agents_test.py +++ b/e2e/agents_test.py @@ -43,7 +43,7 @@ def wait_for(predicate, timeout=40): raise AssertionError("agent event never arrived") -REMINDER = "You have not answered your parent yet." +REMINDER = "You have not answered your parent yet" class AgentsTests(unittest.TestCase): @@ -623,8 +623,8 @@ for target, model in [({child!r}, 'no-such-switch-model'), forwarded = wait_for(lambda: self.asked('kind="unreviewed"'))[0] self.assertIn('from="coder"', forwarded) self.assertIn("answered: map every wake path", forwarded) - # Asked once to answer before it stopped; the forward is the fallback. - self.assertEqual(len(self.asked(REMINDER)), 1) + # Asked three times to answer before it stopped; the forward is the fallback. + self.assertEqual(len(set(self.asked(REMINDER))), 3) self.app.idle(parent) self.app.idle(child["id"]) self.assertEqual( diff --git a/extensions/agents/src/albedo_ext_agents/extension.gleam b/extensions/agents/src/albedo_ext_agents/extension.gleam index 93b9ee709..90196b7bc 100644 --- a/extensions/agents/src/albedo_ext_agents/extension.gleam +++ b/extensions/agents/src/albedo_ext_agents/extension.gleam @@ -154,7 +154,7 @@ fn doctrine( <> family.name_of(db, member.parent) <> "\", depth " <> string.inspect(member.depth) - <> ". Your task arrived as . When it is done, send your result with await mail.submit(\"parent\", result) — a short summary, with paths to anything large. To ask your parent a question or request clarification, use await mail.request(\"parent\", question). If a verifier command is set and you are blocked, report it with await mail.submit(\"parent\", blocker, blocker=True). If your turn ends before you send a reply, you will get one reminder, and if the next turn also ends without a reply, your last message is forwarded to your parent marked unreviewed. For longer work, you can post await agents.progress(\"...\") occasionally; it updates the agents view without interrupting anyone. Mail from other agents is from peers rather than the user." + <> ". Your task arrived as . When it is done, send your result with await mail.submit(\"parent\", result) — a short summary, with paths to anything large. To ask your parent a question or request clarification, use await mail.request(\"parent\", question). If a verifier command is set and you are blocked, report it with await mail.submit(\"parent\", blocker, blocker=True). A submission tells your parent the task is finished: do not send progress or an incomplete result that way. If you cannot finish, report it with blocker=True. If your turn ends before you send a reply, you will get up to three reminders, and if the turn after them also ends without a reply, your last message is forwarded to your parent marked unreviewed. For longer work, you can post await agents.progress(\"...\") occasionally; it updates the agents view without interrupting anyone. Mail from other agents is from peers rather than the user." <> worktree_note(db, worktrees, member.session, workspace) } @@ -232,12 +232,10 @@ fn answered( <> "\n\nFix the failure so the verifier exits 0, then send your result with await mail.submit(\"parent\", result).\nIf you need help from your parent, ask with await mail.request(\"parent\", ), or report a blocker with await mail.submit(\"parent\", , blocker=True).", ), ) - Ok(Nil) if held == 0 -> + Ok(Nil) if held < reminders -> hook.Verdict( ..hook.proceed, - block: Some( - "You have not answered your parent yet. Send your result with await mail.submit(\"parent\", result) before you finish.", - ), + block: Some(child_reminder(held)), ) Ok(Nil) -> hook.proceed } @@ -258,6 +256,21 @@ fn answered( } } +/// How many times a session that still owes a reply is kept going before its +/// last words are forwarded as unreviewed. +const reminders = 3 + +/// What a child that stopped without answering is told. Weak models answer a +/// bare reminder with a progress note and stop, so it says what a submission +/// means and names the other ways to report. +fn child_reminder(held: Int) -> String { + "You have not answered your parent yet (reminder " + <> int.to_string(held + 1) + <> " of " + <> int.to_string(reminders) + <> "). If the task is finished, send your result with await mail.submit(\"parent\", result). If it is not finished, keep working: a submission tells your parent you are done, so do not use it for progress (use await agents.progress(\"...\")). If you cannot continue, report that with await mail.submit(\"parent\", reason, blocker=True), or ask with await mail.request(\"parent\", question)." +} + fn verify_child(db: storage.Storage, session: String) -> Result(Nil, String) { case family.verifier(db, session) { Ok(Some(#(cwd, command))) -> run_verifier(cwd, command) diff --git a/robot-docs/agent-sessions.md b/robot-docs/agent-sessions.md index 69f653612..decc1177f 100644 --- a/robot-docs/agent-sessions.md +++ b/robot-docs/agent-sessions.md @@ -91,7 +91,10 @@ idle snapshot as proof of completion. Use `child.set_verifier(command)` for an observable completion check. The [agents hook](../extensions/agents/src/albedo_ext_agents/extension.gleam) checks normal parent submissions and stops while a reply is owed. Ask questions with -`mail.request("parent", ...)`. Report a blocker with +`mail.request("parent", ...)`. A child that ends its turn without answering its +parent is kept going up to three times, and each reminder says that a submission +means the task is finished. Only after the third does its last message reach the +parent marked unreviewed. Report a blocker with `mail.submit("parent", ..., blocker=True)` when the verifier cannot pass. Clear or replace a verifier whose condition is no longer relevant. -- knotmirror 0.0.1