Take the whole plan off only for a shared quota; read date-style resets; fit the size cap
An `out` message widens to every worker on the same provider only when it
states a reset time or names a shared quota (quota, usage window, usage limit,
subscription); a crash, timeout or lost connection takes off just the one.
Resets written as dates ("resets Dec 2, 2pm (America/Denver)") are read.
sisi/ is back at the 3264-line cap: `sisi help` is shorter (README explains each
command), module docstrings keep their first sentence, and dead or single-use
wrappers are gone (rules.delivered, models.speeds/qualities/pools,
install._hooks).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9fb2a61920
commit
e2768a1377
9 files changed
+92
-125
No files matched your search
+34
-3
@@ -1967,7 +1967,7 @@ cli.main(["tick"])
|
||||
|
||||
def test_only_good_outcomes_set_a_workers_speed(self):
|
||||
self.jsonl("outcomes.jsonl", *[self.outcome("flaky", "bad", 1)] * 10 + [self.outcome("steady", "good", 15)] * 10)
|
||||
r = subprocess.run([sys.executable, "-B", "-c", "from sisi import models; print(models.speeds())"], cwd=REPO,
|
||||
r = subprocess.run([sys.executable, "-B", "-c", "from sisi import models; print(models.track()[0])"], cwd=REPO,
|
||||
env=self.env, capture_output=True, text=True)
|
||||
self.assertEqual(r.stdout.strip(), str({"steady": [15] * 10}))
|
||||
|
||||
@@ -2129,7 +2129,7 @@ cli.main(["tick"])
|
||||
picked2 = [self.in_process(models.pick, ["ordinary"], self.proj, lambda i=i: i / 100)[1].splitlines()[0].split()[1] for i in range(100)]
|
||||
self.assertEqual(picked2.count("alpha"), 16)
|
||||
self.assertGreater(picked2.count("alpha"), 0)
|
||||
q, _ = self.in_process(models.qualities)
|
||||
(_, q, _), _ = self.in_process(models.track)
|
||||
self.assertAlmostEqual(q["alpha"], 1 / 11)
|
||||
self.assertEqual(q["beta"], 1.0)
|
||||
# Never refuses a pick even when the sole worker has only bad verdicts.
|
||||
@@ -2159,7 +2159,7 @@ cli.main(["tick"])
|
||||
self.outcome("alpha", "extend", 1),
|
||||
*[self.outcome("beta", "good", 10)] * 4)
|
||||
self.assertEqual(spin(), (67, 33))
|
||||
q, _ = self.in_process(models.qualities)
|
||||
(_, q, _), _ = self.in_process(models.track)
|
||||
self.assertEqual((q["alpha"], q["beta"]), (1.0, 1.0))
|
||||
|
||||
def test_pick_and_models_show_the_minutes(self):
|
||||
@@ -3077,6 +3077,37 @@ cli.main(["tick"])
|
||||
self.dated(108 * 60 + 12)
|
||||
self.assertEqual(self.picked("routine", "--not", "alpha", "--not", "muse-ember")[0], True)
|
||||
|
||||
def test_only_a_message_naming_a_shared_quota_takes_the_whole_plan_off(self):
|
||||
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 (("claude-sonnet-5-5", "Claude Ultra", "ordinary"), ("claude-haiku-5-5", "Claude Ultra", "routine"),
|
||||
("gemini-4-neon", "Antigravity", "ordinary"), ("gemini-4-hydrogen", "Antigravity", "routine"))))
|
||||
self.judged("claude-sonnet-5-5", "out", "Claude Code process killed by signal SIGKILL (machine out of memory)")
|
||||
got, out = self.picked("routine", "--not", "gemini-4-hydrogen") # its sibling is still on
|
||||
self.assertEqual((got, "worker: claude-haiku-5-5" in out), (True, True), out)
|
||||
self.assertEqual(self.picked("ordinary", "--not", "gemini-4-neon")[0], False) # the killed one is off
|
||||
self.judged("gemini-4-neon", "out", "Individual quota reached. Resets in 108h11m37s.")
|
||||
got, out = self.picked("routine", "--not", "claude-haiku-5-5")
|
||||
self.assertEqual((got, "gemini-4-hydrogen (out since" in out), (False, True), out)
|
||||
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, pool = utc("2026-12-02T11:08:47"), {"a": "plan", "b": "plan"}
|
||||
gone = lambda why, t=said: models.outs([{"ts": stamp(t), "worker": "a", "verdict": "out", "why": why}], t, pool)
|
||||
for why in ("OpenCode Go 5 hour usage limit reached.", "Subscription quota exhausted", "your usage window is spent",
|
||||
"this subscription has run out", "Rate limited: try again in 45 minutes"):
|
||||
self.assertEqual(sorted(gone(why)), ["a", "b"], why)
|
||||
for why in ("process terminated by signal SIGKILL", "the job timed out after an hour", "connection reset by peer",
|
||||
"ZAI_API_KEY is not set", "this model is at its cap"):
|
||||
self.assertEqual(sorted(gone(why)), ["a"], why)
|
||||
# a reset written as a date, in the zone it names
|
||||
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)
|
||||
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)
|
||||
|
||||
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