Repository navigation
Conversation
The owner's rule (2026-10-18): every API key lives in one store and is shared out among its users; the Mac reviewer stops running on private z.ai keys. This mounts /queen/zai-lease: the Mac reviewer's claude CLI points ANTHROPIC_BASE_URL at it, and the Queen makes the request on one of her own z.ai lanes, so no key value leaves her. - specs/queen/key_vault.t27, key_failover.t27, key_vault.wasm and queen-key-vault-card.gen.ts vendored from gHashTag/t27#10567 (hashes and build command in specs/PIN). - lease_answer decides grant / wait / refuse, retry_after_seconds the wait, lease_step whether a refused lane hands the request to the next (at most LEASE_TRIES lanes, a wrong request never retried). - The route answers 503 until TRIOS_QUEEN_REVIEW_LEASE_TOKEN (>= 32 bytes) is set, 403 to any other bearer; the caller's token is never forwarded and a key is never returned. - route-guard allowlist entry with its reason; pins re-measured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary by t27-beesChecked by the t27 compilert27c parse, parse-complete and typecheck on each changed .t27 file at
Read by the modelThis PR adds a Worth a look
Read: 11 files, +920 -6, the whole diff. Head |
β Tests passed β 3915/3988
|
Status: blocked on t27#10567 (owner merge)This trios issue wires CI on #10567: one pre-existing failure ( What I can do: nothing further on the trios side until #10567 merges into Check runs on #10567: https://github.com/gHashTag/t27/pulls/10567 |
Why
The owner's rule of 2026-10-18 has two parts. Every API key lives in one store and is shared out among everyone who uses it. The Mac reviewer (
tools/bees/reviewer.pyin gHashTag/t27) stops running on five private z.ai keys that the Queen cannot see.gHashTag/t27#10567 adds the rule as a card,
specs/queen/key_vault.t27, and points the reviewer atBEE_QUEEN_LEASE_URL/BEE_QUEEN_LEASE_TOKEN. This PR is the route behind that URL.What
specs/queen/key_vault.t27,key_failover.t27,key_vault.wasm,services/queen-key-vault-card.gen.tsspecs/PIN. The wasm imports nothing, and two builds gave one hash.routes/queen-lease.ts(+40/-1)createQueenZaiLeaseRoute(). It answers 503 untilTRIOS_QUEEN_REVIEW_LEASE_TOKEN(at least 32 bytes) is set, and 403 to any other bearer (sha256 digests compared withtimingSafeEqual). The card'slease_answerdecides grant, wait or refuse: the free lanes are the z.ai review lanes that no bee (runningKeys), backoff or lease holds, a review counts as waiting, andtotalincludes the lanes the bees hold. A wait is a 429 whoseretry-aftercomes fromretry_after_seconds. The route forwards onlycontent-typeandanthropic-version: never the caller's token.services/queen-free-lane.ts(+40)vault()is the card's wasm.leasedis the keys out on a lease now.zaiLeaseCall()makes the request onhttps://api.z.ai/api/anthropicwith one lane's key and streams the answer back; the lease ends when the stream ends, or afterLEASE_SECONDS. When a lane refuses, the card'slease_stephands the request to the next lane, at mostLEASE_TRIESlanes, and a wrong request (KE_REQUEST) goes back unretried.services/queen-reviewer.ts(+10)zaiLeaseLanes(taken, busy): the z.ai review lanes no bee, backoff or lease holds.server.ts/queen/zai-leaseas a server-to-server route, next to/queen/contributor-keys.tools/route-guard-audit.mjs,tests/api/routes/route-guard.test.ts/queenmounts, 10 to 11 allowlisted.No new hand-written file. Every lease decision is the card's; the TypeScript is I/O around it.
Known imprecision
reviewerLaneKey), so the two concurrent requests a z.ai key carries count as one. That is conservative: the route lends fewer requests than z.ai allows, never more.Owner steps after merge
TRIOS_QUEEN_REVIEW_LEASE_TOKEN(at least 32 random bytes) on trios-agent-server, withskipDeploys: true, and redeploy thequeenbuild.BEE_QUEEN_LEASE_URL=https://<agent-server host>/queen/zai-leaseandBEE_QUEEN_LEASE_TOKEN=<the same token>in~/.claude/.envon the Mac.ZAI_KEY_*lines. Once the lease is set, the reviewer refuses to start while they remain.Check
Biome and the route-guard suite run in this PR's CI. Nothing was built or run on the owner's Mac.
π€ Generated with Claude Code