Attach a running job to a plan node; honour a provider's stated reset for its whole plan
Fault 36: `sisi pick --node ID --started WORKER` records that a job already running (a worker sent a message, which no delegation hook sees) does the node; re-recording a plan keeps a running node whose id and branch are unchanged. Fault 37: `judge WORKER out` keeps the worker off the wheel until the reset its message states (ISO time or "resets in ..." span; else 6 h), together with every worker on the same provider in the models table. Also: tests/test_models_research.py no longer reads the running agent's CLAUDE_CODE_ENTRYPOINT. The line-count cap (test_the_product_stays_small) is left for the join: sisi/ is 3330 lines against 3264. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fffb97f522
commit
9fb2a61920
7 files changed
+174
-36
No files matched your search
+40
-1
@@ -3,7 +3,7 @@
|
||||
Learning: work is done, the retro is forced, its improvement is a rule in the next session, the rules are
|
||||
organized and the change can be undone. Delegation: the lead is stopped when it should be delegating, and the
|
||||
models table is researched, read and kept fresh."""
|
||||
import glob, hashlib, json, os, random, re, shlex, shutil, subprocess, sys, tempfile, time, unittest
|
||||
import calendar, glob, hashlib, json, os, random, re, shlex, shutil, subprocess, sys, tempfile, time, unittest
|
||||
from unittest import mock
|
||||
|
||||
REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
@@ -3038,6 +3038,45 @@ cli.main(["tick"])
|
||||
first = time.mktime(time.strptime("2026-" + out.split("The first is back on the wheel at ")[1][:11], "%Y-%m-%d %H:%M"))
|
||||
self.assertLess(abs(first - (time.time() + 5 * 3600)), 120)
|
||||
|
||||
def test_a_stated_reset_time_keeps_the_whole_plan_off_the_wheel_until_then(self):
|
||||
"""Fault 37, with the providers' own messages."""
|
||||
row = "| %s | %s | host subagent model `%s` | %s | flat | work | |\n"
|
||||
self.table("| worker | provider | how to call it | use for | cost | good at, bad at | notes |\n|---|---|---|---|---|---|---|\n" + "".join(
|
||||
row % (w, p, w, c) for w, p, c in (("muse-wonder", "Muse Code", "ordinary"), ("muse-ember", "Muse Code", "routine"),
|
||||
("gemini-4-neon", "Antigravity", "ordinary"), ("gemini-4-hydrogen", "Antigravity", "routine"),
|
||||
("alpha", "Other", "routine"))))
|
||||
sys.path.insert(0, REPO)
|
||||
from sisi import models
|
||||
stamp = lambda t: time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(t))
|
||||
utc = lambda s: calendar.timegm(time.strptime(s, "%Y-%m-%dT%H:%M:%S"))
|
||||
said, reset = utc("2026-12-02T21:33:21"), utc("2026-12-07T00:00:00")
|
||||
muse = "API error 429: Subscription quota exhausted. Your usage window resets at 2026-12-07T00:00:00Z."
|
||||
pool = {"muse-wonder": "muse code", "muse-ember": "muse code", "alpha": "other"}
|
||||
verdict = lambda why, t, w="muse-wonder", kind="out": {"ts": stamp(t), "worker": w, "verdict": kind, "why": why}
|
||||
for log in ([verdict(muse, said)], [verdict(muse, said), verdict("connection lost again here", said + 60, "muse-ember")]):
|
||||
gone = models.outs(log, reset - 60, pool)
|
||||
self.assertEqual(sorted(gone), ["muse-ember", "muse-wonder"])
|
||||
self.assertEqual({w: g[2] for w, g in gone.items()}, dict.fromkeys(gone, reset)) # a later message with no time shortens nothing
|
||||
gone = models.outs([verdict(muse, said)], reset - 60, pool)
|
||||
off = lambda now: models.out(["muse-ember"] + [""] * 8, set(), None, gone, now)
|
||||
self.assertEqual((off(reset - 60).startswith("out since"), off(reset)), (True, ""))
|
||||
self.assertEqual(sorted(models.outs([verdict(muse, said), verdict("did it all well", said + 60, "muse-ember", "good")], said + 90, pool)), ["muse-wonder"])
|
||||
for why, wait in (("Individual quota reached. Resets in 108h11m37s.", 108 * 3600 + 11 * 60 + 37), ("limit hit, resets in 3 days", 3 * 86400),
|
||||
("Rate limited: try again in 45 minutes", 45 * 60), ("Resets in 4h 14m (shared account quota)", 4 * 3600 + 14 * 60),
|
||||
(LIMIT, 6 * 3600), ("started 2026-12-30T00:00:00Z and hit a limit", 6 * 3600),
|
||||
("usage window resets at 2026-11-01T00:00:00Z", 6 * 3600), ("resets in 9000 days", 6 * 3600)):
|
||||
self.assertEqual(models.outs([verdict(why, said)], said)["muse-wonder"][2] - said, wait, why)
|
||||
# through the command: the model out and its sibling are both off, long after six hours
|
||||
self.judged("gemini-4-neon", "out", "Individual quota reached. Resets in 108h11m37s.")
|
||||
self.dated(108 * 60 + 10)
|
||||
for cls, args in (("ordinary", ("--not", "muse-wonder")), ("routine", ("--not", "alpha", "--not", "muse-ember"))):
|
||||
got, out = self.picked(cls, *args)
|
||||
self.assertEqual((got, "(out since" in out), (False, True), out)
|
||||
self.assertIn("gemini-4-hydrogen: out since", self.sisi("models")[1])
|
||||
self.assertEqual(self.picked("routine", "--not", "muse-ember", "--not", "gemini-4-hydrogen")[0], True) # another plan stays on
|
||||
self.dated(108 * 60 + 12)
|
||||
self.assertEqual(self.picked("routine", "--not", "alpha", "--not", "muse-ember")[0], True)
|
||||
|
||||
def test_pick_says_a_returning_worker_is_a_retry(self):
|
||||
self.table(ONE)
|
||||
self.judged("alpha", "out", LIMIT + ", please try later. " * 30)
|
||||
|
||||
Reference in new issue
Block a user