Skip to content

spec(queen): scheduler control contract -- event wakeups, fenced task leases, assign/cancel, agent reuse - #6676

Merged
gHashTag merged 1 commit into
masterfrom
claude/queen-scheduler-control-6657
Oct 6, 2026
Merged

gHashTag merged 1 commit into
masterfrom
claude/queen-scheduler-control-6657

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Closes #6675
Refs #6657, #6655

What

This PR adds specs/queen/control.t27 (module QueenControl), the canonical contract for the #6657 control layer. It extends specs/queen/dispatch.t27 and reuses the Inngest app from #3594 for event delivery. It adds no second queue, lease registry, bee registry or review.

Gap dispatch.t27 measured What control.t27 makes canonical
EVENT_RULE: no event IDs, GitHub polled 10 event kinds with queen/* Inngest names; per-stream sequence idempotency; zero wake delay; the 300 s tick only reconciles
TASK_LEASE_RULE: no per-task lease or heartbeat one fenced claim per task (the shape of queen_lease), TTL 180 s / heartbeat 60 s from the runtime, reclaim on expiry, fenced writes
WRITER_RULE: the writer checks nothing a claim lands only at the fence it read; two claimants on one fence land once
CANCEL_RULE: none manual assign goes before the automatic choice and never against a live lease; cancel bumps the fence, frees files, and is not counted as a retry
CHOICE_RULE: first eligible only every free slot is offered per wake; capacity = min(keys x lanes, ceiling, memory) at every wake; placement by domain
(new) persistent domain agents BOOT once, then IDLE -> BUSY -> COMPACT -> IDLE with no rebuild; context cleared, lineage kept; reuse, then clone, then wait; the Queen never executes; memory never overrides the store

Evidence

The local t27c (target/release/t27c) was used to generate only, with no build. Zig is 0.16.0.

Check Result
t27c gen specs/queen/control.t27 > control.zig && zig test control.zig All 11 tests passed.
t27c gen-c exit 0
Mutants 8/8 killed: fence check deleted, expiry ignored on renew, heartbeat wakes, first-only offer, compaction keeps context, clone before reuse, manual steals a live lease, duplicate event applies
ASCII, gitleaks, own-language hook clean

The deleted-fence mutant survived at first: the live-lease test refuses through the holder check anyway. The test now includes the expired-lease race, where only the fence decides.

Not in this PR

  • The supervisor wiring. It is TypeScript in gHashTag/BrowserOS queen-tick.ts, queen-dispatch.ts and queen-lease.ts. That is hand-written foreign code, so it is parked under the only-t27 rule. As with priority.t27 and review_valve.t27, the supervisor should import the constants via t27c gen-js and mirror the functions. Until it does, these rules are a contract with tests, not measured runtime behaviour.
  • The live re-measure of System pulse: what the swarm is doing, and what has stopped #6628, and committed gen/c output. The local compiler predates master, and no seal is required (review_valve.t27 landed without one).
  • A codegen defect found along the way. Reassigning a var inside a test body is emitted in Zig as a redeclaration (const fence = ...). The tests here avoid it by using one name per step.

🤖 Generated with Claude Code

… leases, assign/cancel, agent reuse

specs/queen/control.t27 closes the five gaps specs/queen/dispatch.t27
measured in the running supervisor: no event IDs, no per-task lease or
heartbeat, a writer that checks nothing, no cancel, first-eligible only.
Events wake the Queen at once and the tick only reconciles. Task claims
are fenced like queen_lease. A person assigns before the automatic choice
and cancels by bumping the fence. Every free slot is offered per wake.
Domain agents boot once and compact between tasks, keeping their skill
lineage; clones get their own lease holder; the Queen never executes.

11 tests pass (t27c gen + zig test); 8/8 mutants killed.

Closes #6675
Refs #6657, #6655

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-06 06:45:51 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 35
PRs with All Checks Green 15
READY 12
FAILING 35
PENDING 0
NO CHECKS YET 0

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

Seal Status

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

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.

spec(queen): scheduler control contract -- event wakeups, fenced task leases, assign/cancel, agent reuse (slice of #6657)

1 participant