Merge origin/main (reach rule, floor verdict) with attach and stated quota resets; one model's cap stays its own
ci / test (push) Waiting to run
ci / test (push) Waiting to run
Both sides kept: the reach column, floor verdict and reach line from origin;
`pick --node ID --started WORKER`, running nodes kept on re-record, stated
resets and plan-wide `out` only on quota wording from the fix branch. The
short `sisi help` is kept and names the floor verdict.
Also: a message naming one model's own cap ("your Fable limit", "limit for
this model") takes off only that model, even with a reset time; attaching a
running job prints the node header, reach and all. sisi/ is 3269 lines, the
cap as origin set it.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
ee9a856160
9 files changed
+262
-129
No files matched your search
+7
-1
@@ -3105,6 +3105,12 @@ cli.main(["tick"])
|
||||
for why, t, reset in (("You've hit your Fable limit \u00b7 resets Dec 2, 2pm (America/Denver)", said, "2026-12-02T21:00:00"),
|
||||
("limit hit, resets Jan 1 at 12:30am (UTC)", utc("2026-12-31T20:00:00"), "2027-01-01T00:30:00")):
|
||||
self.assertEqual(gone(why, t)["a"][2], utc(reset), why)
|
||||
capped = lambda why: sorted(models.outs([{"ts": stamp(said), "worker": "claude-fable-5-2", "verdict": "out", "why": why}], said,
|
||||
dict.fromkeys(("claude-fable-5-2", "claude-opus-5-5"), "claude ultra")))
|
||||
for why in ("You've hit your Fable limit \u00b7 resets Dec 2, 2pm (America/Denver)", LIMIT + ", resets in 3 days"): # one model's cap
|
||||
self.assertEqual(capped(why), ["claude-fable-5-2"], why)
|
||||
for why in ("You've hit your Claude limit, resets in 3 days", "You've hit your weekly limit \u00b7 resets Dec 2, 2pm (UTC)"):
|
||||
self.assertEqual(capped(why), ["claude-fable-5-2", "claude-opus-5-5"], why)
|
||||
for why in ("resets Dec 2, 2pm (Nowhere/Atall)", "resets Foo 2, 2pm", "resets Dec 1, 2pm (UTC)"): # unreadable or past: 6 h
|
||||
self.assertEqual(gone(why)["a"][2], said + 6 * 3600, why)
|
||||
|
||||
@@ -4821,7 +4827,7 @@ cli.main(["tick"])
|
||||
|
||||
def test_the_product_stays_small(self):
|
||||
code = sum(len(self.read(p).splitlines()) for p in glob.glob(os.path.join(REPO, "sisi", "*.py")))
|
||||
self.assertLessEqual(code, 3264, "sisi is two loops. If it needs more than this, find the simpler shape.")
|
||||
self.assertLessEqual(code, 3269, "sisi is two loops. If it needs more than this, find the simpler shape.")
|
||||
rulebook = self.read(REPO, "canon", "core.md")
|
||||
self.assertLess(len(rulebook.splitlines()), 144)
|
||||
self.assertLessEqual(len(rulebook), 11778)
|
||||
|
||||
@@ -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()
|
||||
@@ -58,10 +58,6 @@ class ModelsResearch(unittest.TestCase):
|
||||
CLAUDE_CONFIG_DIR=os.path.join(self.tmp, "claude"))
|
||||
for name in ("SISI_SESSION_ID", "CLAUDE_ENV_FILE", "XDG_DATA_HOME", "XDG_STATE_HOME", "CODEX_HOME", "CLAUDE_CODE_ENTRYPOINT"):
|
||||
self.env.pop(name, None)
|
||||
hide = mock.patch.dict(os.environ) # in-process calls read os.environ: the harness running this suite must not leak in
|
||||
hide.start()
|
||||
self.addCleanup(hide.stop)
|
||||
os.environ.pop("CLAUDE_CODE_ENTRYPOINT", None)
|
||||
subprocess.run(["git", "init", "-q", self.data], check=True, capture_output=True, stdin=subprocess.DEVNULL)
|
||||
|
||||
def in_process(self, fn, *args):
|
||||
@@ -146,7 +142,8 @@ class ModelsResearch(unittest.TestCase):
|
||||
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)
|
||||
from sisi import store # in-process picks read the list under the harness this run is in, not "unknown"
|
||||
shutil.copy(offered(self.data, HEAD + GO + HOST + opus + deep + FALL), os.path.join(self.data, "offered", store.harness() + ".txt"))
|
||||
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
|
||||
|
||||
+50
-1
@@ -12,6 +12,7 @@ TABLE = test_core.HEADER + (
|
||||
"| beta | host subagent model `beta` | ordinary | free | edits | |\n"
|
||||
"| gamma | host subagent model `gamma` | hard | per use | everything | |\n")
|
||||
COLS = "| node | class | needs | branch | files | check | why |\n|---|---|---|---|---|---|---|\n"
|
||||
REACH = "| node | class | needs | branch | files | check | reach | why |\n|---|---|---|---|---|---|---|---|\n"
|
||||
PLAN = COLS + (
|
||||
"| a | routine | - | p-a | sisi/a.py | test a passes | exact spec, test decides |\n"
|
||||
"| b | ordinary | - | p-b | sisi/b.py | test b passes | some judgement |\n"
|
||||
@@ -124,6 +125,52 @@ class Plan(unittest.TestCase):
|
||||
out = self.ready_plan(text=six)
|
||||
self.assertIn("wave 1: a (routine), b (ordinary)", out)
|
||||
|
||||
def test_a_reach_column_records_its_cell(self):
|
||||
self.ready_plan(text=REACH + (
|
||||
"| a | routine | - | p-a | sisi/a.py | test a passes | make this 100x faster | exact spec, test decides |\n"
|
||||
"| b | ordinary | - | p-b | sisi/b.py | test b passes | | some judgement |\n"
|
||||
"| join | lead | a, b | - | - | full suite passes | | the lead merges |\n"))
|
||||
self.assertEqual([n["reach"] for n in self.state()["plan"]["nodes"]], ["make this 100x faster", "", ""])
|
||||
|
||||
def test_tables_without_the_reach_column_record_with_reach_empty(self):
|
||||
six = "\n".join("|".join(l.split("|")[:-2]) + "|" if l.startswith("|") else l for l in PLAN.splitlines()) + "\n"
|
||||
for sid, text in (("s1", PLAN), ("s2", six)):
|
||||
self.ready_plan(sid=sid, text=text)
|
||||
self.assertEqual({n["reach"] for n in self.state(sid)["plan"]["nodes"]}, {""})
|
||||
|
||||
def test_plan_brief_asks_for_the_reach_column_with_its_four_examples(self):
|
||||
self.ready_plan()
|
||||
out = self.sisi("plan", "brief", sid="s1")[1]
|
||||
self.assertIn("| node | class | needs | branch | files | check | reach | why |", out)
|
||||
for ex in ('"make this 100x faster"', '"delete half the codebase without breaking anything"',
|
||||
'"turn every bug we\'ve ever fixed into a property test"',
|
||||
'"find all implicit invariants, formally prove them or find counterexamples"'):
|
||||
self.assertIn(ex, out)
|
||||
|
||||
def test_pick_node_prints_the_reach_and_the_reach_line(self):
|
||||
from sisi import plan
|
||||
self.ready_plan(text=REACH + (
|
||||
"| a | routine | - | p-a | sisi/a.py | test a passes | make this 100x faster | exact spec |\n"
|
||||
"| b | ordinary | - | p-b | sisi/b.py | test b passes | | some judgement |\n"
|
||||
"| join | lead | a, b | - | - | full suite passes | | the lead merges |\n"))
|
||||
out = self.pick("a")
|
||||
self.assertIn("reach: make this 100x faster", out)
|
||||
self.assertIn(plan.REACH_LINE, out)
|
||||
|
||||
def test_pick_without_a_node_prints_the_reach_line_but_no_reach(self):
|
||||
from sisi import plan
|
||||
self.table(TABLE)
|
||||
rc, out, _ = self.sisi("pick", "routine")
|
||||
self.assertEqual(rc, 0, out)
|
||||
self.assertIn(plan.REACH_LINE, out)
|
||||
self.assertEqual([l for l in out.splitlines() if l.startswith("reach:")], [], out)
|
||||
self.ready_plan(text=REACH + (
|
||||
"| a | routine | - | p-a | sisi/a.py | test a passes | make this 100x faster | exact spec |\n"
|
||||
"| b | ordinary | - | p-b | sisi/b.py | test b passes | | some judgement |\n"
|
||||
"| join | lead | a, b | - | - | full suite passes | | the lead merges |\n"))
|
||||
out = self.pick("a")
|
||||
self.assertEqual(out.count(plan.REACH_LINE), 1, out)
|
||||
|
||||
def test_record_line_counts_the_last_twenty_judged_per_class(self):
|
||||
self.table(TABLE + "| delta | host subagent model `delta` | deep | per use | deepest | |\n")
|
||||
line = lambda w, v: json.dumps({"ts": "2026-11-20T10:00:00", "worker": w, "verdict": v, "why": "did it fine"})
|
||||
@@ -161,6 +208,8 @@ class Plan(unittest.TestCase):
|
||||
self.pick("a") # the wheel said alpha, but the lead sent it to a running agent
|
||||
rc, out, _ = attach("a", "gate-solver")
|
||||
self.assertEqual(rc, 0, out)
|
||||
self.assertIn("sisi node: a\n", out) # the header, reach and all, as any pick of a node prints it
|
||||
self.assertIn("\nreach: -\n", out)
|
||||
self.assertEqual(self.nodes()["a"], "running")
|
||||
self.assertEqual(self.state()["picked"], []) # the pick made for this node is withdrawn
|
||||
self.assertNotIn("ready and not started", self.hook("gate")[1])
|
||||
@@ -186,7 +235,7 @@ class Plan(unittest.TestCase):
|
||||
rc, out, _ = self.sisi("plan", "brief", sid="s1")
|
||||
self.assertEqual(rc, 0, out)
|
||||
self.assertRegex(out.splitlines()[0], r"^sisi chore: plan [0-9a-f]{8}$")
|
||||
for want in ("export every row without losing any", "1. row counts match", "| node | class | needs | branch | files | check | why |",
|
||||
for want in ("export every row without losing any", "1. row counts match", "| node | class | needs | branch | files | check | reach | why |",
|
||||
"routine, ordinary, hard, deep, or lead", "Class by total cost", "routine nodes whenever their",
|
||||
"deep (the dearest tier)", "never inherited as hard or deep", "record (last 20 judged per class)",
|
||||
"prefer many small nodes", "quick test of its own change", "merges its needs, runs them once and fixes what broke"):
|
||||
|
||||
Reference in new issue
Block a user