Keep done and plan on mid-work retros; add deep model class and efficiency rule

- Mid-work retros (when checks have no verdict or a plan node is running) keep
  done, plan, node states, open jobs, and changed state; only a retro on
  finished work closes them (fixes faults 29 and 34).
- Gate no longer auto-closes work while a plan node runs or demands a closing
  retro while a non-late delegation is open.
- Add fourth model class 'deep' across models, pick (falls back to hard when no
  deep row exists), plan, judge outcomes, record_line, CLI/hooks, canon/core.md,
  and research/plan chore briefs, with the efficiency tie-breaking rule.

Co-Authored-By: Gemini <noreply@google.com>
This commit is contained in:
swaitsandGemini committed 2026-12-03 13:53:02 -07:00
1 parent 361a850da5
commit 81cc722400
10 files changed
+221 -46

No files matched your search

+38
View File
@@ -126,6 +126,44 @@ class ModelsResearch(unittest.TestCase):
other = twin.replace("| routine |", "| ordinary |") # the same provider in another class is fine
self.assertEqual(self.record(HEAD + GO + other + FALL)[0], 0)
def test_brief_and_rulebook_say_a_tie_never_goes_to_the_dearer_model(self):
text = lambda s: " ".join(s.split())
rulebook = text(models.store.read(os.path.join(models.store.ROOT, "canon", "core.md")))
brief = text(self.in_process(models.research_brief)[0])
for where in (brief, rulebook):
for want in ("cheapest among models within one point of the class's best score", "tie never goes to the dearer model",
"dearest tier is its own class, deep", "never banned and never a default for hard, ordinary or routine"):
self.assertIn(want, where)
self.assertIn("never inherited as hard or deep", rulebook)
self.assertIn("routine, ordinary, hard, deep", brief)
def test_deep_class_records_picks_falls_back_to_hard_and_tracks_outcomes(self):
from sisi import plan
deep = "| fable | Anthropic | anthropic | host subagent `fable` | deep | flat | 5h: none; week: 50% sub-cap (https://example.test/c) | deepest | |\n"
opus = "| opus | Anthropic | anthropic | host subagent `opus` | hard | flat | 5h: none; week: 10x Pro (https://example.test/c) | strong | |\n"
self.assertEqual(self.record(HEAD + GO + HOST + opus + deep + FALL)[0], 0) # same provider may hold hard and deep
offered(self.data, HEAD + GO + HOST + opus + deep + FALL)
twin = deep.replace("fable", "fable2")
self.assertEqual(self.record(HEAD + GO + opus + deep + twin + FALL)[0], 1) # two deep rows for one provider refused
self.assertEqual(self.record(HEAD + GO + deep.replace("| deep |", "| hard, deep |") + FALL)[0], 1) # multi-class refused
rc, out = self.in_process(models.pick, ["deep"], self.tmp, lambda: 0.0)
self.assertEqual((rc, "worker: fable" in out, "fallback:" in out), (0, True, False), out)
rc, out = self.in_process(models.pick, ["deep", "--not", "fable"], self.tmp, lambda: 0.0)
self.assertEqual((rc, "Choose again from hard." in out), (1, True), out)
rc, out = self.in_process(models.judge, ["fable", "good", "solved the hard root cause"], self.tmp)
self.assertEqual(rc, 0, out)
import json
rec = json.loads(self.read(self.data, "outcomes.jsonl").splitlines()[-1])
self.assertEqual(rec.get("class"), "deep")
self.assertIn("deep 1/1 good", self.in_process(plan.record_line)[0])
# with no deep row in the table, `sisi pick deep` falls back to hard
self.assertEqual(self.record(HEAD + GO + HOST + opus + FALL)[0], 0)
offered(self.data, HEAD + GO + HOST + opus + FALL)
rc, out = self.in_process(models.pick, ["deep"], self.tmp, lambda: 0.0)
self.assertEqual((rc, out.splitlines()[0].startswith("worker: opus"), "no deep worker" in out), (0, True, True), out)
# judge record's saved class still counts in record_line even after fable left the table
self.assertIn("deep 1/1 good", self.in_process(plan.record_line)[0])
def test_brief_asks_for_provider_efficiency_and_one_row_per_provider_class(self):
rc, brief = self.in_process(models.run, ["research"])
self.assertEqual(rc, 0)