Repository navigation
queen: wire keyed_batch.wasm so the bee admission makes one queend choose per batch, not per issue #2043
Copy link
Copy link
Open
Description
Problem
On 2026-10-17 the keyed-actors dispatch trial (TRIOS_QUEEN_DISPATCH=actors, build 42042a5) started 2 runners in 20 minutes. The round loop starts 18.5 in the same time, so the trial was reverted (evidence).
The cause is serial admission:
handRoundToBeeActors(queen-bee-actors-round.ts:216) readies about 826 candidates.- The single
bee-admissionactor then answers them one at a time withawait deps.admit(ask.issue)(queen-bee-actors.ts:298). - Each of those is one queend
choosecall for one issue (round.choose(issue, ...)atqueen-bee-actors-round.ts:152, which becomeskind:'choose', candidates:[issue]atqueen-tick.ts:2267). - The loop asks queend once per round about the whole list (
queen-batch-choose.ts).
Spec
gHashTag/t27#10051 adds specs/queen/keyed_batch.t27 (closes gHashTag/t27#10033). That card is the policy. This issue covers only the thin wiring that reads it, in the same way keyed_guard.wasm is wired today. No policy lives in TypeScript.
Wiring
- Vendor the card.
- Copy
keyed_batch.t27intoagent-server/specs/queen/. - Build
queen/keyed_batch.wasmthe way the other cards are built:t27c gen-cfollowed byzig 0.16.0 cc --target=wasm32-wasi -Oz -DNDEBUG -mexec-model=reactor, exporting the card's functions pluslane_free,admit_answer,wake_countandbatch_quota. - The reproducible lab sha256 is
1ed6bcb13de9ff4c462ff6d0f8a1ba6e3c590d0235756f3aa4ce4bd8fcacfd8a(1187 bytes). - Pin both files in
specs/PIN. - Load the wasm with
loadCardWasm('queen/keyed_batch.wasm'), next to the guard card (queen-bee-actors.ts:112-118).
- Copy
- Give the admission actor an open batch (group commit).
- On each
ready, ask the cardjoins_batch/answer_now. Asks that do not join are answered at once, as today. - When
batch_goes_outis true (no choose in flight), takebatch_take(open)asks and send them as ONE choose. Asks that arrive meanwhile wait for the next batch. There is no timer.
- On each
- Make
deps.admitbatch-shaped.- It takes a list of issues and returns one word per issue: PICK, LATER or NO (the card's
word_of). - Behind it, make one queend
choosewith all the candidates, reusingreadAnswer/planBatchfromqueen-batch-choose.ts. - Cap new lanes with the card's
new_lane_quota. Kept asks (a restart on a lane the issue already holds) sit outside the quota.
- It takes a list of issues and returns one word per issue: PICK, LATER or NO (the card's
- Answer each ask in order with
batch_answer(kept, holds_lane, free, word), re-readinglane_freeafter every grant.batch_grantsis the cross-check: a batch grants exactly its quota. - Wake: replace the
wake_countcall (queen-bee-actors.ts:254) withbatch_wake_count. A freed lane wakes every waiting issue into one batch instead of one issue per lane. - Bound the calls.
askQueend(aroundqueen-tick.ts:1330) spawns queend with no timeout. Give it the card'sCHOOSE_BOUND_MS(12000).- Keep
admitAfterMs(queen-bee-actors.ts:226, 30000 today) above twice that bound. The card'sask_bound_okmust hold.
- Treat a failed choose as a wait, not a refusal. A choose that throws or times out must become LATER via
word_after_choose. Today.catch(() => false)turns it into a refusal. - Measure.
- Expose the dispatcher's counters in the
Queen actors measuredlog line: chooses per round, asks per batch, grants and waits. - Re-run the trial against the loop and post the before/after runner starts per 20 minutes on Queen moves to the actor model: the rule in every AGENTS.md, an MVP, a benchmark, then the swap t27#7851.
- Expose the dispatcher's counters in the
Done when
- The vendored card and wasm are pinned.
- The admission makes one queend choose per batch, not one per issue.
- A trial run's runner starts per 20 minutes are posted on Queen moves to the actor model: the rule in every AGENTS.md, an MVP, a benchmark, then the swap t27#7851 next to the loop's 18.5.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
dmitrii-f-t27 commentedon Oct 19, 2026
Status: not executable here — trios agent-server TypeScript wiring is not public
This trios issue wires
keyed_batch.wasminto the bee admission flow (one queen choose per batch, not per issue). The wiring lives in the trios agent-server TypeScript (trios/agent-server/apps/server/src/agent/message-validation.tsand related files), perapps/trios-macos/docs/EXTERNAL-APP-INTEGRATION.md.Evidence it is not available here:
gHashTag/triosclone (this repo, checked outmain): noagent-server/directory exists at any depth. Onlymainbranch exists.gHashTag/BrowserOSdevbranch: now holds only the browser extension (commite0ca3e7, "docs: this fork holds the browser extension only (owner rule, 2026-10-08)"). Thepackages/browseros-agenttree that used to contain the agent server is gone.EXTERNAL-APP-INTEGRATION.mdsays the agent runtime "now lives attrios/agent-server/and is the only copy" — but that copy is not in this public clone, so the file references a location that is not publicly accessible.What I can do: nothing on the agent-server side until the TypeScript sources are published somewhere I can read. The
.t27spec side (if anykeyed_batch.t27boundary exists in gHashTag/t27 issues) can still be ported in gHashTag/t27, but the TS wiring itself is blocked on publication.