Verdict floor: passed the check, no measured reach; closes the node like good, counts on the wheel like bad

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Haiku 5.5 committed 2026-12-03 20:41:41 -07:00
1 parent 361a850da5
commit 3fbf7376cb
3 files changed
+79 -6

No files matched your search

+2 -1
View File
@@ -41,10 +41,11 @@ Delegation
sisi pick routine|ordinary|hard [--review-of WORKER] [--not WORKER ...] [--limit MINUTES] [--branch NAME] sisi pick routine|ordinary|hard [--review-of WORKER] [--not WORKER ...] [--limit MINUTES] [--branch NAME]
the wheel gives you one worker for a ready plan node (or of a class, for a the wheel gives you one worker for a ready plan node (or of a class, for a
`sisi chore:` brief); one pick, one delegation `sisi chore:` brief); one pick, one delegation
sisi judge WORKER good|bad|out WHY | extend MINUTES WHY [--newest] [--node ID | --chore ID] sisi judge WORKER good|bad|floor|out WHY | extend MINUTES WHY [--newest] [--node ID | --chore ID]
how a delegation went (`out` with the provider's own message when it hit a how a delegation went (`out` with the provider's own message when it hit a
limit: sisi tries it again by itself), or give a running job more time; limit: sisi tries it again by itself), or give a running job more time;
--node ID or --chore ID names the job itself when a worker runs several --node ID or --chore ID names the job itself when a worker runs several
floor: passed the check, no measured reach; it merges but counts as bad on the wheel
sisi direct REASON allow yourself more direct tool calls this turn, with the reason sisi direct REASON allow yourself more direct tool calls this turn, with the reason
Setting up Setting up
+5 -5
View File
@@ -305,7 +305,7 @@ def track():
for o in store.records("outcomes.jsonl"): for o in store.records("outcomes.jsonl"):
w = short(o["model"] if isinstance(o.get("model"), str) and o["model"].strip() else o["worker"] if isinstance(o.get("worker"), str) else "") w = short(o["model"] if isinstance(o.get("model"), str) and o["model"].strip() else o["worker"] if isinstance(o.get("worker"), str) else "")
if w and o.get("verdict") == "good" and type(o.get("minutes")) is int and 0 < o["minutes"] <= 10000: sp.setdefault(w, []).append(o["minutes"]) if w and o.get("verdict") == "good" and type(o.get("minutes")) is int and 0 < o["minutes"] <= 10000: sp.setdefault(w, []).append(o["minutes"])
if w and o.get("verdict") in ("good", "bad"): ql.setdefault(w, []).append(o["verdict"] == "good"); n[w] = n.get(w, 0) + 1 if w and o.get("verdict") in ("good", "bad", "floor"): ql.setdefault(w, []).append(o["verdict"] == "good"); n[w] = n.get(w, 0) + 1
return {w: v[-10:] for w, v in sp.items()}, {w: (sum(v[-10:]) + 1) / (len(v[-10:]) + 1) for w, v in ql.items()}, n return {w: v[-10:] for w, v in sp.items()}, {w: (sum(v[-10:]) + 1) / (len(v[-10:]) + 1) for w, v in ql.items()}, n
@@ -516,9 +516,9 @@ def judge(args, cwd=None):
i = args.index("--chore") i = args.index("--chore")
chore, args = (args[i + 1:i + 2] or [""])[0].lower(), args[:i] + args[i + 2:] chore, args = (args[i + 1:i + 2] or [""])[0].lower(), args[:i] + args[i + 2:]
ext = len(args) == 4 and args[1] == "extend" and minutes is None and re.fullmatch(r"[1-9]\d{0,3}|10000", args[2]) ext = len(args) == 4 and args[1] == "extend" and minutes is None and re.fullmatch(r"[1-9]\d{0,3}|10000", args[2])
if not args or not args[0].strip() or not (ext or (len(args) == 3 and args[1] in ("good", "bad", "out") and minutes != 0)) or len(args[-1].split()) < 3 \ if not args or not args[0].strip() or not (ext or (len(args) == 3 and args[1] in ("good", "bad", "floor", "out") and minutes != 0)) or len(args[-1].split()) < 3 \
or (node is not None and not re.fullmatch(r"[a-z0-9-]{1,30}", node)) or chore == "" or (node is not None and chore is not None): or (node is not None and not re.fullmatch(r"[a-z0-9-]{1,30}", node)) or chore == "" or (node is not None and chore is not None):
print('usage: sisi judge WORKER good|bad|out "<what it did well or badly, or the provider\'s message when it hit a limit, in a sentence>" [--minutes N] [--newest] [--node ID | --chore ID] | extend MINUTES "<reason, 3+ words>" [--newest] [--node ID | --chore ID]') print('usage: sisi judge WORKER good|bad|floor|out "<what it did well or badly, or the provider\'s message when it hit a limit, in a sentence>" [--minutes N] [--newest] [--node ID | --chore ID] | extend MINUTES "<reason, 3+ words>" [--newest] [--node ID | --chore ID]')
return 1 return 1
wrows = rows(wheel()[0]) # a worker's wheel row wins over its table row (the list is the truth), and is counted once wrows = rows(wheel()[0]) # a worker's wheel row wins over its table row (the list is the truth), and is counted once
trows = wrows + [r for r in rows(store.read(table())) if short(r[0]) not in {short(x[0]) for x in wrows}] trows = wrows + [r for r in rows(store.read(table())) if short(r[0]) not in {short(x[0]) for x in wrows}]
@@ -571,8 +571,8 @@ def judge(args, cwd=None):
left = ", ".join("%s (started %s, %s)" % (k, h, f) if f else "started %s" % h for k, f, h in others) left = ", ".join("%s (started %s, %s)" % (k, h, f) if f else "started %s" % h for k, f, h in others)
warn = "closed %s; still open: %s" % (closed, left) warn = "closed %s; still open: %s" % (closed, left)
isinstance(s.get("meta"), dict) and s["meta"].pop("%s %r" % (wkey, cand), None) isinstance(s.get("meta"), dict) and s["meta"].pop("%s %r" % (wkey, cand), None)
if node is not None: s["plan"]["state"][node] = {"st": "done", "evidence": "judged good"} if args[1] == "good" else {"st": "failed", "why": "judged " + args[1]} # as plan.judged moves the node its job started if node is not None: s["plan"]["state"][node] = {"st": "done", "evidence": "judged " + args[1]} if args[1] in ("good", "floor") else {"st": "failed", "why": "judged " + args[1]} # as plan.judged moves the node its job started
elif s.get("plan"): from . import plan; plan.judged(s, wkey, cand, args[1]) elif s.get("plan"): from . import plan; plan.judged(s, wkey, cand, "good" if args[1] == "floor" else args[1])
if ok_t: if ok_t:
began = cand began = cand
minutes = minutes or max(1, int((now - began) / 60)) minutes = minutes or max(1, int((now - began) / 60))
+72
View File
@@ -0,0 +1,72 @@
"""The floor verdict: a job that passed its check with no measured reach closes its node like good, and counts
on the wheel like bad (its minutes are no speed). Black-box CLI tests and in-process tests in a temporary home and store."""
import json, os, re, sys, unittest
try: # the modules, not their classes: their tests must not run twice
from tests import test_core, test_plan
except ImportError:
import test_core, test_plan
sys.path.insert(0, test_core.REPO)
class Floor(unittest.TestCase):
ENFORCE = True
setUp, project, sisi, hook, tool, done, table, state, read, write, in_process = (
test_core.Core.setUp, test_core.Core.project, test_core.Core.sisi, test_core.Core.hook, test_core.Core.tool, test_core.Core.done,
test_core.Core.table, test_core.Core.state, test_core.Core.read, test_core.Core.write, test_core.Core.in_process)
ready_plan, record, pick, agent, nodes = test_plan.Plan.ready_plan, test_plan.Plan.record, test_plan.Plan.pick, test_plan.Plan.agent, test_plan.Plan.nodes
def outcomes(self):
path = os.path.join(self.data, "outcomes.jsonl")
return [json.loads(l) for l in self.read(path).splitlines() if l.strip()] if os.path.exists(path) else []
def test_floor_closes_the_node_like_good_and_it_is_not_ready_again(self):
self.ready_plan()
self.pick("a")
self.assertEqual(self.agent("alpha", "sisi node: a\nbuild node a")[0], 0)
self.assertEqual(self.nodes()["a"], "running")
rc, out, _ = self.sisi("judge", "alpha", "floor", "passed the check and showed no reach attempt", "--node", "a")
self.assertEqual(rc, 0, out)
self.assertEqual(self.nodes()["a"], "done")
self.assertEqual(self.outcomes()[-1]["verdict"], "floor")
rc, out, _ = self.sisi("pick", "--node", "a")
self.assertEqual(rc, 1, out)
self.assertIn("already done", out)
def test_floor_closes_a_chore_job_and_is_refused_for_an_unknown_chore(self):
self.table(test_plan.TABLE)
self.hook("prompt", prompt="build it")
self.done()
rc, brief, err = self.sisi("plan", "brief")
self.assertEqual(rc, 0, brief + err)
cid = re.match(r"sisi chore: .+? ([0-9a-f]{8})\b", brief.splitlines()[0]).group(1)
rc, out, err = self.sisi("pick", "routine", "--not", "beta")
self.assertEqual(rc, 0, out + err)
prompt = "%s\nRun `sisi chore show %s` and do what it says." % (brief.splitlines()[0], cid)
self.assertEqual(self.tool("Agent", tool_input={"model": "alpha", "prompt": prompt}), (0, "", ""))
before = self.outcomes()
rc, out, _ = self.sisi("judge", "alpha", "floor", "passed the check and showed no reach attempt", "--chore", "deadbeef")
self.assertEqual(rc, 1, out)
self.assertEqual(self.outcomes(), before)
rc, out, _ = self.sisi("judge", "alpha", "floor", "passed the check and showed no reach attempt", "--chore", cid)
self.assertEqual(rc, 0, out)
self.assertEqual(self.state()["starts"].get("alpha"), [])
self.assertEqual(self.outcomes()[-1]["verdict"], "floor")
def test_floor_counts_on_the_wheel_like_bad_and_its_minutes_are_no_speed(self):
from sisi import models
path = os.path.join(self.data, "outcomes.jsonl")
def track(verdicts):
os.makedirs(self.data, exist_ok=True)
self.write(path, "".join(json.dumps({"worker": "alpha", "model": "alpha", "verdict": v, "minutes": m}) + "\n"
for v, m in verdicts))
return self.in_process(models.track)[0]
floor, bad = track([("good", 5), ("floor", 7)]), track([("good", 5), ("bad", 7)])
self.assertEqual(floor[1], bad[1], "a floor verdict must give the quality factor of a bad one")
self.assertEqual(floor[2], bad[2])
self.assertEqual(floor[0], {"alpha": [5]}, "a floor job's minutes must not enter speeds")
if __name__ == "__main__":
unittest.main()