Skip to content

spec(queen): api_fleet -- the law of the free-model fleet - #12180

Merged
github-actions[bot] merged 1 commit into
masterfrom
lane/api-fleet
Oct 25, 2026
Merged

github-actions[bot] merged 1 commit into
masterfrom
lane/api-fleet

Conversation

@gHashTag

Copy link
Copy Markdown
Collaborator

Closes #12170.

What

specs/queen/api_fleet.t27 -- the fleet-level law for the free-model API fleet, on top of the machinery that already exists (queen/key_failover.t27 per-key failover, queen/key_credit.t27 lease credit, tools/bees/reviewer.py rotation):

  1. ROUTES -- the 2026-10-25 measured matrix as data: 7 FleetRoute rows (provider, model, price in/out, status ALIVE/REFUSED/DEAD/UNPROBED, probe date YYYYMMDD, key_mask of pool keys found alive). The z.ai pool is keys 1,2,3,5,6 (no key 4): all 5 ALIVE on glm-4.5-flash, keys 1/3/6 on glm-4.7-flash, highspeed REFUSED by the plan.
  2. ROTATION -- next_key (numeric order, wrap, NO_FLEET_KEY after the last), fallback_model (the reviewer bee's glm-4.5-flash <-> glm-4.7-flash pair, NO_MODEL for everything else), rotate/rotate_step (next key -> fallback model -> RT_FAIL; bounded by key_failover::MAX_ATTEMPTS_PER_TURN, fails closed).
  3. PROBE -- probe_result classifies (http_code, body_marker): plan-excluded marker refuses at any status; 200 ALIVE; 401/403 REFUSE THE ROUTE, never the key (the 2026-10-25 lesson: all five keys answered 401 on 4.7-flash and ALIVE on 4.5-flash the same hour); 402/quota DEAD; 429/529/5xx/overload UNPROBED. probe_updates: an inconclusive probe never rewrites a dated row. probe_retires_key is false over the whole answer space -- keys leave only through the lease law.
  4. METER -- credit(job_id, route_id, owner, gate_passed, tokens_est) emits one CreditRow per gate pass; PAY_NORMAL at KEY_CREDIT_MTRI == REWARD_PER_JOB_MTRI (1 mTRI per accepted job, the existing payout rail); a failed gate, an unknown route or an owned-by-nobody pool key earns nothing. Tokens recorded, never priced.

Gate

  • t27c check specs/queen/api_fleet.t27 -- Typecheck OK (0 errors, 0 warnings), exit 0
  • t27c test-report specs/queen/api_fleet.t27 -- exit 0: 6/6 tests pass, 0 FAIL, 0 vacuous passes, 5223 runtime asserts executed, 5 invariants proved comptime
  • lefthook pre-commit: foreign-budget, own-language, secret-gate all green
  • ASCII only (L3); new code is a .t27 spec only

Not here (the spec says so)

Network I/O (the host probes; the spec classifies), the wiring into trios and the bee (generated, never hand-written), and issue #12170's tri fleet scan success criterion -- that needs the host-side scanner that consumes this law.

The 2026-10-25 matrix as data (7 routes, 5 z.ai pool keys, dated probes);
the rotation law (numeric order, wrap, then the 4.5<->4.7 fallback pair,
bounded by key_failover's MAX_ATTEMPTS_PER_TURN, fails closed); the probe
classification (401 refuses the ROUTE, never the key -- the 2026-10-25
lesson; transient answers leave the matrix UNPROBED and rewrite nothing);
the meter (one CreditRow per gate pass, PAY_NORMAL at 1 mTRI, pool keys
and failed gates earn nothing).

Gate: t27c check OK; t27c test-report exit 0 -- 6/6 pass, 0 FAIL,
0 vacuous, 5223 runtime asserts, 5 invariants proved comptime.
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-25 03:01:55 UTC

Summary

Status Count
Total Open PRs 48
PRs with Failing Checks 42
PRs with All Checks Green 6
READY 3
FAILING 42
PENDING 0
NO CHECKS YET 0

These columns do not partition: 3 + 42 + 0 + 0 = 45, and there are 48 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=55c0f1b1b32d != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@tri-claw

tri-claw Bot commented Oct 25, 2026

Copy link
Copy Markdown

Summary by t27-bees

Checked by the t27 compiler

t27c parse, parse-complete and typecheck on each changed .t27 file at 9c03494. Nothing was generated, built or run. A pass means the file is well formed, not that it is right.

  • specs/queen/api_fleet.t27: parses and typechecks.

Read by the model

This spec codifies the fleet-level law for the free-model API fleet: a dated route matrix (7 routes as of 2026-10-25), key rotation with model-pair fallback bounded by MAX_ATTEMPTS_PER_TURN, probe classification that treats 401/403 as route refusals (not key failures), and a credit meter that pays 1 mTRI per gate-passing job on owned keys. It builds on existing key_failover and key_credit machinery without re-implementing them.

Worth a look

  • specs/queen/api_fleet.t27:112,116 — key_mask values 110 and 74 are hardcoded decimal literals. The tests (lines 353, 360) compute the same masks with bit(1)+bit(2)+bit(3)+bit(5)+bit(6) and bit(1)+bit(3)+bit(6). If the pool changes, the table and tests must be edited in two different notations; a mismatch would silently seed wrong alive-key counts.
  • specs/queen/api_fleet.t27:184 / 458 — NO_FLEET_KEY = 255 is asserted equal to NO_KEY from queen::key_failover. If that module ever changes NO_KEY, this invariant fails at comptime and the spec won't compile. The dependency is correct but brittle across module boundaries.
  • specs/queen/api_fleet.t27:267 — http_code == 0 (network error) is checked after BM_PLAN_EXCLUDES. A probe that returns both a plan-excluded marker and a connection failure yields RS_REFUSED rather than RS_UNPROBED. The comment says "plan-excluded marker refuses at any status", so this may be intentional, but it means a transient network blip on a plan-excluded route looks like a durable refusal.
  • specs/queen/api_fleet.t27:394 — The probe law test samples HTTP codes in steps of 7 (code = code + 7). Codes like 401, 403, 429, 500, 529 are covered by the explicit assertions above, but the combinatorial loop does not exercise every status code. A classification bug on an untested code (e.g., 418, 451) would not be caught.
  • specs/queen/api_fleet.t27:227-228 — refusal_rotates treats KE_QUOTA as non-rotating ("the lease law's business"), yet probe_result maps 402/quota to RS_DEAD (route dead). If a route is marked DEAD but the key isn't rotated away, the fleet may keep selecting a dead route until the key itself is cooled down by the lease law. The interaction between route-level DEAD and key-level cooldown isn't exercised in the tests.

Read: 1 files, +477 -0, the whole diff. Head 9c03494. Model: openai-compatible/nvidia/nemotron-3-ultra-550b-a55b. Commands: @t27-bees review | summary | help | pause | resume. Free for every repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API fleet: scanner of free AI routes, key rotator, and $TRI metering for contributed capacity

1 participant