Skip to content

queen: key_vault.t27 -- one key store, every consumer leases, review lanes first (Closes #10564) - #10567

Open
gHashTag wants to merge 2 commits into
masterfrom
queen-key-vault
Open

gHashTag wants to merge 2 commits into
masterfrom
queen-key-vault

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

Closes #10564

Why

The owner's demand of 2026-10-18: every API key lives in one place and is shared out among everyone who uses it, and the Mac reviewer stops running on five private z.ai keys outside the Queen's pool. Measured 2026-10-19 (names only): the Queen's 34 pool keys sit in 3 copies across 3 Railway services, contributor keys sit sealed in her Postgres, and the Mac holds ZAI_KEY_1, _2, _3, _5, _6 that she cannot see. At the same time 70 bees ran against 354 unreviewed dispatches at about 5 reviews an hour, so review is the bottleneck, and review gets the lanes first.

What

File Change
specs/queen/key_vault.t27 New card on key_failover.t27 (error_kind) and reviewer_sizing.t27 (ZAI_REQUESTS_PER_KEY). may_serve: only the store serves. consumer_start: a consumer with private keys while a lease is configured is refused (two homes for one key). review_share / worker_share: reviews get their demand (holding + waiting, not the backlog), never below one key's 2 lanes; bees get the rest. holder_cap: the review share split over 3 holders, with idle lanes lent. lease_answer: GRANT / WAIT / REFUSE; a bee waits while every free lane belongs to a waiting review. retry_after_seconds, lease_step: a refused lane hands the request to the next, at most 3 lanes, and a wrong request is never retried.
.trinity/seals/queen_QueenKeyVault.json Seal, saved and verified on the lab.
tools/bees/reviewer.py BEE_QUEEN_LEASE_URL + BEE_QUEEN_LEASE_TOKEN (environment or ~/.claude/.env) send the z.ai agent through the Queen's lease route, so no key value leaves her. A ZAI_KEY_* kept beside a configured lease refuses to start (count only). Private keys without a lease still run, with a warning, until the route is live. The lease token is stripped from the agent env. The doctor shows warn/fail. One self-test row. +34/-6.
contrib/portable-claude-setup/ Deletes rotate-keys.sh, check-key-health.sh and rotate-opencode-keys.sh: a second private key pool rotated on one machine, with no state file, launchd job or cron entry on the bench. The README points at the card. -664 lines of shell, so the diff shrinks hand-written foreign code.

The lease route itself (an authenticated z.ai proxy on the Queen, decisions from the vendored wasm of this card) is a gHashTag/trios PR against queen. The sibling rule, no backlog admission while reviews wait, is not touched here.

Lab evidence (Railway lab, t27c 0.5.2, zig 0.16.0)

  • t27c test-report specs/queen/key_vault.t27: 8/8 pass, 3 invariants proved, 0 vacuous; runtime asserts per test: 3, 8, 5, 10, 8, 20, 3, 11.
  • gen, gen-c, gen-rust, gen-verilog, gen-js, gen-ts, gen-python: all exit 0.
  • wasm32-wasi reactor, 11 exports, built twice: one sha256, 8eb18f8eb0d6ff7866c51b8771aeff69dae25db71254b557401332154e7bf20f (797 bytes).
  • tri mutate spec: 57 mutants, 53 killed, 1 unviable (an overflow zig rejects), 3 survivors, all equivalent and stated in the spec: < to <= and > to >= in review_share, and > to >= in the saturating sum, where both branches give the same number at equality. The first run had 5 survivors: the dead guard share == 0 in holder_cap is removed, and holders <= 1 became holders == 0.
  • t27c seal --save then --verify: all hashes MATCH. Spec sha256 caa5c091...4097, seal sha256 ccbf5adb...f1f6.
  • reviewer.py self-test: 0 failures, including queen lease: both names or none, and the agent never sees its token.

Known defect found on the way (follow-up, not fixed here): gen-c emits a const initialised from an imported const before the import, so the C does not compile. REVIEW_FLOOR_LANES is a literal 2, pinned to ZAI_REQUESTS_PER_KEY by an invariant.

🤖 Generated with Claude Code

…lanes first (Closes #10564)

The rule card for the owner's demand of 2026-10-18: every API key lives in the
Queen's store, every consumer leases from it, and lanes are shared by demand
with reviews served first (never below one key's two lanes).

- specs/queen/key_vault.t27: may_serve, consumer_start, review_share,
  worker_share, holder_cap, lease_answer, retry_after_seconds, lease_step.
  8 tests (0 vacuous), 3 invariants, negative controls in every table.
- .trinity/seals/queen_QueenKeyVault.json: sealed and verified on the lab.
- tools/bees/reviewer.py: BEE_QUEEN_LEASE_URL + BEE_QUEEN_LEASE_TOKEN route
  the z.ai agent through the Queen's lease; a private ZAI_KEY_* beside a
  lease refuses to start; private keys without a lease warn. The lease token
  is stripped from the agent env. One self-test row.
- contrib/portable-claude-setup: delete the three private key rotation
  scripts (a second key pool on one machine, unused on the bench); the
  README points at the card instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-18 19:23:44 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 44
PRs with All Checks Green 6
READY 0
FAILING 44
PENDING 0
NO CHECKS YET 0

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

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=fad12492937a != 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).

This was referenced Oct 19, 2026

This branch has not been deployed

No deployments
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.

queen: one key store -- every consumer leases, review lanes first (key_vault.t27)

1 participant