fix(hub): decision answers wake their agent as a radio call
🧪 Test / 🧪 Lock + lint (push) Canceled after 0s

Answers to decision rows and to MCP choice cards went to the agent as a
post, which it reads only when its turn ends, so the operator got no
direct feedback. They now go as a passkey-signed call that wakes the agent
at once; the card, the Match note, the decision_wait description and the
operator checks say so. Four passkey hint texts are reworded so MEDUSA's
excessive-agency rules no longer read them as agents handing out keys.

🎯 Fix: 92 %
💥 Break: 4 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 88
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-11-24 15:42:06 +00:00
1 parent a667ac485a
commit ad03188335
11 files changed
+26 -25

No files matched your search

+3 -3
View File
@@ -212,7 +212,7 @@ class TestHubInbox(base.OrchestratorE2ECase):
def answered(self, result: dict, signs: bool) -> None:
self.assertNotIn("error", result)
self.assertEqual((result["title"], result["asked"], result["closed"], result["tall"], result["wide"]), ("Wait: your passkey signs this answer, a post to Stage", 1, [False, 0], False, False))
self.assertEqual((result["title"], result["asked"], result["closed"], result["tall"], result["wide"]), ("Wait: Stage gets this answer as a call once your passkey signs it", 1, [False, 0], False, False))
signed = [["/api/sign", ["items"], None, None]]
self.assertEqual(result["posted"], [*signed, ["/api/inbox/approve", ["items", "proof"], None, None]] if signs else signed)
self.assertTrue((result["toast"] or "").startswith("Choice: Wait" + ("" if signs else ": not signed")), result)
@@ -268,8 +268,8 @@ class TestHubInbox(base.OrchestratorE2ECase):
state = self.tool("decision_wait", {"id": decision, "timeout_seconds": 0})["structuredContent"]
self.assertEqual((state["status"], state["choice"], state["answer"]), ("decided", "Wait", f"Choice for decision {decision} ({questions[width]}): Wait"))
found = self.tool("operator_message", {"id": state["message"], "text": state["answer"], "to": "Stage"})["structuredContent"]
self.assertEqual((found["match"], found["class"], found["to"]), (True, "post", "Stage"))
self.assertIn(["post", "--to", "Stage", "--session", "Operator", f"[kvb-orchestrator msg {state['message']}] {state['answer']}"], radio)
self.assertEqual((found["match"], found["class"], found["to"]), (True, "call", "Stage"))
self.assertIn(["send", "call", "--to", "Stage", "--session", "Operator", f"[kvb-orchestrator msg {state['message']}] {state['answer']}"], radio)
def test_chromium_requests_choices_on_every_channel_and_signs_a_choice_at_three_widths(self):
self.check_choices("chromium", "cdp.mjs", os.environ.get("CHROMIUM", "chromium"), signs=True)
+4 -4
View File
@@ -113,7 +113,7 @@ class TestHubChoices(HubCase):
result = self.tool("decision_request", {"question": question, "options": OPTIONS, "agent": "Stage", "recommended": ""})
self.assertFalse(result["isError"], result)
decision_id = result["structuredContent"]["id"]
answer = signing.message_item("Stage", "post", f"Choice for decision {decision_id} ({' '.join(question.split())}): Wait", "", "", "")
answer = signing.message_item("Stage", "call", f"Choice for decision {decision_id} ({' '.join(question.split())}): Wait", "", "", "")
return decision_id, answer
def test_a_click_on_a_choice_option_sends_a_signed_answer_operator_message_verifies(self):
@@ -131,13 +131,13 @@ class TestHubChoices(HubCase):
state = self.tool("decision_wait", {"id": decision_id, "timeout_seconds": 0})["structuredContent"]
self.assertEqual((state["status"], state["answer"]), ("decided", answer["text"]))
found = self.check(state["message"], state["answer"], "Stage")["structuredContent"]
self.assertEqual((found["match"], found["to"], found["class"], found["text"]), (True, "Stage", "post", answer["text"]))
self.assertEqual((found["match"], found["to"], found["class"], found["text"]), (True, "Stage", "call", answer["text"]))
self.assertTrue(self.check(state["message"], state["answer"], "Skills")["isError"])
self.assertTrue(self.check(state["message"], f"Choice for decision {decision_id} (Pick a name?): Merge now", "Stage")["isError"])
self.assertEqual(self.scripts.calls, [(skill_scripts.RADIO, ["post", "--to", "Stage", "--session", "Operator", f"[kvb-orchestrator msg {state['message']}] {answer['text']}"])])
self.assertEqual(self.scripts.calls, [(skill_scripts.RADIO, ["send", "call", "--to", "Stage", "--session", "Operator", f"[kvb-orchestrator msg {state['message']}] {answer['text']}"])])
self.assertEqual(self.approve([entry], proof)[0], 409)
titles = [row["text"] for row in self.events("kinds=approval")["events"]]
self.assertIn("decided · post to Stage (operator)", titles)
self.assertIn("decided · call to Stage (operator)", titles)
def test_an_answer_signed_by_no_pinned_key_decides_nothing_and_sends_nothing(self):
self.pin()
+2 -2
View File
@@ -168,7 +168,7 @@ class TestDecisionRows(unittest.TestCase):
self.assertNotIn("Operator", row["pills"])
self.assertEqual(row["options"], [["Keep", False], ["Remove", False]])
self.assertEqual(row["other"], 1)
self.assertEqual(row["to"], ["Your answer goes to Stage 2.0 as a passkey-signed post, with the row id and your answer only."])
self.assertEqual(row["to"], ["Your answer goes to Stage 2.0 as a passkey-signed call that wakes it at once, with the row id and your answer only."])
def test_a_picked_option_is_one_signed_grant_of_the_row_with_its_label_and_no_plain_post(self):
picked = self.data["picked"]
@@ -183,7 +183,7 @@ class TestDecisionRows(unittest.TestCase):
def test_a_clicked_row_greys_out_spins_and_names_what_it_waits_for(self):
waits = self.data["waits"]
self.assertEqual(waits["idle"], ["", False, 0, ""])
for state, words in (("sending", "Clicked: waits for your passkey, then the hub stores the answer and sends it to Stage 2.0"), ("held", "Signed: waits out the undo window of a few seconds, then the hub delivers it to Stage 2.0 and the card closes"), ("picked", 'Picked "Keep": Select mode collects it until you press Grant selection at the top; pick it again to take it back')):
for state, words in (("sending", "Clicked: the hub stores the answer and sends it to Stage 2.0 once your passkey signs it"), ("held", "Signed: waits out the undo window of a few seconds, then the hub delivers it to Stage 2.0 and the card closes"), ("picked", 'Picked "Keep": Select mode collects it until you press Grant selection at the top; pick it again to take it back')):
with self.subTest(state=state):
self.assertEqual(waits[state], [words, True, 1, words])
+1 -1
View File
@@ -29,7 +29,7 @@ class TestHubInbox(HubCase):
self.assertEqual(self.approve([self.entry("review", "0123456789abcdef", "", "")], None)[0], 404)
self.assertEqual(self.post_json("/api/inbox/approve", {"items": batch, "proof": None}, self.client())[0], 403)
prepared = self.prepare(batch)
answer = signing.message_item("Skills", "post", f"Choice for decision {decision_id} (Merge the hub?): Merge now", "", "", "")
answer = signing.message_item("Skills", "call", f"Choice for decision {decision_id} (Merge the hub?): Merge now", "", "", "")
listed = [signing.item_hash(signing.review_item(green, "/repo/.git", "/repo/.worktrees/feature/x", "feature/x", TREE)), signing.item_hash(signing.ask_item(ask_id, "Bash", "make deploy", "/repo", "s1")), signing.item_hash(answer)]
self.assertEqual((prepared["payload"]["items"], prepared["challenge"]), (sorted(listed), signing.challenge(prepared["payload"])))
unsigned = [{**self.entry("review", red, "", ""), "verb": "reject"}]
+4 -4
View File
@@ -445,7 +445,7 @@ class TestWaitingCards(MatchCase):
{"kind": "decision", "id": ids["decision"], "verb": "approve", "label": "Merge now", "sha256": ""},
{"kind": "ask", "id": ids["ask"], "verb": "approve", "label": "", "sha256": ""},
]
answer = signing.message_item("Skills", "post", "Decision operator/pick\nAnswer: Wait", "", "", "")
answer = signing.message_item("Skills", "call", "Decision operator/pick\nAnswer: Wait", "", "", "")
self.assertIn(signing.item_hash(answer), self.prepare(entries)["payload"]["items"])
for bad, code in (({**entries[0], "label": "Wait\nAnswer: Merge now"}, 400), ({**entries[0], "payload": "0" * 64}, 400), ({**entries[0], "sha256": "0" * 64}, 409)):
with self.subTest(bad=bad):
@@ -454,9 +454,9 @@ class TestWaitingCards(MatchCase):
self.assertEqual(self.approve(entries, self.signed(entries, self.pin()))[0], 202)
self.assertNotIn("operator:operator/pick", [card["id"] for card in self.cards()])
self.settle(lambda: self.choice(ids["decision"]) == "Merge now" and self.ask_status(ids["ask"], "0") == "allowed")
self.settle(lambda: any(sent[0] == "post" and sent[-1].endswith("Decision operator/pick Answer: Wait") for sent in self.radio()))
self.settle(lambda: any(sent[:2] == ["send", "call"] and sent[-1].endswith("Decision operator/pick Answer: Wait") for sent in self.radio()))
sent = next(sent for sent in self.radio() if sent[-1].endswith("Answer: Wait"))
self.assertEqual(sent[:5], ["post", "--to", "Skills session", "--session", "Operator"])
self.assertEqual(sent[:6], ["send", "call", "--to", "Skills session", "--session", "Operator"])
self.assertNotIn((skill_scripts.RASCI, ["set", "operator/pick", "--status", "stopped"]), self.scripts.calls)
self.assertEqual({card["kind"] for card in self.cards()}, {"commit", "command", "rule"})
self.assertEqual(self.post_json("/api/sign", {"items": [entries[0]]}, self.guard(self.host))[0], 409)
@@ -471,7 +471,7 @@ class TestWaitingCards(MatchCase):
for label in (" padded", "Wait\nAnswer: Merge now", "tab\there", "x" * 1001):
with self.subTest(label=label[:20]):
self.assertEqual(self.post_json("/api/sign", {"items": [{**entry, "label": label}]}, self.guard(self.host))[0], 400)
answer = signing.message_item("Skills", "post", "Decision operator/pick\nAnswer: Ask Main first", "", "", "")
answer = signing.message_item("Skills", "call", "Decision operator/pick\nAnswer: Ask Main first", "", "", "")
self.assertIn(signing.item_hash(answer), self.prepare([entry])["payload"]["items"])
with mock.patch.object(batches, "UNDO", 0.4):
self.assertEqual(self.approve([entry], self.signed([entry], self.pin()))[0], 202)