Recency only among versions of the same model (never across makers or classes); --released accepts YYYY-MM; rule text says newest version of a given model. done / next: repeat runs, report
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d36550d00f
commit
f2a5d3d96d
6 files changed
+56
-47
No files matched your search
+3
-3
@@ -81,9 +81,9 @@ wrong work.
|
||||
|
||||
You own the whole outcome; workers are specialists whose reports are evidence for you to judge.
|
||||
Give each task to the least expensive worker that is capable enough, counting rework as cost,
|
||||
and keep your own context for judgement. Always use the most recently released model of a class
|
||||
when it is usable, never an older version of it; classify a maker's models before comparing them,
|
||||
because different classes are different things. Use the host's own delegation first. Run independent
|
||||
and keep your own context for judgement. Always use the newest version of a given model
|
||||
(same maker and class) when it is usable, never an older version of it; a newer release of a
|
||||
different model or class is a different thing, so classify models before comparing them. Use the host's own delegation first. Run independent
|
||||
work in parallel when it shortens the critical path. Brief a worker with a contract
|
||||
(`sisi delegate brief`), check what comes back in proportion to the risk, and record the
|
||||
judgement (`sisi delegate judge`). `sisi route` recommends a worker from that record, and
|
||||
|
||||
@@ -33,8 +33,10 @@ present; nothing here names one. Read on demand: `sisi delegate guide`.
|
||||
routine work measured proof outranks a benchmark: the cheapest worker with a judged
|
||||
record wins, and standing decides only when nobody has one. A thin record is a
|
||||
reason for care, not a verdict.
|
||||
- Always use the most recently released model of a class when it is usable, and never an older
|
||||
version of it: newer models are almost always better and almost always cheaper, so neither a
|
||||
- Always use the newest version of a given model (same maker and class) when it is usable, and
|
||||
never an older version of it. This is about versions of one model, not about whichever model
|
||||
was released last: a newer release of a different model or class never wins for being newer.
|
||||
A newer version is almost always better and almost always cheaper, so neither a
|
||||
better old record nor a cheaper old plan brings an older version back. A new version starts
|
||||
from its predecessor's judged record until it has its own. Two exceptions only: the newer model
|
||||
is unusable right now (down, out of allowance, avoided), or its class is not recorded yet.
|
||||
|
||||
+6
-3
@@ -97,8 +97,10 @@ one per group of workers passed over as not capable enough, and names an explora
|
||||
|
||||
## Newest version of a class, always
|
||||
|
||||
Newer models are almost always better and almost always cheaper, so `sisi route` always uses the
|
||||
most recently released model of a class that is usable, and never an older version of it. sisi reads
|
||||
Newer versions of a model are almost always better and almost always cheaper, so `sisi route` always uses
|
||||
the newest version of a given model (the same maker and class) that is usable, and never an older version of
|
||||
it. This is about versions of one model: a newer release of a different model or class never wins for being
|
||||
newer. sisi reads
|
||||
nothing from a model's name: a model's maker, class and release date are facts, researched by a cheap,
|
||||
fast worker (session start and `sisi route` say when they are missing) and recorded with
|
||||
`sisi workers fact WORKER --maker M --class C --released YYYY-MM-DD --source S`. A model's identity is its
|
||||
@@ -129,7 +131,8 @@ its maker and class (one version back at a time), named in `--explain`. It ranks
|
||||
own record and above a benchmark, counts as a judged record for the rule that proof comes before
|
||||
benchmark, stops once the model has a thick record of its own, and a predecessor's bad record is not
|
||||
inherited. A discovered model with no data of its own is routable when its predecessor is. Where the
|
||||
arithmetic falls back to a stable tie-break, the more recently released model wins first.
|
||||
arithmetic falls back to a stable tie-break, the newer version of the same model goes first (never across makers
|
||||
or classes).
|
||||
|
||||
## Costs and failures
|
||||
|
||||
|
||||
+11
-10
@@ -51,8 +51,8 @@ The rule, in order:
|
||||
is never compared.
|
||||
8. Load balancing: within the same price tier and price, the worker that has taken the least work
|
||||
relative to its remaining allowance goes first (recorded uses divided by allowance left, an
|
||||
unknown allowance counting as half). Ties break on the more recently released model (its recorded
|
||||
release date), then on the worker id.
|
||||
unknown allowance counting as half). Ties break on the newer version of the same model (never across
|
||||
makers or classes), then on the worker id.
|
||||
|
||||
Candidates reach here already restricted to workers with a judged record, a known price or a
|
||||
benchmark standing (see workers.routable_candidates); on a cold start none qualifies and every
|
||||
@@ -584,18 +584,19 @@ def _assess_all(eligible, stats, kind, difficulty, floors, opts=None):
|
||||
|
||||
|
||||
def recency_order(candidates):
|
||||
"""{worker: (recorded release date as days, negated; position among the versions of its class, newest first)}.
|
||||
Smaller sorts first, so the more recently released model goes first; what cannot be compared is (0, 0)."""
|
||||
out = {c["worker"]: (0, 0) for c in candidates}
|
||||
"""{worker: position among the versions of its own model, newest first (0)}. Only versions of the same model
|
||||
(the same recorded maker and class) are ever compared; models of different makers or classes are different
|
||||
things, however recently each was released, and stay at 0 so the old tie-break decides between them."""
|
||||
out = {c["worker"]: 0 for c in candidates}
|
||||
groups = {}
|
||||
for c in candidates:
|
||||
l = _lineage(c)
|
||||
if l and l.get("key"):
|
||||
l = _comparable(c)
|
||||
if l:
|
||||
groups.setdefault(tuple(l["key"]), []).append(c)
|
||||
for group in groups.values():
|
||||
for i, level in enumerate(_versions_newest_first(group)):
|
||||
for d in level:
|
||||
out[d["worker"]] = (-days(_lineage(d).get("released")), i)
|
||||
out[d["worker"]] = i
|
||||
return out
|
||||
|
||||
|
||||
@@ -625,7 +626,7 @@ def _make_key(stats, kind, difficulty, prefer, recency=None):
|
||||
standing_key(c),
|
||||
load_ratio(c),
|
||||
-(r if r is not None else -1.0),
|
||||
recency.get(c["worker"], (0, 0)),
|
||||
recency.get(c["worker"], 0),
|
||||
c["worker"])
|
||||
|
||||
return key, rate, load_ratio, recency
|
||||
@@ -732,7 +733,7 @@ def choose(candidates, records, availability, kind, difficulty, review_of=None,
|
||||
reason = ("lower measured accepted rate for this kind and difficulty"
|
||||
if r is not None and cr is not None and r < cr else
|
||||
"equal on price and load; the choice is the more recently released"
|
||||
if recency.get(choice["worker"], (0, 0)) < recency.get(c["worker"], (0, 0)) else
|
||||
if recency.get(choice["worker"], 0) < recency.get(c["worker"], 0) else
|
||||
"equal on price and load; the choice came first in worker-id order")
|
||||
passed.append((w, reason))
|
||||
judged_first = basis == "capable" and _prefer_judged(pool, assessments, difficulty)[1]
|
||||
|
||||
+12
-8
@@ -2074,10 +2074,8 @@ def _model_fact_args(args):
|
||||
continue
|
||||
v = v.strip().lower()
|
||||
if field == "released":
|
||||
try:
|
||||
datetime.date.fromisoformat(v)
|
||||
except ValueError:
|
||||
print("sisi: --released wants a date as YYYY-MM-DD", file=sys.stderr)
|
||||
if not _valid_date(v):
|
||||
print("sisi: --released wants a date as YYYY-MM-DD (or YYYY-MM)", file=sys.stderr)
|
||||
return False
|
||||
elif not _NAME.fullmatch(v):
|
||||
print("sisi: %s wants a short name (letters, digits, hyphens)" % opt, file=sys.stderr)
|
||||
@@ -2117,6 +2115,15 @@ def _classify_answer(text):
|
||||
return None
|
||||
|
||||
|
||||
def _valid_date(v):
|
||||
"""A release date as YYYY-MM-DD or YYYY-MM."""
|
||||
try:
|
||||
datetime.date.fromisoformat(v if len(v) == 10 else v + "-01")
|
||||
except (ValueError, TypeError):
|
||||
return False
|
||||
return len(v) in (7, 10)
|
||||
|
||||
|
||||
def _valid_name(v):
|
||||
return isinstance(v, str) and (v.strip().lower() == "unknown" or bool(_NAME.fullmatch(v.strip().lower())))
|
||||
|
||||
@@ -2157,10 +2164,7 @@ def _cmd_classify(args):
|
||||
released = e.get("released", "unknown") if isinstance(e, dict) else None
|
||||
ok = isinstance(e, dict) and _valid_name(e.get("maker")) and _valid_name(e.get("class"))
|
||||
if ok and str(released).lower() != "unknown":
|
||||
try:
|
||||
ok = routing.days(released) > 0 and (len(released) == 7 or datetime.date.fromisoformat(released) is not None)
|
||||
except (ValueError, TypeError):
|
||||
ok = False
|
||||
ok = isinstance(released, str) and _valid_date(released)
|
||||
if not ok:
|
||||
print("sisi: the entry for %s is not {maker, class, released} with short names and a YYYY-MM[-DD] date "
|
||||
"(or unknown); nothing recorded" % w, file=sys.stderr)
|
||||
|
||||
+20
-21
@@ -1,5 +1,5 @@
|
||||
"""Recency breaks ties: where the arithmetic falls back to a stable order, the more recently released model wins
|
||||
first (its recorded release date, else the old tie-break by worker id), and the
|
||||
first (a newer version of the same model, never across makers or classes), and the
|
||||
rule is in the text agents and people read. Requirement ids: R-7.2-1, R-7.2-2."""
|
||||
import os, unittest
|
||||
from support import *
|
||||
@@ -8,27 +8,26 @@ from test_model_supersession import cand, pick
|
||||
|
||||
|
||||
class RecencyTieBreakTests(unittest.TestCase):
|
||||
def test_a_recorded_release_date_decides_a_tie_between_unrelated_models(self):
|
||||
def test_a_newer_release_never_beats_a_different_model_just_for_being_newer(self):
|
||||
"""The owner: newer means a newer version of the SAME model, not the newest release across models."""
|
||||
a = cand("prov/aaa-1.0", cost=1.0, rel="2026-01-10", maker="aaa")
|
||||
b = cand("prov/bbb-2.0", cost=1.0, rel="2026-08-01", maker="bbb")
|
||||
who, r = pick([a, b])
|
||||
self.assertEqual(who, "prov/bbb-2.0")
|
||||
self.assertIn(("prov/aaa-1.0", "equal on price and load; the choice is the more recently released"), r["passed_over"])
|
||||
self.assertEqual(pick([b, a])[0], "prov/bbb-2.0")
|
||||
self.assertEqual(who, "prov/aaa-1.0") # the old tie-break (worker id), whatever the release dates
|
||||
self.assertEqual(pick([b, a])[0], "prov/aaa-1.0")
|
||||
flash = cand("prov/abc-flash", cls="flash", cost=1.0, rel="2026-01-10")
|
||||
std = cand("prov/abc-std", cls="standard", cost=1.0, rel="2026-08-01")
|
||||
self.assertEqual(pick([flash, std])[0], "prov/abc-flash")
|
||||
self.assertEqual(routing.recency_order([a, b, flash, std]), {w: 0 for w in ("prov/aaa-1.0", "prov/bbb-2.0", "prov/abc-flash", "prov/abc-std")})
|
||||
|
||||
def test_unknown_recency_keeps_the_old_tie_break(self):
|
||||
a, b = cand("prov/aaa-1.0", cost=1.0, maker="aaa"), cand("prov/bbb-9.0", cost=1.0, maker="bbb", rel="2026-08-01")
|
||||
who, r = pick([a, b])
|
||||
self.assertEqual(who, "prov/bbb-9.0") # a recorded date beats none
|
||||
a2, b2 = cand("prov/aaa-1.0", cost=1.0, maker="aaa", known=False), cand("prov/bbb-9.0", cost=1.0, maker="bbb", known=False)
|
||||
who, r = pick([a2, b2])
|
||||
self.assertEqual(who, "prov/aaa-1.0")
|
||||
self.assertIn(("prov/bbb-9.0", "equal on price and load; the choice came first in worker-id order"), r["passed_over"])
|
||||
def test_within_one_model_the_newer_version_goes_first(self):
|
||||
old, new = cand("prov/abc-old", rel="2026-01-10"), cand("prov/abc-new", rel="2026-08-01")
|
||||
self.assertEqual(routing.recency_order([old, new]), {"prov/abc-new": 0, "prov/abc-old": 1})
|
||||
|
||||
def test_price_and_load_still_come_before_recency(self):
|
||||
cheap_old = cand("prov/aaa-1.0", cost=0.5, rel="2026-01-10", maker="aaa")
|
||||
dear_new = cand("prov/bbb-2.0", cost=1.0, rel="2026-08-01", maker="bbb")
|
||||
self.assertEqual(pick([cheap_old, dear_new])[0], "prov/aaa-1.0")
|
||||
def test_price_and_load_still_come_before_the_tie_break(self):
|
||||
cheap = cand("prov/aaa-1.0", cost=0.5, maker="aaa")
|
||||
dear = cand("prov/bbb-2.0", cost=1.0, maker="bbb", rel="2026-08-01")
|
||||
self.assertEqual(pick([cheap, dear])[0], "prov/aaa-1.0")
|
||||
|
||||
|
||||
class TextTests(unittest.TestCase):
|
||||
@@ -39,13 +38,13 @@ class TextTests(unittest.TestCase):
|
||||
def test_the_rule_is_in_the_always_loaded_rulebook_the_playbook_and_the_docs(self):
|
||||
core = self.read("canon", "core.md")
|
||||
rule6 = core[core.index("## 6. Orchestrate"):core.index("## 7.")]
|
||||
self.assertIn("most recently released", rule6)
|
||||
self.assertIn("newest version of a given model", rule6)
|
||||
self.assertIn("never an older version", rule6)
|
||||
self.assertIn("class", rule6)
|
||||
self.assertIn("different model or class", rule6)
|
||||
for path in (("canon", "orchestration.md"), ("docs", "workers.md")):
|
||||
text = self.read(*path).lower()
|
||||
self.assertIn("most recently released", text, path)
|
||||
self.assertIn("different classes", text, path)
|
||||
self.assertIn("newest version of a given model", text.replace("\n", " ").replace(" ", " "), path)
|
||||
self.assertIn("different model or class", text.replace("\n", " ").replace(" ", " "), path)
|
||||
self.assertIn("cheaper", text, path) # the reason: newer models are better and cheaper
|
||||
|
||||
def test_the_rulebook_is_inside_its_budget(self):
|
||||
|
||||
Reference in new issue
Block a user