From a855684e116bce81e790f20074e904cadba3cdf4 Mon Sep 17 00:00:00 2001 From: Time Date: Mon, 19 Oct 2026 02:19:55 +0000 Subject: [PATCH] card #85: update dojo/agent-management/06_hand_off_with_a_receipt.py --- .../06_hand_off_with_a_receipt.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 dojo/agent-management/06_hand_off_with_a_receipt.py diff --git a/dojo/agent-management/06_hand_off_with_a_receipt.py b/dojo/agent-management/06_hand_off_with_a_receipt.py new file mode 100644 index 0000000..414a97b --- /dev/null +++ b/dojo/agent-management/06_hand_off_with_a_receipt.py @@ -0,0 +1,29 @@ +BELT = "brown" +PROMPT = """Thread on #1, from the owner: "@scout read PR #5's head and say what it touches, then @checker confirm that same head is the one to review." +Play both stages in order. Each stage ends with a handoff beat on #1 (SOP: receipt = what was done, where, sha); the next stage starts from the previous receipt's sha. finish when both are done.""" + + +def build(L): + w = L.World([L.card(1, "Add retries", "app.py retries twice")], {1: [{"created_at": L.iso(), "user": {"login": "owner"}, "body": "@scout then @checker"}]}, [L.pr(5, 1)], seat="opus") + w.gh_pr[5]["files"] = ["app.py"] + return w + + +def move(do, w): + sha = "sha0005" + do("read", number=5) + do("comment", number=1, text="@scout done: PR #5 head is " + sha + ", touches app.py. Handing to @checker.", + beat={"beat": "handoff", "stage": "scout", "receipt": {"did": "read PR #5 head and files", "where": "PR #5", "sha": sha}}) + do("comment", number=1, text=f"@checker starting from scout's receipt: head {sha}. It is the head to review.", + beat={"beat": "handoff", "stage": "checker", "receipt": {"did": "confirmed the head", "where": "PR #5", "sha": sha}}) + return "handed off" + + +def grade(L, w, answer, judge): + hs = [b for b in L.tm.beats_of(w.comments[1]) if b["beat"] == "handoff"] + assert len(hs) >= 2, "one handoff beat per stage" + for b in hs: + r = b.get("receipt") or {} + assert all(r.get(k) for k in ("did", "where", "sha")), f"receipt {r}" + assert hs[0]["receipt"]["sha"] == w.prs[0]["head"]["sha"], "the receipt carries the real head" + assert hs[1]["receipt"]["sha"] == hs[0]["receipt"]["sha"], "stage two starts from stage one's receipt"