Skip to content

Slot gate: a thread list that cannot be read refuses the delegation - #705

Merged
scuttletoby merged 4 commits into
mainfrom
fork/684-slot-gate-fail-closed
Nov 21, 2026
Merged

scuttletoby merged 4 commits into
mainfrom
fork/684-slot-gate-fail-closed

Conversation

@scuttletoby

@scuttletoby scuttletoby commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Closes #684

What

The agent slot gate now fails closed. When a delegation needs the running-agent count and the gate cannot read the thread list, delegate_task is refused. Before, the call went through, with only the free-memory floor still applying. The gate cannot read the list when upstream's readShellSnapshot fails, throws a defect, or does not answer within COUNT_READ_TIMEOUT.

  • Refusal. It uses the gate's usual shape, { type: "refuse" }, and comes back to the caller as slots_full. The message:
    • error or defect: "No agent was started: the slot gate could not read the thread list (the read failed with an error), so it cannot count the running agents. Try again in a moment, or do the work yourself."
    • timeout: the same, but with "(the read took longer than 5 seconds)".
  • A refusal writes nothing of its own. The gate refuses before it records anything: no starting entry, no held slot used up, and no receipt, so a retry of the same request is a fresh call. The one write that can still follow is cleanup that belongs to an earlier allowed call: acquire clears in the wait store the held slots that an earlier good read used up (usedLater).
  • Timeout. It stays at 5 s. A normal read takes about 24 ms at 200k runs and about 0.5 s at 1M (measured in the Slot gate: pre-select can no longer drop a running agent #676 review), so 5 s is well above a healthy read and short enough that a stuck store does not hang delegation.
  • At most one count read in flight. The read runs in its own detached fiber, and the gate keeps a marker for it. Every caller that needs the count while it runs (a delegation, a slot-wait sweep, wait_list, the observer) joins that one read with its own 5 s limit; none starts a second. At the timeout the caller stops the read but does not await it, so a read that cannot stop at once (a busy reader worker) holds neither the caller nor the gate, and the next caller joins it instead of piling up another. The marker is cleared when the read ends, whichever way: an answer, a failure, a defect, an interruption, or a late answer after a timeout. A late answer serves a caller that joined it only when it comes within 5 s of the read's start; a later one is a timeout refusal, so no count is older than 5 s. The check of the marker and its setting run under their own small lock, so a scheduler yield cannot start a second read. The real read is one read transaction, and its ROLLBACK finalizer runs before the fiber ends, so the marker stays set until the reader slot is free again.
  • A read that ends by an interruption is a refusal too. "timeout" when a caller stopped it at the timeout, "error" when it interrupted itself (for example a reader pool that shuts down). It is never passed on to the caller as a bare interruption. A caller that is cut off while it waits leaves at once and leaves the read to the others.
  • Unchanged:
    • Slot waits already never granted on an unread count (unread), and wait_list usage already showed null.
    • The observe rule beside the gate reads the same as before.
    • A target with no count limit (memory floor only, or an account limit for another account) reads nothing, so a broken read refuses nothing there.
    • A wait store that cannot be read still counts only the gate's memory, as before. That is a separate store with its own rule, and this issue does not cover it.
  • Docs: docs/fork/README.md (server.agentSlots). The fail-open sentence is replaced with the new rule.

Tests

New tests, all red on main's SlotGate.ts (run locally by swapping in main's file under the new tests: 6 failed, 53 passed) and green with this PR:

Test On main
a read error refuses in plain words (exact text); nothing is sticky, the retry allows red: expected refuse, got allow
a read that dies (a defect) refuses as an error red: expected refuse, got allow
a hung read refuses at the timeout, even inside an uninterruptible acquire, and is stopped; the next call reads again and is allowed red: expected refuse, got allow
a read that cannot be stopped holds neither the call nor the gate after the timeout; its late answer changes nothing red: "the refused call still waits on the read it gave up on"
a refusal for an unread count writes nothing: no start, the held slot kept, nothing cleared in the store; the retry uses the hold once red: expected 'allow' to equal 'refuse'
delegate_task: a thread list that cannot be read gives slots_full with the exact text, nothing is dispatched, and the same request succeeds once the list reads red: expected a failure
an empty thread list is a good read, not a failure: allowed and counted green on main as well; it guards against an empty store being treated as a failure
no counted limit for the target: nothing is read, so a broken read refuses nothing green on main as well (guard)

There is also a mutation check: without the line that stops the read at the timeout, "…and is stopped" goes red (readsStopped 0). The three old "lets the call through" tests are replaced by the tests above.

Local runs:

  • src/slots, src/waits, src/mcp and src/fork: 81 files and 1435 tests pass (after the fix round).
  • Server typecheck, lint, fmt and knip (pre-commit) pass.
  • fork-seam-check.cjs --config-ref origin/main origin/main HEAD passes; no upstream file is changed.

State question

  • Runs again: nothing is kept between reads. After a refusal, the next call reads afresh, and it is allowed once the read works (tested for an error and for a timeout, and through delegate_task with the same request id).
  • Stopped half-way:
    • A read that times out is interrupted. One that cannot stop at once finishes on its own, holds no gate state, and its answer is dropped (tested).
    • A refused call records nothing, so there is no half-done state to undo.
    • A stuck store does not hang delegation. Delegations go through the gate one at a time, so queued callers wait about 5 s each in turn (the third about 15 s) and are then refused. All of them share the one stuck read; none starts another.
  • Old, empty or missing store:
    • An empty but readable thread list allows (tested).
    • A store that cannot be read refuses.
    • The held slots of an old wait store are untouched by a refusal and are used up only by the allowed retry (tested).

Fix round (reviews A and B)

  • Blocking (B 1): one count read in flight, joined by every caller; cleared on every ending. New test: seven refused callers (three at once with a wait_list beside them, three in a row) against a stuck read leave one read running; after the read ends the next call reads again and is allowed. Red on the old head: one read for all seven callers: expected 7 to equal 1.
  • A 1: a read that interrupts itself gives the plain error refusal (test; old head: Failure(Interrupt)).
  • B 2: the Effect.interruptible wrappers are dropped. A forked fiber starts interruptible by default (forkDetach forks with uninterruptible: false), so both were no-ops; the "even inside an uninterruptible acquire" test still pins that. The new restore around the wait is pinned by "a caller cut off while it waits leaves at once" (red without it).
  • B 3: the timeout through delegate_task (exact slots_full text, nothing dispatched, the same request then starts), and a refusal in observe mode (the rule sees today: refuse, readings: failed; the refusal leaves no start behind).
  • A 2 / B 5 and B 4: wording above and in docs/fork/README.md.
  • A 3 (interrupt between fork and ensuring): gone. The fork and the marker are set in one uninterruptibleMask, and a cut-off caller no longer stops the read anyway.
  • A 4: the running === undefined limit stripping is dropped (no count is read only when no count limit applies).

General vs project

General: the agent slot gate is a fork feature with no project facts. Only fork files change (apps/server/src/slots/, the fork's slot gate test in apps/server/src/mcp/, and docs/fork/README.md). The seam list is unchanged.

🤖 Generated with Claude Code

When a delegation needs the running-agent count and the slot gate cannot
read it (upstream's shell read fails, crashes, or takes longer than the
5 s read timeout), the gate now refuses with slots_full instead of
letting the call through on the free-memory floor alone. The message
says the thread list could not be read (error or timeout), that no agent
was started, and that the caller can try again in a moment.

The read now runs in its own fiber that is stopped, not awaited, at the
timeout, so a read that cannot stop at once no longer keeps the refused
call (or the gate's semaphore) waiting. A refused call records nothing:
no starting entry, no held slot used up, no store write.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@scuttletoby

Copy link
Copy Markdown
Owner Author

Review lens A (correctness and bypass): SAFE

Reviewed head 2e6b0eb5. CI is all green (Build and Typecheck, Lint, Test 1-2, Test Server 1-8, fork kit, workflow lint and upstream drift, secret scan, schema check, fork-ci-result). Local run in a temp worktree: SlotGate.test.ts and OrchestratorMcpService.slotGate.test.ts pass, 59/59. I also ran two probe tests (not committed), described under Minor below.

Blocking: none.
Major: none.

What I checked and found correct

  • Every failure of the count read refuses. An error, a defect or the 5 s timeout all become unread (apps/server/src/slots/SlotGate.ts:236-248). decide returns refuse at SlotGate.ts:492-494. That happens before keepStarting, liveHeld, useUp, the new token and the entries write, so a refused call starts nothing, uses no held slot and writes nothing to the store.
  • A successful empty read still allows. It goes down the read branch and is counted (tested).
  • Retries with the same key. The gate is skipped only when hasReceipt(commandId) is true (OrchestratorMcpService.ts:2803, delegateChecks.ts:475). A refusal writes no receipt, so a retry passes through the gate again. The MCP test covers this with the same request id.
  • Fiber, timeout and lock. In effect 4.1.2, timeout is raceFirst with a sleep. The race fibers are forked interruptible, and the only loser it waits on is Fiber.join, which stops at once. The read runs in a detached fiber that interruptUnsafe stops without waiting for it (SlotGate.ts:225-249). So the caller and the semaphore are released at 5 s, even inside the uninterruptible acquireRelease acquire. The late answer goes nowhere: the fiber is unobserved, and the read is read-only. The test with the uninterruptible Deferred read shows this.
  • Message and docs. The message is plain and true ("No agent was started …", with "5 seconds" taken from COUNT_READ_TIMEOUT). The docs/fork/README.md text matches the code: a delegation that needs the count is refused, an empty list counts as a good read, and a slot wait is never woken while the count is unread (grantLocked returns unread, unchanged).
  • Other routes. create_threads, t3_thread_launch, scheduled runs and remote delegate_task never pass through this gate, on main or in this PR ("threads started in other ways are counted but never refused"). A remote child is gated, if at all, on the peer. So this PR adds no bypass. The only caller of acquire is delegateChecks.afterWorkspace.
  • Nothing personal is in the diff or the commits, and no upstream file is changed.

Minor

  1. SlotGate.ts:226: a read that ends by interrupting itself is not a refusal. If activeRunShells.read exits with an interrupt cause of its own (for example a reader pool that shuts down), Fiber.join passes that interrupt on to the caller. Effect.catch and catchDefect do not catch it. A probe confirmed it: with Effect.interrupt in the mock read, an uninterruptible acquire() exits Failure(Interrupt). This still fails closed, because the acquire fails and nothing is dispatched. But the caller gets an interruption, not the plain slots_full message. The behaviour is the same on main. Suggested fix: Fiber.await(reading), then map an interrupt-only exit that is not ours to { type: "unread", problem: "error" }.
  2. PR body: "a stuck store makes each delegation wait at most 5 s" holds only for one caller. decide and grantLocked share one semaphore (SlotGate.ts:534, :658), and each call that holds it can spend 5 s on a hung read. A probe with three concurrent acquires on a hung store answered at 5 s, 10 s and 15 s. The wait is bounded (no hang), but caller k waits about k × 5 s, and a wait-worker tick is one more 5 s in the queue. The wait was the same before. Only the claim in the PR text overstates. Fix the wording, or later share one in-flight read among the callers in the queue.
  3. Nit, SlotGate.ts:225-226. In a caller that can be interrupted (usage, grant, the observer), an interrupt that arrives after forkDetach but before ensuring is installed leaves the detached read running until it finishes on its own. It is harmless, because the read is read-only and its result is dropped. Wrapping the fork and the join in one uninterruptibleMask (restore around the join) would close the gap.
  4. Nit, SlotGate.ts:503. running === undefined is now reached only when !counted. For that target the limits already have no machine or account count, so the stripping branch does nothing. You could drop it or add a comment.

705 SAFE; every failure of the count read refuses before any state is written, and no new bypass exists.

@scuttletoby

Copy link
Copy Markdown
Owner Author

Review B (state and tests) of #705 at 2e6b0eb: NOT SAFE

NOT SAFE. One blocking point, and the fix is small. Everything else holds up: the refusal is placed correctly, the state answers are right, and the tests are real. CI is green (26 pass, 12 skipped, none red).

Blocking

1. A slow store now piles up count reads. Before, only one ran at a time. apps/server/src/slots/SlotGate.ts:225, :249
Each readCount forks a new detached read. At the timeout it interrupts that read without waiting for it. A real read cannot stop at once. The reader worker is a single-threaded DatabaseSync with no way to cancel. Interrupting only drops the wait for the reply. The transaction's ROLLBACK then queues behind the running statement, and the reader slot is released only after it (packages/shared/src/nodeSqliteClient.ts, borrower/route). So every refused call leaves one read holding a reader slot until its statement ends. The next call, often a queued one that starts at once, forks another read.

  • Checked: I added a scratch test to SlotGate.test.ts using the PR's snapshotStuck read (a read that cannot be interrupted) and made six refused acquire() calls in a row. Result: 6 reads in flight at once (expected 6 to equal 1). On main, the caller waited for its read, so the gate never had more than one read going.
  • Effect: the real limit is READER_POOL_SIZE = 4. When a read takes longer than 5 s (exactly the slow store Slot gate: a failed shell read lets the delegation through (decide fail closed) #684 says to watch for), the gate's abandoned reads soon hold all four reader slots. Upstream's own read-only queries (shell stream, thread search, auth sessions and so on) then wait for admission. Slot-wait sweeps (grantLocked, :567) and observe mode use the same readCount, so they add reads too. The extra reads make each new read slower, so a store that sits near 5 s gets pushed over the limit and stays in refusal. Before this PR, a slow store made delegation slow but let it through, with one reader in use. Now delegation is refused, and the reader pool can be drained for the whole server.
  • Fix: keep at most one count read in flight. Store the detached fiber. If the previous read is still running, either join that same fiber with the timeout (a late answer can then serve the next caller, and starting entries still cover new starts), or refuse with the timeout text without forking a new one. Clear it when the read ends. Add a test like the one above: N refusals while one read is stuck give snapshotReads === 1, and the next call after it finishes reads again.

Major

None.

Minor

  1. Both Effect.interruptible wrappers are untested. SlotGate.ts:225-226
    Removing either one, or both, leaves all 59 tests green. So no test pins the "even inside an uninterruptible acquire" part of SlotGate.test.ts:456: the fork, the race and the semaphore already make the join interruptible here. The inner one may still matter for the real NodeSqliteClient.readOnly, which carries the caller's interruption policy to reader admission. Either drop the wrappers and their comment, or add a test that goes red without them.

  2. Untested refusal paths.

    • The timeout refusal is tested only at the gate. Through delegate_task, only the error case is tested (OrchestratorMcpService.slotGate.test.ts).
    • A refusal in observe mode with an unread count is untested. observeBeside still runs the rule beside it with today: ["refuse"] and reads the held slots (heldAt) for the rule.
  3. "Nothing is written on a refusal" is a little too broad. SlotGate.ts:545
    After a refusal, acquire still runs clearUsedLater, so a refused call can clear stored holds that an earlier good read used up (usedLater). That is correct and harmless, because the cleanup belongs to an earlier start. The new test only covers an empty usedLater, though. Change the PR text to say "writes nothing of its own".

  4. "A stuck store makes each delegation wait at most 5 s" is not true for concurrent callers. PR text and docs/fork/README.md:370
    decide runs under the gate's one-permit semaphore. With k callers waiting at once, the k-th waits about 5·k s before its refusal. Main behaves the same, so this is wording only. Point 1's fix doesn't change it unless the shared read also refuses at once while a read is in flight.

State question (checked)

  • Runs again: nothing is sticky. The retry reads afresh and is allowed. This is tested for an error, a timeout and through delegate_task.
  • Stopped half-way: the refusal comes before keepStarting, liveHeld, useUp, the token or unreadStarts, so a refusal leaves no half-done state. A late answer is dropped, which is tested.
  • Server restart: the gate keeps all its state in memory, and a refused call adds none of it.
  • Empty store: an empty list is a good read, tested.
  • Old wait store: its holds are kept on a refusal and used up once by the retry, tested.
  • Wait store that cannot be read: unchanged (memory only), and the refusal comes before it is read.
  • Target with no counted limit: nothing is read and nothing is refused, tested.

Tests, run locally in a temp worktree

  • PR head: 59/59 in src/slots/SlotGate.test.ts and src/mcp/OrchestratorMcpService.slotGate.test.ts.
  • main's SlotGate.ts: the six new tests fail, as the PR says. The two guard tests pass.
  • Removing each fix line:
Change Result
no if (count?.type === "unread") refusal (fail open) the 6 new tests red
no ensuring(interruptUnsafe) "…and is stopped" red
forkChild instead of forkDetach, or awaiting the read directly "a read that cannot be stopped…" red
timeout counted as error 2 red (exact timeout text)
a defect counted as a good read "a read that dies…" and the slot-wait unread test red
no Effect.interruptible (either or both) all green (minor 2)

A refused call no longer leaves a read of its own running. While a count
read runs, every caller that needs the count (delegations, slot waits,
wait_list, the observer) joins that one read with its own 5 s limit. The
marker is cleared when the read ends, whichever way, a late answer too.

A read that ends by an interruption is now a refusal in plain words:
"timeout" when a caller stopped it at the timeout, "error" when it
interrupted itself. A caller cut off while it waits leaves at once and
leaves the read to the next caller. The two Effect.interruptible wrappers
are gone: a forked fiber starts interruptible by default.

Tests: seven refused callers against a stuck read leave one read running
(7 on the old head), a cut-off caller, a joiner of a read stopped by
another caller, a read that interrupts itself, the timeout through
delegate_task, and a refusal in observe mode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@scuttletoby

Copy link
Copy Markdown
Owner Author

Fix: review rounds A and B, at 318f6e44

Blocking (B 1): at most one count read in flight

Choice: callers join the read that is running. I did not pick "refuse at once while a read runs", because wait_list, the observer and slot-wait sweeps read the count outside the delegation queue. A healthy 24 ms wait_list read would then refuse a delegation that arrived at the same moment. With joining, there is still only one read, so nothing piles up. A late answer also serves whoever joined it.

  • SlotGate.ts keeps one marker, inFlight (the read's fiber and stopped). sharedRead returns the running read or forks a new one, and sets the marker inside the same uninterruptibleMask, so a read can never run without the marker.
  • Each caller waits on that fiber (Fiber.await) with its own 5 s limit. At the timeout it stops the read (interruptUnsafe, not awaited) and refuses with the timeout text.
  • The marker is cleared by fiber.addObserver when the read ends, whichever way: an answer, a failure, a defect, an interruption, or a late answer after a timeout. So a read that has ended never refuses anyone. The real read (ActiveRunShells.read) is one read transaction, and its ROLLBACK finalizer runs before the fiber ends. So the marker stays set until the reader slot is free again, and the gate never holds more than one reader.
  • Test "a slow store: refused calls, at once or in a row, leave at most one read running": three acquires at once with a wait_list beside them, then three more in a row, against a read that cannot be interrupted. All are refused with the timeout text, snapshotReads === 1 and maxReadsInFlight === 1. After the read ends, the next call reads again (snapshotReads === 2) and is allowed. On the old head this test is red: one read for all seven callers: expected 7 to equal 1.

Minors

  • A 1, a read that interrupts itself: the read now ends in an Exit, which the gate maps. An interruption on its own becomes timeout if a caller stopped the read at the timeout, otherwise error. Test "a read that interrupts itself refuses in plain words": an uninterruptible acquire returns the plain error refusal. Red on the old head (Failure(Cause([Interrupt]))). Test "a read stopped at another caller's timeout refuses its joiner as a timeout": red if the stopped flag is removed.
  • B 2, the Effect.interruptible wrappers: dropped. A forked fiber starts interruptible by default (forkDetach forks with uninterruptible: false in effect 4.1.2), and the race fibers of timeout do too, so both wrappers were no-ops. That is why removing them changed nothing. The "even inside an uninterruptible acquire" test still pins the behaviour. The new restore around the wait is pinned by "a caller cut off while it waits leaves at once; the read goes on for the next". That test goes red without the restore, and it also shows a cut-off caller does not stop the shared read.
  • B 3, the untested refusal paths:
    • delegate_task with a thread list that does not answer: slots_full with the exact timeout text, nothing dispatched, and the same request then starts with a fresh read.
    • observe mode with a read that fails: the exact refusal. The rule beside it gets today: refuse, readings: failed. The next allowed call sees no start left by the refusal (pieces: 0).
    • Both are red on main. They are green on the old head, because they were missing tests, not bugs.
  • A 2 / B 5, the wording: the PR body and docs/fork/README.md now say that delegations go through the gate one at a time. With a stuck store, queued callers wait about 5 s each in turn (the third about 15 s) and are then refused, all sharing the one read.
  • B 4, "nothing is written": now "a refusal writes nothing of its own". The PR body and the docs name the one write that can still follow: acquire clears in the wait store the held slots that an earlier allowed call's good read used up (usedLater).
  • A 3, the interrupt gap between fork and ensuring: gone. The fork and the marker are set in one mask, and a caller that is cut off no longer stops the read, so there is nothing to miss.
  • A 4, running === undefined stripping: dropped. No count is read only when no count limit applies, so the stripping did nothing.

Checks

  • Old head's SlotGate.ts under the new tests: 4 red (the slow-store test, the cut-off caller, the joiner of a stopped read, and the self-interrupting read). The rest are green.
  • Mutations, each red:
    • marker never cleared: 6 red
    • timeout does not stop the read: 3 red
    • no stopped flag: 1 red
    • no restore: 1 red
  • Local runs:
    • src/slots, src/waits, src/mcp and src/fork: 81 files and 1435 tests pass.
    • Server typecheck and lint pass. The pre-commit fmt, lint and knip pass.

State question

  • Runs again: nothing is kept between reads except the marker of a read that is still running, and the marker goes when that read ends. Tested: after a late answer, after a stopped read, and after a self-interruption.
  • Stopped half-way: a caller cut off while it waits leaves at once and leaves the read to the next caller (tested). A read stopped at the timeout clears the marker when it really ends (tested with a read that cannot be interrupted).
  • Old, empty or missing state: an empty list is still a good read. After a restart the marker starts empty, because it is in memory only.

@scuttletoby

Copy link
Copy Markdown
Owner Author

Review round 2, lens A (correctness of the shared read), head 318f6e44: NOT SAFE

NOT SAFE. One blocking point, and the fix is small (a sketch is below; with it all tests and both probes pass). Everything else in the shared read holds up. CI on 318f6e44 is all green (28 pass, 14 skipped, none red). Local run in a temp worktree: src/slots and OrchestratorMcpService.slotGate.test.ts, 104/104 pass.

Blocking

1. A joiner can get an old answer, and a delegation can then go over the limit. apps/server/src/slots/SlotGate.ts:234-247, :274
A caller that joins takes the answer of whatever read is in flight, however long ago that read started. Every caller that waits stops the read at its own 5 s, so in most cases the read can't get old. But a caller that is cut off while it waits leaves without stopping the read (as designed, :252). usage (wait_list), grant from a slot wait's own request, and the observer can all be cut off. When that happens, nothing limits the read's age. A delegation that joins near the end gets a snapshot from before it arrived, and anything that started in the meantime is not counted:

  • a thread started another way (create_threads, t3_thread_launch, a scheduled run; these are counted but never refused);
  • a gated start whose starting entry has expired (liveStarting: startGraceMs after the dispatch ends, 30 s by default and settable down to 0).

Before this PR, a caller's count was never older than its own read, which was at most 5 s. On main, and on the round-1 head, every caller read afresh.

  • Probe (scratch test, not committed): with maxPerMachine: 1, the mock read takes its snapshot first and then waits (interruptibly) on a Deferred. At t=0 gate.usage starts the read (nothing running) and is cut off. At t=1 a thread other starts outside the gate. At t=40 acquire() joins, and the read answers at t=41. Result: allow (snapshotReads: 1), so two agents run with a limit of one. The same probe with main's SlotGate.ts: refuse.
  • This is the slow-store case Slot gate: a failed shell read lets the delegation through (decide fail closed) #684 is about (a read that takes more than 5 s), and it breaks the gate's main promise. That's why I rate it blocking, even though it needs a cut-off caller first.
  • Fix: record when the read started (startedAtMs in inFlight, taken with Clock just before the fork). Treat a success as { type: "unread", problem: "timeout" } when now - startedAtMs > COUNT_READ_TIMEOUT. That brings back the old limit (no count is ever older than 5 s) and keeps the one read in flight. I tried it locally: the 104 existing tests and both probes pass (106/106). Please add the probe above as a test. It goes red without the age check.

Major

None.

Minor

  1. Two reads can still start together across a scheduler yield. SlotGate.ts:236-239
    forkDetach returns the fiber, and only the next step (Effect.map) sets inFlight. The run loop can yield between the two (Scheduler.shouldYield, after MaxOpsBeforeYield ops, 2048 by default). uninterruptibleMask stops interruption but not yielding. A caller that runs during that yield sees inFlight === null and forks its own read. The first caller then overwrites the marker.
  • Probe: four concurrent gate.usage calls with Scheduler.MaxOpsBeforeYield set to 1 against a hung read: 4 reads in flight (expected 4 to equal 1). At the default it is rare (about one call in 2048 hits the yield point) and costs one extra read.
  • No stuck marker: each flight clears only itself (inFlight === flight), and each caller stops the read it got.
  • Fix: check again in the map. If inFlight !== null by then, call fiber.interruptUnsafe() (the fork was only scheduled, so it never runs) and return the existing flight. That check is in the sketch above, and it makes the probe green.
  1. The marker stays set for as long as the read never ends. Docs and PR text should say so. SlotGate.ts:241-243, docs/fork/README.md:374
    The marker is cleared only when the read fiber ends. With the real client, a stopped read ends only after its statement and the ROLLBACK, on the same reader worker. If that worker's statement runs for minutes, or never returns, every counted delegation is refused for that whole time, even when the other three reader workers are free. On the round-1 head a fresh read could go to another worker. This is the trade-off B 1 asked for, and it fails closed, so I'm not asking for a change. A sentence would help: "While a read that was stopped has not ended, delegations that need the count are refused (until it ends or the server restarts)."

What I checked and found correct

  • Marker cleared on every ending. addObserver runs at once for a fiber that has already ended, and otherwise synchronously in evaluate when the fiber ends, before any Fiber.await resumes. It's registered before any joiner's await, so a joiner never sees an ended read as in flight. Covered: answer, failure, defect, self-interruption, interruption at the timeout, and a late end.
  • Deadlock. The read never takes the gate's semaphore or the observer's lock. decide and grant hold the semaphore while they wait, but the wait is limited to 5 s, and the timeout stops the wait at once even inside the uninterruptible acquire: the timeout race fibers are forked interruptible, and Fiber.await drops its observer. No cycle.
  • Interruption of the first caller vs a joiner. A cut-off caller leaves through restore. Effect.catch does not catch interrupts, and it does not stop the read (tested). A caller that times out stops the read for everyone, and its joiners get timeout through stopped (tested; red without stopped). In an uninterruptible acquire, restore brings back "uninterruptible", and the timeout still fires (tested).
  • Every failure is a plain refusal with nothing started. Error, defect, timeout and self-interruption all map to unread. decide refuses before keepStarting, liveHeld, useUp, the token and the entries (:536-538). Cause.hasInterruptsOnly && stopped gives timeout; anything else gives error, never a bare interruption.
  • Staleness within healthy reads. A joiner of a read that took up to 5 s gets a snapshot at most 5 s old, as on main. Starting entries cover gated starts in that window: an entry is dropped only when the same snapshot shows its child, or after its grace. A child that shows a run in an old snapshot and has ended since is counted too high, which is the safe direction.
  • Nothing lost from round 1. No test was removed between 2e6b0eb5 and 318f6e44. The one rewritten step ("the next call is not blocked by the old read") now joins the read and is refused, as B 1 asked. Round-1 A 1, A 3 and A 4 are fixed as described in the Fix comment.
  • No upstream file changed (only apps/server/src/slots/, the fork's MCP slot gate test and docs/fork/README.md). Nothing personal in the diff or the commits.

705 NOT SAFE; a cut-off caller leaves the shared read with no age limit, and a delegation that joins it later can go over the limit on an old snapshot (probe: allow on this head, refuse on main). The fix is a start-time check.

@scuttletoby

Copy link
Copy Markdown
Owner Author

Review B round 2 (state, load and tests) of #705 at 318f6e44: SAFE

SAFE. The round-1 blocking point is fixed. On a real reader pool the gate now holds one database reader, not one per refused call. Every new test fails on round-1 head 2e6b0eb5 and passes now. Each fix line I removed turns a test red, except one mask that has no test (minor 1). CI is green: 26 pass, 12 skipped, none red. GitHub shows the branch as BEHIND main, and the merge queue will update it.

Blocking

None.

Major

None.

Re-measured: the slow store (round-1 blocking 1)

I wrote a scratch probe test, not committed. It runs the gate against a real NodeSqliteClient with reader and writer workers on a temp WAL file. The count read is one readOnly transaction whose statement takes about 17 s, a recursive CTE. The probe makes six wait_list usage reads and two acquires at once. At 5.5 s it runs one ordinary upstream-style readOnly SELECT, then waits for the slow statement to end, then calls acquire once more.

gate reads started most in flight upstream readOnly SELECT at 5.5 s after the slow read ends
round-1 head 2e6b0eb5 8 7 11 095 ms (all 4 reader slots taken) allowed
this head 318f6e44 1 1 27 ms allowed, 2nd read

So the answer is yes: the gate holds at most one database reader. On the real store, the marker stays set until the stopped statement and its ROLLBACK have ended. The probe shows it: inFlight stayed at 1 until about 16.8 s, then the next call read again. That matches the code. Effect.callback drops the wait at once. The withTransaction ROLLBACK finalizer queues behind the running statement. claimedUntilScopeCloses frees the reader slot before the fiber ends, and addObserver then clears inFlight. I also checked that addObserver in effect 4.1.2 calls back at once for a fiber that has already ended (FiberImpl.addObserver), so a read that ends before the marker is set cannot leave a stale marker.

Tests

  • Head: src/slots + OrchestratorMcpService.slotGate.test.ts, 4 files and 104/104 pass.
  • Round-1 head's SlotGate.ts under the new tests: 4 red, as the Fix comment says: the slow store (expected 7 to equal 1), the cut-off caller, the joiner of a stopped read, and the read that interrupts itself (Failure(Cause([Interrupt]))). The delegate_task timeout test and the observe-mode refusal test pass there too. They covered paths that had no test, not new behaviour.
  • Removing each fix line from SlotGate.ts:
Change Result
marker never cleared (:242) 16 red
no interruptUnsafe at the timeout (:263) 4 red, including the delegate_task timeout test
no stopped = true (:262) 1 red (joiner of a stopped read)
no restore around the wait (:257) 1 red (cut-off caller)
no joining: always fork a new read (:235) 3 red, including the slow store
marker cleared at the timeout instead of at the end 1 red (slow store: maxReadsInFlight)
an interruption on its own always counted as error 1 red
timeout counted as error 5 red
fail open (no count?.type === "unread" refusal) 12 red
no uninterruptibleMask around sharedRead + wait (:254) all 104 green (minor 1)

Every caller kind is bounded on a slow store

  • delegate_task (acquire under the semaphore): at most 5 s for its own wait, plus the time it queues behind earlier callers (about 5 s each, see minor 2). It refuses before it writes anything. A refusal in observe mode is tested too.
  • Slot-wait sweep (grantLocked, :612, under the semaphore): readRunning with the same 5 s limit, and it joins the shared read. It never grants on undefined, which is unchanged.
  • wait_list (usage, :727, outside the semaphore): 5 s, then null. It joins the shared read. The slow-store test and my probe show it starts no second read.
  • Observer (SlotObserver.run, :195): it runs off the decision path, behind its own lock with OBSERVE_MAX_WAITING = 4, and joins the shared read with the same 5 s limit. Its timeout can stop a read that a delegation joined later, which then refuses that delegation as timeout before its own 5 s are up. That is by design and tested ("…refuses its joiner as a timeout"), and it is still a true message about the read.

State question

  • Runs again: the only state between calls is the in-flight marker, and it goes when the read ends: after an answer, a failure, a defect, a self-interruption, or a late answer after a stop. All tested, and the real-store probe shows it.
  • Cut off half-way: a caller cut off while it waits leaves at once and does not stop the shared read (tested, red without restore). Refusals happen before keepStarting, useUp, the token and the entries, so there is nothing half-done.
  • Late answer: it serves whoever joined, and it is cleared afterwards. On the real store a read that was stopped always ends with an interruption, so a joiner of a stopped read always gets timeout, never a late answer.
  • Server restart: the marker is in memory only, so it starts empty. A detached read that is still running at shutdown ends when the reader pool stops its workers.
  • Empty or old store: an empty list is a good read (tested). An old wait store's holds are kept by a refusal and used up once by the allowed retry (tested). A wait store that cannot be read is unchanged.

Minor

  1. The uninterruptibleMask in readCount has no test. apps/server/src/slots/SlotGate.ts:254
    Replacing it with a plain call, with restore as identity, leaves all 104 tests green. The mask closes a real gap: when a caller can be interrupted (usage, the sweep, the observer), an interruption between forkDetach and the Effect.map that sets inFlight (:236-239) leaves a read running with no marker, so the next caller forks a second one. The gap is one scheduler step and the read is read-only, so this is not blocking. A deterministic test is hard, so a comment saying why the mask stays is enough.
  2. A joiner of a read that was already stopped still waits its full 5 s. SlotGate.ts:235, :256-268
    On the real store such a read can only end with an interruption, which this head maps to timeout. So its joiners wait 5 s for an answer that is already known. The probe shows it: the second delegation was refused at 10 s, not 5 s. The PR documents this ("the third one about 15 s"), it is bounded, and main behaves the same, so it needs no change here. A small follow-up would be to refuse at once with the timeout text when inFlight.stopped is set. It would still start no second read, and queued delegations on a stuck store would then cost about 5 s in total, not 5 s each.
  3. Nit: a joined answer can be older than 5 s when the read's starter was cut off. SlotGate.ts:256
    Each joiner starts its own 5 s from when it joins. If the starter is cut off, nobody stops the read at its start plus 5 s, so a later joiner can get a snapshot that is more than 5 s old. That would matter only if the snapshot were older than the start grace, which defaults to 30 s, and a slow delegated child became visible inside that window. Measuring the limit from the read's start (flight.startedAt + COUNT_READ_TIMEOUT) would cap both the staleness and minor 2's queue time. Not needed for this PR.

705 SAFE; one count read in flight on a real reader pool (1 reader vs 8 on the old head, upstream reads unaffected), all new tests red on 2e6b0eb and mutation-checked, every caller bounded, CI green.

scuttletoby and others added 2 commits November 21, 2026 02:24
…at a time

A delegation that joined a shared count read whose starter was cut off could get a
snapshot from long before it arrived and go over the limit. The gate now records when
the read started; an answer later than COUNT_READ_TIMEOUT after that start is a timeout
refusal, as on main where no count was older than its own 5 s read.

The check and the setting of the in-flight marker now run under their own lock, so a
scheduler yield between the fork and the marker cannot start a second read. A test
pins the uninterruptible mask around the shared read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@scuttletoby

Copy link
Copy Markdown
Owner Author

Fix: round 2 review A (blocking 1, minors 2 and 3) and review B (minor 1), at 0d76ebce

Commit 5fe6c310 holds the fix. 0d76ebce merges main, because GitHub showed the branch as behind. There is no rebase and no force push.

A 1, blocking: a joined answer is never older than the 5 s limit

  • Change: apps/server/src/slots/SlotGate.ts:234-279. inFlight now also holds startedAtMs, read with Clock just before the fork. In readCount, a success that arrives more than COUNT_READ_TIMEOUT after that start counts as { type: "unread", problem: "timeout" }. It goes through the same warning and the same plain timeout refusal as a read that timed out, so nothing is started and nothing is written.
  • Why here: readCount is shared by every caller. A slot-wait grant, wait_list and the observer therefore never use an old count either: a grant stays waiting and usage shows null. Both are the safe direction. On main, every caller read afresh, so no count was ever older than 5 s. That limit is back, and there is still only one read in flight.
  • Test: "a joined answer older than the read limit refuses: a cut-off starter leaves no old count". This is A's probe, with maxPerMachine: 1:
    • At 0 s, wait_list starts the read, which takes its snapshot (nothing running) and then waits. The wait_list call is cut off.
    • At 1 s, a thread starts outside the gate.
    • At 40 s, a delegation joins, and the read answers at 41 s.
    • Result: refused with the exact timeout text, snapshotReads === 1.
    • Runs again: a fresh read counts the other thread, and the next call is refused as "No free agent slot".
    • Red on 318f6e44: expected refuse, got allow.

A 2, minor: a scheduler yield could start a second read

  • Change: SlotGate.ts:233-252. The check of inFlight and the setting of the marker now run under their own Semaphore.make(1) (startLock). A caller that runs during a yield between the fork and the marker waits for the lock, which is held for a few steps only. It then finds the marker and joins. This does not touch the gate's main semaphore. I did not use A's check-again-and-interrupt idea: a fork that is already scheduled can run before it is interrupted, so a second read could still start briefly.
  • Test: "callers that yield between every step still start only one read". Four concurrent gate.usage calls run with Scheduler.MaxOpsBeforeYield set to 1 against a hung read. Result: maxReadsInFlight === 1 and snapshotReads === 1. All four give null at the timeout.
    • Red on 318f6e44: one read for four callers: expected 4 to equal 1.

B 1, minor: a test now pins the uninterruptibleMask

  • Kept: the mask does real work. Without it, a caller cut off between the fork and the marker leaves a read running that the next caller cannot see. The comment at SlotGate.ts:254-259 now says so.
  • Test: "a caller cut off at any step leaves no read without its marker". With MaxOpsBeforeYield set to 1, the first usage call is cut off after each of 0 to 39 steps in turn. Then a second usage call runs. Result: maxReadsInFlight <= 1 every time.
    • Without the mask: red, cut off after 22 steps: expected 2 to be at most 1.
    • It is green on 318f6e44 too, because that head already had the mask. The test was missing, not the fix.

A 3, minor: the docs

docs/fork/README.md (server.agentSlots) now has two more sentences:

  • "An answer that comes more than 5 s after its read started is not used, so no count is older than that."
  • "While a read never ends, delegations that need the count are refused even if other database readers are free, until it ends or the server restarts."

Checks

  • Old head's SlotGate.ts under the new tests: 2 red (the late answer and the yields). The mask test is green, as explained under B 1.
  • Mutations, each red:
    • no age check: the late-answer test is red
    • no startLock: the yields test is red
    • no mask (restore is the identity): the cut-off sweep is red
  • Local runs:
    • after the merge with main: src/slots, src/waits, src/mcp and src/fork, 82 files and 1452 tests pass
    • vp run check:changed passes (format, lint, knip, typecheck, tests)
    • fork-seam-check.cjs --config-ref origin/main origin/main HEAD passes
    • the pre-commit hook passes

State question

  • Runs again: after a late answer is refused, the marker goes with the read, and the next call reads afresh (tested in the late-answer test). The lock holds no state between calls.
  • Stopped half-way: a caller cut off at any step, before, inside or after the start, leaves either no read or a read with its marker. It never leaves a read without one (tested). A caller cut off while it waits for startLock holds nothing.
  • Old, empty or missing state: an answer older than 5 s is treated as no count, as on main. startedAtMs is in memory only, so after a restart there is no old read and no marker. An empty list is still a good read (an existing test).

@scuttletoby

Copy link
Copy Markdown
Owner Author

Orchestrator check of fix round 3 (5fe6c31, merged with main as 0d76ebc): SAFE. No third lens round (cap of two).

  • Round-2 lens A blocking: fixed. readCount treats a success that arrives more than COUNT_READ_TIMEOUT after flight.startedAtMs as a timeout, so a joiner can never use a count older than 5 s. A's probe is pinned by a test that is red on 318f6e4.
  • Fork/marker race: fixed. Check-and-set of inFlight runs under startLock (one permit), which is held only while the read is forked, not while it runs. Pinned by the yield test.
  • uninterruptibleMask: kept on purpose and now pinned by the cut-off-at-any-step test.
  • Fix commit touches only SlotGate.ts, its test and docs/fork/README.md. The merge brings in main only.

Minor, not fixing: a delegation that joins a read late (for example at 4.9 s) is refused if the answer comes after 5 s from the read's start, even though its own wait was short. That is the fail-closed direction #684 chose.

🤖 Generated with Claude Code

@scuttletoby
scuttletoby merged commit bda2262 into main Nov 21, 2026
40 checks passed
scuttletoby added a commit that referenced this pull request Nov 21, 2026
…705)

* Slot gate: a thread list that cannot be read refuses the delegation

When a delegation needs the running-agent count and the slot gate cannot
read it (upstream's shell read fails, crashes, or takes longer than the
5 s read timeout), the gate now refuses with slots_full instead of
letting the call through on the free-memory floor alone. The message
says the thread list could not be read (error or timeout), that no agent
was started, and that the caller can try again in a moment.

The read now runs in its own fiber that is stopped, not awaited, at the
timeout, so a read that cannot stop at once no longer keeps the refused
call (or the gate's semaphore) waiting. A refused call records nothing:
no starting entry, no held slot used up, no store write.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: at most one count read in flight; callers join it

A refused call no longer leaves a read of its own running. While a count
read runs, every caller that needs the count (delegations, slot waits,
wait_list, the observer) joins that one read with its own 5 s limit. The
marker is cleared when the read ends, whichever way, a late answer too.

A read that ends by an interruption is now a refusal in plain words:
"timeout" when a caller stopped it at the timeout, "error" when it
interrupted itself. A caller cut off while it waits leaves at once and
leaves the read to the next caller. The two Effect.interruptible wrappers
are gone: a forked fiber starts interruptible by default.

Tests: seven refused callers against a stuck read leave one read running
(7 on the old head), a cut-off caller, a joiner of a read stopped by
another caller, a read that interrupts itself, the timeout through
delegate_task, and a refusal in observe mode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: no joined count older than the read limit; one read start at a time

A delegation that joined a shared count read whose starter was cut off could get a
snapshot from long before it arrived and go over the limit. The gate now records when
the read started; an answer later than COUNT_READ_TIMEOUT after that start is a timeout
refusal, as on main where no count was older than its own 5 s read.

The check and the setting of the in-flight marker now run under their own lock, so a
scheduler yield between the fork and the marker cannot start a second read. A test
pins the uninterruptible mask around the shared read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
…705)

* Slot gate: a thread list that cannot be read refuses the delegation

When a delegation needs the running-agent count and the slot gate cannot
read it (upstream's shell read fails, crashes, or takes longer than the
5 s read timeout), the gate now refuses with slots_full instead of
letting the call through on the free-memory floor alone. The message
says the thread list could not be read (error or timeout), that no agent
was started, and that the caller can try again in a moment.

The read now runs in its own fiber that is stopped, not awaited, at the
timeout, so a read that cannot stop at once no longer keeps the refused
call (or the gate's semaphore) waiting. A refused call records nothing:
no starting entry, no held slot used up, no store write.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: at most one count read in flight; callers join it

A refused call no longer leaves a read of its own running. While a count
read runs, every caller that needs the count (delegations, slot waits,
wait_list, the observer) joins that one read with its own 5 s limit. The
marker is cleared when the read ends, whichever way, a late answer too.

A read that ends by an interruption is now a refusal in plain words:
"timeout" when a caller stopped it at the timeout, "error" when it
interrupted itself. A caller cut off while it waits leaves at once and
leaves the read to the next caller. The two Effect.interruptible wrappers
are gone: a forked fiber starts interruptible by default.

Tests: seven refused callers against a stuck read leave one read running
(7 on the old head), a cut-off caller, a joiner of a read stopped by
another caller, a read that interrupts itself, the timeout through
delegate_task, and a refusal in observe mode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: no joined count older than the read limit; one read start at a time

A delegation that joined a shared count read whose starter was cut off could get a
snapshot from long before it arrived and go over the limit. The gate now records when
the read started; an answer later than COUNT_READ_TIMEOUT after that start is a timeout
refusal, as on main where no count was older than its own 5 s read.

The check and the setting of the in-flight marker now run under their own lock, so a
scheduler yield between the fork and the marker cannot start a second read. A test
pins the uninterruptible mask around the shared read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
…705)

* Slot gate: a thread list that cannot be read refuses the delegation

When a delegation needs the running-agent count and the slot gate cannot
read it (upstream's shell read fails, crashes, or takes longer than the
5 s read timeout), the gate now refuses with slots_full instead of
letting the call through on the free-memory floor alone. The message
says the thread list could not be read (error or timeout), that no agent
was started, and that the caller can try again in a moment.

The read now runs in its own fiber that is stopped, not awaited, at the
timeout, so a read that cannot stop at once no longer keeps the refused
call (or the gate's semaphore) waiting. A refused call records nothing:
no starting entry, no held slot used up, no store write.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: at most one count read in flight; callers join it

A refused call no longer leaves a read of its own running. While a count
read runs, every caller that needs the count (delegations, slot waits,
wait_list, the observer) joins that one read with its own 5 s limit. The
marker is cleared when the read ends, whichever way, a late answer too.

A read that ends by an interruption is now a refusal in plain words:
"timeout" when a caller stopped it at the timeout, "error" when it
interrupted itself. A caller cut off while it waits leaves at once and
leaves the read to the next caller. The two Effect.interruptible wrappers
are gone: a forked fiber starts interruptible by default.

Tests: seven refused callers against a stuck read leave one read running
(7 on the old head), a cut-off caller, a joiner of a read stopped by
another caller, a read that interrupts itself, the timeout through
delegate_task, and a refusal in observe mode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: no joined count older than the read limit; one read start at a time

A delegation that joined a shared count read whose starter was cut off could get a
snapshot from long before it arrived and go over the limit. The gate now records when
the read started; an answer later than COUNT_READ_TIMEOUT after that start is a timeout
refusal, as on main where no count was older than its own 5 s read.

The check and the setting of the in-flight marker now run under their own lock, so a
scheduler yield between the fork and the marker cannot start a second read. A test
pins the uninterruptible mask around the shared read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 28, 2026
…705)

* Slot gate: a thread list that cannot be read refuses the delegation

When a delegation needs the running-agent count and the slot gate cannot
read it (upstream's shell read fails, crashes, or takes longer than the
5 s read timeout), the gate now refuses with slots_full instead of
letting the call through on the free-memory floor alone. The message
says the thread list could not be read (error or timeout), that no agent
was started, and that the caller can try again in a moment.

The read now runs in its own fiber that is stopped, not awaited, at the
timeout, so a read that cannot stop at once no longer keeps the refused
call (or the gate's semaphore) waiting. A refused call records nothing:
no starting entry, no held slot used up, no store write.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: at most one count read in flight; callers join it

A refused call no longer leaves a read of its own running. While a count
read runs, every caller that needs the count (delegations, slot waits,
wait_list, the observer) joins that one read with its own 5 s limit. The
marker is cleared when the read ends, whichever way, a late answer too.

A read that ends by an interruption is now a refusal in plain words:
"timeout" when a caller stopped it at the timeout, "error" when it
interrupted itself. A caller cut off while it waits leaves at once and
leaves the read to the next caller. The two Effect.interruptible wrappers
are gone: a forked fiber starts interruptible by default.

Tests: seven refused callers against a stuck read leave one read running
(7 on the old head), a cut-off caller, a joiner of a read stopped by
another caller, a read that interrupts itself, the timeout through
delegate_task, and a refusal in observe mode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: no joined count older than the read limit; one read start at a time

A delegation that joined a shared count read whose starter was cut off could get a
snapshot from long before it arrived and go over the limit. The gate now records when
the read started; an answer later than COUNT_READ_TIMEOUT after that start is a timeout
refusal, as on main where no count was older than its own 5 s read.

The check and the setting of the in-flight marker now run under their own lock, so a
scheduler yield between the fork and the marker cannot start a second read. A test
pins the uninterruptible mask around the shared read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 28, 2026
…705)

* Slot gate: a thread list that cannot be read refuses the delegation

When a delegation needs the running-agent count and the slot gate cannot
read it (upstream's shell read fails, crashes, or takes longer than the
5 s read timeout), the gate now refuses with slots_full instead of
letting the call through on the free-memory floor alone. The message
says the thread list could not be read (error or timeout), that no agent
was started, and that the caller can try again in a moment.

The read now runs in its own fiber that is stopped, not awaited, at the
timeout, so a read that cannot stop at once no longer keeps the refused
call (or the gate's semaphore) waiting. A refused call records nothing:
no starting entry, no held slot used up, no store write.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: at most one count read in flight; callers join it

A refused call no longer leaves a read of its own running. While a count
read runs, every caller that needs the count (delegations, slot waits,
wait_list, the observer) joins that one read with its own 5 s limit. The
marker is cleared when the read ends, whichever way, a late answer too.

A read that ends by an interruption is now a refusal in plain words:
"timeout" when a caller stopped it at the timeout, "error" when it
interrupted itself. A caller cut off while it waits leaves at once and
leaves the read to the next caller. The two Effect.interruptible wrappers
are gone: a forked fiber starts interruptible by default.

Tests: seven refused callers against a stuck read leave one read running
(7 on the old head), a cut-off caller, a joiner of a read stopped by
another caller, a read that interrupts itself, the timeout through
delegate_task, and a refusal in observe mode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: no joined count older than the read limit; one read start at a time

A delegation that joined a shared count read whose starter was cut off could get a
snapshot from long before it arrived and go over the limit. The gate now records when
the read started; an answer later than COUNT_READ_TIMEOUT after that start is a timeout
refusal, as on main where no count was older than its own 5 s read.

The check and the setting of the in-flight marker now run under their own lock, so a
scheduler yield between the fork and the marker cannot start a second read. A test
pins the uninterruptible mask around the shared read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 29, 2026
)

* Project null settings: file encode drops a null; explain the split and the save step's clear (#654) (#662)

- nullReadsAsUnset: encode drops a null too, so no future path can write
  one back to the settings file. The patch keeps its own schema, so a
  client's clear still sends its null.
- splitForkSettingsPatch: the comment says the left-out key is removed by
  upstream's merge only, and that the fork's server save must get the
  unsplit patch to see the clear.
- keepLeftOutForkProjectKeys: the null half of the clear branch stays, so
  the step is right on its own; a test pins it (it was an equivalent mutant).

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Announce the MCP carry call that passes the launch's instance (#668)

The carry call in RemoteDelegation passes the launch's scope, target and
instance, so the sender can refuse a narrower profile to an instance whose
driver does not apply one. Announced here; the pull request for #661 moves
it to "added" and drops the old call line.

Part of #661

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Move the slot gate's active-run read out of ProjectionStore (#663)

The slot gate counted running agents with a fork option on upstream's
ProjectionStore.getShellSnapshot (activeRunOnly). That read now lives in
the fork file apps/server/src/slots/ActiveRunShells.ts: one read-only
transaction finds the threads with a run in an active status (index
scan), reads upstream's shells of just those threads, and keeps the ones
whose shell shows an active run. ProjectionStore.ts and
ThreadManagementService.ts are back to upstream, so their pending
ceilings and lost counts leave .github/fork-seams.json in this same
change (the seam check needs a ceiling lowered with its lines).

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Announce the quiet handoff run's ProjectionStore seam lines (#665)

* Move the slot gate's active-run read out of ProjectionStore

The slot gate counted running agents with a fork option on upstream's
ProjectionStore.getShellSnapshot (activeRunOnly). That read now lives in
the fork file apps/server/src/slots/ActiveRunShells.ts: one read-only
transaction finds the threads with a run in an active status (index
scan), reads upstream's shells of just those threads, and keeps the ones
whose shell shows an active run. ProjectionStore.ts and
ThreadManagementService.ts are back to upstream, so their pending
ceilings and lost counts leave .github/fork-seams.json in this same
change (the seam check needs a ceiling lowered with its lines).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Announce the quiet handoff run's ProjectionStore seam lines

List-only: names the three lines the next change adds to upstream's ProjectionStore.ts, so the
thread shell reads a completed quiet handoff run as a stopped run in both its reads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Quiet handoff run: no browser notice (#666)

A completed quiet handoff run now shows in the thread shell as upstream's
stopped run (latestRunStopRequested), in both of the shell's reads: the
JavaScript one (threadShellFromProjection) and the SQL one
(selectShellThreadRows, which the shell and awareness snapshots use). So
the browser's ThreadNotificationCoordinator keeps upstream's quiet gate
unchanged and gives no notice, as the relay already did.

The rule lives in the fork file fork/handoff/handoffShell.ts
(isQuietHandoffRun moved there from handoffQuiet.ts, which imports
ProjectionStore and so cannot be imported by it), with its SQL mirror.
ProjectionStore.ts gets three seam lines: the import, a spread after
upstream's latestRunStopRequested, and the SQL fragment before
upstream's stop-request EXISTS.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(model-guard): drop an inherited agent option; compare Claude levels with T3's model list (#660)

* fix(model-guard): drop an inherited agent option; compare Claude levels with T3's model list

A delegate_task or create_threads pick that names its model no longer
inherits the parent's OpenCode `agent` or Kiro `mode` option: the fork's
delegation checks drop it on a fresh dispatch (a retry passes untouched),
unless the call names the option itself. The model guard never sees an
inherited option, so it could not refuse it.

The self-check now compares each claudeAgent row's efforts with the
levels T3's model list offers the model (and ultracode when the model has
the ultracode option). A level the model does not offer, a model with no
option list, an unreadable list or no list named is a problem; a model not
in the list is a note. A contract test keeps the server's agent option ids
and the guard's list in step.

Fixes #643

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* model guard follow-ups: a child keeps only the options its call names

While a model policy is on (server setting modelPolicy, advise or enforce),
a call that names its model keeps from the parent only the options the call
names, on every launch path: local delegate_task (both seats, and the target
the usage pacer moves to), create_threads, and remote delegate_task. One
shared rule (ownOptions in fork/delegateChecks.ts) replaces the list of agent
option ids. A call that names no model, a retry of an accepted call, and every
call with the policy off keep upstream's inheritance, so upstream's own
inheritance tests stay as they are. An unreadable setting applies the rule.

The tests move out of upstream's OrchestratorMcpService.test.ts into
fork/delegateOwnOptions.test.ts; OrchestratorMcpService.ts loses a fork line
(pending ceiling 35 -> 34).

Self-check: T3's model match order (exact slug, then the first alias), an
ultracode choice stands for xhigh, only a select offers levels, and a model
list that names none of the policy's models is reported. README fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* model guard follow-ups: keep modelPolicy.ts as on main

Its header comment is not a seam line; the docs say what reads the setting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Refuse a narrower MCP profile to a non-Claude instance; one settings fallback (#669)

* Announce the MCP carry call that passes the launch's instance

The carry call in RemoteDelegation passes the launch's scope, target and
instance, so the sender can refuse a narrower profile to an instance whose
driver does not apply one. Announced here; the pull request for #661 moves
it to "added" and drops the old call line.

Part of #661

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Refuse a narrower MCP profile to a non-Claude instance; one settings fallback

A remote delegation with a profile narrower than all now asks the linked
machine's orchestrator_capabilities which driver the launch's instance runs,
and refuses before sending unless it is Claude, the only provider that applies
a profile there. Under either value of the receiver's mcpCarriedProfiles.

Claude turns, a delegation's check of its own profile and the features route
read MCP profile settings the same way: settings.json is checked on each read,
and one that does not decode (also one broken at load, or with legacy keys the
load refuses) reads mcpCarriedProfiles as refuse, the policy's locks on top.
Only "apply" reads as apply; any other value reads as refuse.

Refusals say more: an unreadable carried profile no longer advises apply, and
a sub-agent's refusal names the reason at the top of the chain once.

Fixes #661

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Seam list: the carry line is added now, not announced

The merge of main (with #668's announcement) left the line in both
"added" and "announced", which the seam check refuses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: scuttletoby <[email protected]>

* Wait on the stored renewedAt, not the renew's finished line (#673)

A renew step logs `finished|renew` before it exits, and the service
stores renewedAt only after the process returned and it got the lock.
The thread-read-hangs test waited for the second finished line and then
read renewedAt, so it could read before the store write (CI flake).

- renewedSince(): waits on the stored renewedAt (set, and past a given
  earlier value); used by every renew test that read the session after
  waiting on the finished line.
- The failing-renew lapse test waits on the stored problem (a different
  exit code per try), not on the finished line.
- runnerControl.holdNextReturn holds a step's answer after its process
  exited; a new test uses it to show the finished line is there while
  renewedAt is not stored, that a sweep meanwhile starts no second
  renew, that a T3 stopped there stores no renew, and that a T3 started
  after the write reads the same renewedAt.

Fixes #671

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Fork CI contract: list-driven test steps, hidden exit status, shard warning and file-mode checks (#646) (#655)

* Fork CI contract: list-driven test steps, hidden exit status, shard warning and file-mode checks (#646)

- quiet contract: every test .github/fork-ci-tests.txt lists as run by
  fork-tests.yml must be run by a step's own command (python3, node or bash
  with the test's path as an argument). A fork test step may not have an if:,
  a working-directory, a shell other than bash, cd/pushd, trap, set +e/+o, a
  pipe, ||, a background &, or anything but its own command on the test's line.
- fork-ci-tests.cjs plan(): a runner file's comment lines no longer name a test.
- main() takes a fake runTest and clock; a test pins the ::warning:: line, the
  summary's Slow line and the 60 s boundary.
- pc-agents tests compare files by kind, mode, owner and content
  (same_files()), with a check that a mode change is seen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Fork CI contract: test steps held to an allowlist, comment-proof plan(), group in same_files()

A step that runs tests is now held to an allowlist instead of a blocklist of
shell tricks: its run is only lines of the allowed test forms, its keys, env
and if: come from a fixed set, its job has no defaults, env or container and
no step that writes GITHUB_ENV or GITHUB_PATH, and the workflow has no
defaults or env. Each listed test must be run whole, with the variable that
switches it on. fork-tests.yml moves its set-up lines into steps of their own.

plan() also drops trailing and block comments, readList spells `run by`
paths one way, same_files() compares the group, and the lint-flagged issue
numbers are gone from the test comments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Fork CI contract: runner parts from the accepted lines, sudo env only for root tests, string-aware plan()

- The check that each listed or present test is in exactly one runner part moves into the contract and reads the
  runner calls from the same parsed, accepted test lines (YAML parsed, quotes removed), job by job, with the
  runner's own inPart. A call kept in a YAML comment, a step name or a comment line counts for nothing. The
  raw-text reader in fork-ci-tests.test.cjs is gone.
- `sudo env` is accepted only before python3 and only for the tests REQUIRED_VARS marks as testing as root.
- plan() reads a JS/TS runner file with a small tokeniser (strings, template literals with nested ${}, regular
  expressions), so `'**/*'` in upstream's release-smoke.ts starts no comment.
- A step is a test step only by its code lines; a refusal says what made it one; a trailing # comment gets its
  own reason; "names a test but runs none" names the allowed forms; the docstring matches the rules.
- setup.test.py says when the group part of the killed-upgrade self-check is skipped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Fork CI tests: jsCode's comment within the 4-line limit

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* pr-queue: notify_command runs once per notice on an armed PR it passes over (#129) (#674)

* pr-queue: notify_command runs once per notice on an armed PR it passes over (#129)

An armed PR that goes red, gets stuck or conflicts is told on the PR, but
nobody with GitHub notifications off learns of it. A new optional config key
notify_command (argv, no shell) runs right after the queue posts such a
notice, with repo, PR, head, kind, reason and link. The posted comment is
the record, so later runs, restarts and other runners never run it again
for the same head and reason. A missing, failing or hanging command
(notify_timeout_seconds, default 30, then its session is killed) is a
warning and never holds the queue. The command gets no token.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* pr-queue notify: say the command is not a sandbox

The command's own environment holds no token, but it runs as the queue's
user, so it can read the queue's environment through /proc and the
checkout's saved token. Say so in the README and release notes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Slot gate: pre-select can no longer drop a running agent (#676)

The gate's pre-select copied upstream's active run statuses, so a status
upstream adds or starts to count as active would drop those agents from
the count with no test going red. It now leaves out only upstream's
finished statuses (isTerminalRunStatus) and lets upstream's own shell read
decide by activeRunId. A test walks every run status against upstream's
shell read. If upstream renames the run status index, the read logs an
error once and counts without it instead of failing and letting every
delegation through. A file-database test covers the reader path.

Also: drop quietHandoffAwareness (the shell already carries the quiet
handoff mark, one rule in handoffShell.ts), and note under the handoff
Limits that a browser offline across the turn end misses that notice.

Fixes #670

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Announce the MCP profile turn check's server.ts seam line (#677)

Lists the one server.ts line that wires fork/mcpProfileTurnCheck.ts
(the next pull request, for #672) under "announced", and says in the
entry's "why" what it changes.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Fleet walls: follow-ups from #649's reviews (#667)

* Fleet walls: follow-ups from #649's reviews

start gives systemd-run until START_BY (80 s after the launcher began)
and checks Type=exec, so a Type= drop-in that keeps systemd-run waiting
is killed and refused instead of outliving the agent's limit unchecked.
kill_unit keeps the kill's exit status and says "killed" only once the
unit is inactive or failed with no cgroup left. The not-found skip also
needs ActiveState=inactive and no cgroup. job_etc refuses any entry
already at the target before the write. The walls' mounts message puts
the way out before the paths. More DHCP lease folders are refused. A
link named private under /etc is not followed. span_ms has one guard,
with a test; the two-way never() list test also checks the die count
and every $1 line's shape.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Fleet launcher: kill what a failed systemd-run started; shellcheck in CI (#667)

Fix round for #667's two reviews (#656 follow-ups):
- start: a systemd-run that fails (any exit but the deadline) has its unit
  killed and checked like a deadline miss; "nothing started" only once the
  unit is inactive or failed with no cgroup and its runner user has no
  process left (older systemd lets the cgroup go anyway). Exit 137 is the
  deadline too; never `timeout 0`: under START_MIN (10 s) left, nothing
  starts.
- kill_unit: each systemctl call bounded (CALL_MAX 5 s, none past KILL_BY
  92 s); reads with `show --all`; says "gone" when there was nothing to kill.
- walls: a link named private under /etc makes what it leads to secret,
  not the folders above it.
- job_fs: the folders on the way to a view link are 0755 (mkdir -p -m set
  only the last one, under umask 077).
- CI: shellcheck (pinned, checksummed) on the launcher in the workflows job.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork CI: fleet test weight ~136s (it grew with #667's launcher tests) (#685)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Slot gate pre-select: no forced index; one-transaction and fail-fast reader tests (#678) (#683)

- The pre-select names no index. SQLite picks upstream's (thread_id, status)
  index on its own; a renamed, dropped or partial index now only slows the read.
  Before, a partial index under the same name failed the read ("no query
  solution") and the gate stopped counting. The existence lookup, the error
  log and its flag are gone.
- Tests: the query plan uses the index before and after ANALYZE; the count
  holds with the index dropped, renamed or made partial; a write committed
  between the id read and the shell read is not seen (one state); the reader
  test fails in 10 s with a message instead of a 120 s hang.
- Docs: what an index change and a failed upstream read do.

Fixes #678

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Refuse a narrowed MCP profile at turn start on a provider that cannot apply it (#679)

* Refuse a narrowed MCP profile at turn start on a provider that cannot apply it

A thread whose MCP profile is narrower than "all" no longer starts (or
resumes) a turn on Codex or any other provider but Claude, which would
give it every MCP server and T3 tool. The check runs on the machine that
runs the turn, as it starts, by wrapping upstream's provider instance
registry (fork/mcpProfileTurnCheck.ts, one server.ts line), so every
route is covered: a provider switch, t3_thread_launch, a local
delegation and a task from an older sender.

Also: a remote delegation that names a driver asks the other machine's
provider list once; doc comments moved above the code they describe;
the README says null reads as apply for mcpCarriedProfiles.

Fixes #672

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profile turn check: keep sessions live, look up named remote instances

- Wrap each non-Claude instance, adapter and session runtime in a
  delegating proxy instead of an object spread, so getters such as
  providerSession stay live for every thread, profile all included.
- Check compactThread as well as startTurn and resumeTurn: some
  providers compact by sending a /compact prompt.
- Remote carry asks the remote for its instance list unless no instance
  is named; a named instance the remote does not list is refused again.
- Allow fork/mcpProfileTurnCheck.ts in the startTurn path test.
- Boot test pins the layer's position: the orchestration layer's
  adapter registry and runtime policy read instances through the check.
- Tests: live getters for each runtime shape and driver, servers=all
  with fewer T3 tools refuses, refusal text names no retry, unlisted
  named remote instance refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* pr-queue notify: review follow-ups (#675) (#680)

* pr-queue notify: review follow-ups (#675)

- Both checkouts of the reusable workflow set persist-credentials: false,
  so no job token sits in the workspace the command can read. The README
  says plainly that the command still runs as the queue's user and can read
  the queue's start-up environment through /proc.
- A command that runs too long is stopped with its session and every process
  still linked to it by parent, so a child in its own process group or
  session (coreutils timeout, setsid) goes too. The README names the
  runner's end-of-job cleanup as the backstop for an orphaned daemon.
- The command's output is echoed between ::stop-commands:: and a random
  resume token: the runner reads ##[cmd] anywhere in a line, so the prefix
  alone did not stop that form.
- All notify commands of one run share a 300 s budget; once spent, a notice
  runs nothing (a warning), so slow notices cannot reach the job limit.
- No temp file for the output is a warning, not the end of the run.
- The link is kept only when it is a page of this repository on
  https://github.com/, else the PR page.
- README: a deleted queue comment or a new write-token login runs the
  command once more for every PR passed over, as one burst.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* pr-queue notify: drop checkout tokens by step, review minors (#675)

The reusable workflow no longer sets persist-credentials: false (its cleanup
runs git submodule foreach, which exits 128 on a repository with gitlinks and
no .gitmodules; the contract test forbids it). A step after both checkouts
removes what actions/checkout saved and fails unless nothing is left.

notify: without /proc the command's process group is still killed; workflow
commands are turned back on even if printing its output fails; the link must
be printable ASCII with no dot segments or encoded slashes; a spent budget
posts nothing, so the next run tells it; an unreadable output is no longer
called "could not start".

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* pr-queue README: format the Notify argument table

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* heavy: clean up everything a command started; heavy leftovers names the rest (#687)

heavy now removes its own scope's leftovers on every end:
- a scope guard (a small setsid child that holds no queue ticket) stops the
  scope and removes its containers when heavy itself is killed, even with -9;
- containers a command starts with the heavy owner label are removed when the
  command ends, is stopped or heavy is killed; a kept scope keeps them;
- a command whose parent died is refused at once (double-forked children are
  stopped with the scope).

`heavy leftovers [--older-than AGE] [--json]` looks only: it names processes,
scopes and containers older than a limit, by owner and age, with default rules
when there are no sweep settings. It never stops anything.

Tests cover a killed heavy, a double-forked child, a container started by a
command, a kept scope, missing or stopped Docker, and a rerun after a kill.

Fixes #159

Co-authored-by: Claude Opus 5.5 <[email protected]>

* secret sweep: one cat-file for all tips, no lazy fetch (#637) (#686)

* secret sweep: one cat-file for all tips, no lazy fetch (#637)

The sweep of 11-20 hit the scan job's 30-minute limit before the scan
script started. #539 added a loop that ran `git cat-file -e` once per tip
the activity record lists (about 1500), with lazy fetching on. In the
blob-less checkout each tip the clone lacked (about 400) was then lazily
fetched with no negotiation: the whole commit and tree history again,
about 36 MB each time, as a new pack. And every lookup of a missing
commit reads every promisor pack, so each later check got slower. Measured
against this repository: 3 s per tip from a fresh clone, 34 s after 30
packs.

The loop now checks all tips in one `git cat-file --batch-check` with
GIT_NO_LAZY_FETCH=1 (a failed check fails the job), fetches the tips it
lacks in one batch, and goes one by one only when the batch fails (a
gone tip fails the whole batch), as the scan script already does.

The 11-18 and 11-19 failures (four fake test values, 127 gone tips) were
fixed by #539. "Open, update or close the sweep issue" did not break: it
opened or commented on the issue each time, then exits 1 by design so
the run stays red.

Tests: fork-contracts.test.py runs the workflow's own lookup code end to
end in a blob-less clone of a local origin, with a gh stub: a fresh clone,
run again, stopped half-way, no gone tip, no tips, no clone. On main's
workflow the checks fail (5 cat-file processes and 5 lazy fetches for 5
tips); they pass now. The pinned text and two new mutants cover the rest.

Fixes #637

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Secret sweep: hand the tip lists to the scan in files (#637)

With the lookup fast, the dispatched sweep got past it and failed at the
next program it started: OLD_HEADS (every before and after of the whole
activity record, 131 KB) was exported as one environment string, over
the kernel's 128 KiB cap per string, so git could not start ("Argument
list too long", exit 126).

The workflow now keeps each id once and writes OLD_HEADS and
SCANNED_GONE to files under RUNNER_TEMP (written afresh each run),
exported as OLD_HEADS_FILE and SCANNED_GONE_FILE. The variables are
still exported while they fit, for a default branch whose script copy
predates the files. The scan script reads the files instead of the
variables when they are set (no longer exporting them), and fails the
job when a file cannot be read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the MCP profile launch check lines (#681) (#692)

Announces the four lines the #681 fix adds to two upstream files: a thread
whose MCP profile is narrower than "all" cannot start a thread that gets
more than its own profile, here or on another machine.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Remote completion delivery: a task is reminded once; end-to-end tests for #386 (#688)

Upstream's follower already delivers a remote child's end at least once: it follows each open
task until the end is recorded, again at every start, and retries with back-off while the link
is down. Its delivery keeps the first result and reserves one wake per result. The fork's
backstop reminder keyed its message on the whole owed set, so a set that grew sent a second
message naming a task already reminded. Reminder ids now name per-task keys; a check reminds only
tasks not reminded yet, in batches of ten, and reads ids in the first format as sent.

New end-to-end tests on the real orchestrator and follower pin the delivery: the link down
when the child ends, the parent server restarted (also half-way through recording the end, and
again after), the machine there restarted, duplicate reports, and a child that ended before
the parent knew its id.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the MCP profile launch mark lines in place of the replaced line (#681) (#696)

The announced checkedElsewhere line replaced upstream's remote caller check in
McpToolAccess.startsThreads, which the seam check refuses. Two added lines take
its place (startsHere on the local path, refuseUnlessHere in the modes step), so
upstream's line stays as it is. The import line stays announced.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Seam check: hold a pending file moved to "files" to upstream's lines in CI (#552) (#689)

* Seam check: hold a pending file moved to "files" to upstream's lines in CI (#552)

A pull request that moves a "pending" file to "files" was only held to how
many lines its new entry lists and that the file has them. With --upstream,
fork-checks now fetches upstream's default branch read-only (commits and
trees only, negotiated from the checkout: about a second) and holds the
entry's "added" to exactly the head's fork lines counted from the merge-base
of main and upstream's head. Only such a change fetches. Unreachable, empty
or unrelated upstream: a warning naming why, and the check as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Seam check: read upstream's URL from main's fork-upstream.json, not the workflow

fork-checks.yml stays as it is: a token in its pull_request_target job is
refused by the schema check's own test, and any change to that file is the
owner's. The seam check now takes upstream's git URL from
.github/fork-upstream.json at the list's commit (main, never the pull
request's copy) when a change moves a "pending" file to "files"; --upstream
still overrides it by hand. A malformed file refuses only such a move; no file
keeps the old note. Comments no longer name the issue (lint).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* MCP profiles: a broken settings.json or a launch never widens a thread to all (#681) (#694)

* MCP profiles: a broken settings.json or a launch never widens a thread to all (#681)

A settings.json that did not decode gave every setting its default, so a
thread kept to a narrower MCP profile ran with "all". The MCP profile keys
are now read from the file's text the way a full decode reads them; text
that names a profile key but cannot be read as an object, or a file that
cannot be read from disk, refuses the turn, delegation or launch until it
is fixed. Text that names no profile key sets none, so a typo elsewhere
stops no thread, including the one that fixes the file.

t3_thread_launch from a thread whose profile is narrower than "all" is
refused when the new thread's profile in the target project is not within
the launcher's, and a launch on another machine is refused for such a
thread (that machine would give it its own profile). A launcher whose
profile cannot be worked out is refused, never taken as "all".

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: a narrowed thread's new schedule_task on another machine is refused too (#681)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork seams: the announced MCP profile launch lines are now added (#692 merged)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* mcp profile launch: keep upstream's remote caller check line as it is (#681)

The seam check refuses a replaced upstream line. startsThreads' own path now
marks its caller (startsHere), and its modes step refuses a narrowed caller
nothing marked (refuseUnlessHere), so the remote check refuses a launch or a
new schedule_task on another machine with upstream's line unchanged, and any
other path to the modes fails closed. Tests: schedule_task there is refused
too (an update still goes), and a launch here does not unlock the next call
there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profiles: keep the last read keys for a cut-off settings.json; check create_threads

A settings.json that is empty, cut off before its MCP profile keys, or
garbage no longer gives every thread `all`: the server keeps the MCP
profile keys it last read in this run, and a server started on such a file
refuses until it is fixed. A file that decodes now counts for its MCP keys
over the service's cached settings, so a fix counts before the watcher
reloads.

create_threads from a thread narrower than `all` is refused when its new
top-level thread would get more, through the fork's beforeCreateThread
check, from one settings read with the launcher's. A new thread whose
profile cannot be worked out is refused.

Fixes #681

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profiles: a missing settings.json keeps the keys read; a whole typo file sets none (#681)

- Once this run has read a file's MCP profile keys, a missing settings.json (an editor's
  rename-then-write gap, or a delete) keeps them, with carried profiles read as refuse and the
  policy's locks over them, instead of resetting to the defaults' all. A server that started
  with no file is still a fresh install.
- A whole file with a JSON syntax typo (braces close back to depth 0 at its last character, a
  `}`) whose text names no MCP profile key sets none, so T3 keeps working after a restart as
  upstream does. Text that may be cut off, or names a key it cannot read, still fails closed.
- Reads are numbered as they start, so a read that ends late never stores older keys last.
- Tests: the narrowed -> removed -> empty -> cut off walk, whole typo files at restart, cut-off
  and unreadable files at restart, every strict prefix of a file is not whole, the kept path's
  carried refuse and policy locks, and two reads at once. README says exactly this.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the schedule_task and fork MCP profile lines (#693) (#697)

* fork seams: announce the schedule_task and fork MCP profile lines (#693)

Lists the five lines the #693 fix adds to two upstream files, both new
entries with "added": [] (step 1 of "Adding a seam line").

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork seams: announce the run-now and forwarded-call MCP profile lines (#693)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Secret sweep: stop re-checking deleted tips every run (#691) (#701)

* Secret sweep: stop re-checking deleted tips every run (#691)

The sweep's cost grew with the deleted tips GitHub's activity record still
lists: each was fetched again and its runs looked up again every day (about
231 of 250 API calls), and one deleted tip in the batch fetch sent every
served tip to the one-by-one fetch.

Now the sweep asks GitHub's GraphQL API about every tip the clone lacks
first, fetches the ones it still shows in one batch, and asks git once about
a tip GitHub has no commit for (a network error fails the job). A record of
the deleted tips (restored and saved by actions/cache around the scan step,
sweep runs only) spares the fetch and, for a tip a scan read, the runs
lookup on later runs. The record is trusted only for tips GitHub still has
no commit for; a record that cannot be read is a warning, removed, and every
tip is checked as on a first run. The scan script takes the deleted tips
(DELETED_TIPS_FILE) and does not fetch them again; one the clone has is
still scanned.

Also: the hand-over fails the job when a list too long to export would reach
a default-branch script that reads only the variables, and uses
${RUNNER_TEMP:?}.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Contract tests: a mutant with nothing to break on an older workflow is not a crash

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Keep the sweep's record as its own run artifact, not a cache (#691)

Review of #701: any job of a branch can write a cache its runs restore,
actions/cache unpacks with tar -P anywhere on the runner, and the
repository's caches outgrow their 10 GB, so the record was evicted within
hours. The record is now an artifact of the sweep's own run (90 days). The
scan job's first step, before the checkout and with only its read-only
token, takes it from the newest completed run of fork-secret-sweep.yml
(schedule or workflow_dispatch, this branch, this repository, whose commit
this run's has). It reads the one plain file from the zip in memory, never
unpacks it, and checks every line. Any doubt means a first run.

- When a lookup fails (the API budget, say), the tips already proven
  are written to the record before the job fails, so the sweep catches up
  over a few days.
- A deleted tip that the record does not have as read by a scan is fetched
  every run, so one that git serves again is scanned again.
- reset_record (workflow_dispatch) starts the record afresh.
- Record format 2: only scanned lines.
- End-to-end tests cover the read step (each guard removed turns a case
  red), the partial record, the leftover .new, write-then-rename and NUL
  bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Let the record's tests run in full against code without the read step

They counted a missing step as a crash. Now each such check fails on its own, so the
whole suite can be run against older code: 134 checks fail at the PR's earlier
head, 141 on main, and none here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Give the contract tests a CI weight, and stop each read-step mutant at its first red case

The read step's 52 cases ran in full for each of the 22 mutants, and the file took 72 s on CI
with no weight. Now each mutant stops at its first red case, and the list has ~45s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* MCP profile: schedule_task and fork refuse a thread wider than the caller's (#693) (#700)

* MCP profiles: a broken settings.json or a launch never widens a thread to all (#681)

A settings.json that did not decode gave every setting its default, so a
thread kept to a narrower MCP profile ran with "all". The MCP profile keys
are now read from the file's text the way a full decode reads them; text
that names a profile key but cannot be read as an object, or a file that
cannot be read from disk, refuses the turn, delegation or launch until it
is fixed. Text that names no profile key sets none, so a typo elsewhere
stops no thread, including the one that fixes the file.

t3_thread_launch from a thread whose profile is narrower than "all" is
refused when the new thread's profile in the target project is not within
the launcher's, and a launch on another machine is refused for such a
thread (that machine would give it its own profile). A launcher whose
profile cannot be worked out is refused, never taken as "all".

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: a narrowed thread's new schedule_task on another machine is refused too (#681)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork seams: the announced MCP profile launch lines are now added (#692 merged)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* mcp profile launch: keep upstream's remote caller check line as it is (#681)

The seam check refuses a replaced upstream line. startsThreads' own path now
marks its caller (startsHere), and its modes step refuses a narrowed caller
nothing marked (refuseUnlessHere), so the remote check refuses a launch or a
new schedule_task on another machine with upstream's line unchanged, and any
other path to the modes fails closed. Tests: schedule_task there is refused
too (an update still goes), and a launch here does not unlock the next call
there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profile: schedule_task and fork refuse a thread wider than the caller's (#693)

schedule_task (a task whose runs start new threads, on create and on a
change, unbinding included) and t3_thread_transfer's fork are refused on
this machine when the new thread would get more than the calling thread's
MCP profile, as t3_thread_launch is. A profile that cannot be worked out
refuses, never counts as all. The logic is in fork/launchMcpProfile.ts;
the handlers get one line each.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profile: run_scheduled_task_now and forwarded calls keep to the caller's profile (#693)

run_scheduled_task_now on a task whose runs start a thread wider than
the caller's profile is refused, as a change to it is. A fork, a
scheduled task change or a run now sent to another machine is refused
for a narrowed caller, as a thread started there gets that machine's
profile.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profile: a remote task update from a narrowed thread is refused in #694's test too (#693)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profiles: keep the last read keys for a cut-off settings.json; check create_threads

A settings.json that is empty, cut off before its MCP profile keys, or
garbage no longer gives every thread `all`: the server keeps the MCP
profile keys it last read in this run, and a server started on such a file
refuses until it is fixed. A file that decodes now counts for its MCP keys
over the service's cached settings, so a fix counts before the watcher
reloads.

create_threads from a thread narrower than `all` is refused when its new
top-level thread would get more, through the fork's beforeCreateThread
check, from one settings read with the launcher's. A new thread whose
profile cannot be worked out is refused.

Fixes #681

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork CI: prove each listed fork test really ran, from runtime records (#682)

* fork CI: prove each listed fork test really ran, from runtime records

The runner (fork-ci-tests.cjs) now writes a small record of every listed
fork test it runs: exit code, tests found, skipped and failed, read from
the test's own output. Each part writes one, and so does each own run
(`--run <test>`). Each job uploads its records as
fork-test-records-<job>-<leg>-<attempt>, and fork_ci_result downloads them
all. It goes red when a listed test has no record, ran no test, skipped
more than it may, or failed; when a job or leg uploaded nothing; or when a
record belongs to another run, attempt, job, leg or head.

Tests declare how CI runs them in `fork-ci:` lines (run as root, with
their own <NAME>_TESTS switches, one class; skips at most n). These
replace the fixed REQUIRED_VARS table in fork-contracts.test.py, which
keeps the static check as the fast first one and now also pins the
records wiring.

Fixes #664

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI contracts: a mutant that cannot be made is a named FAIL

On a workflow from before #664 (no records step), the quiet mutants and
the reason checks now report their missing step as a FAIL instead of
stopping the test with a traceback.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI runner: shorter comments (lint)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: comments without issue numbers; fork-fleet weight to its CI time

fork-fleet.test.py takes 140-170 s on CI (main included); its ~67s weight
failed the weight check on a fast runner.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI records: compare with the commit the jobs test

needs.changes.outputs.sha is set only on release runs; on pull_request
and push every checkout takes github.sha. The records check now compares
with needs.changes.outputs.sha || github.sha, as the checkouts do, and an
empty or short SHA is red.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: count each skipped test by name, tight per-test skip lists (#664)

Review fixes for the runtime-proof records:
- Python tests run through fork-ci-unittest.py, which counts every test of
  each unittest run by its own outcome, so a setUpClass or module skip, a
  failed setUpClass or a stop half-way counts each test it left unrun.
- ok-lines tests end with "all passed: <n> ok, <n> skipped", checked against
  their ok and skip lines; a test that stops early or miscounts is red.
- "fork-ci: may skip <Class.test>" replaces "skips at most": a record must
  skip exactly the declared tests, by name, both ways.
- "run by" for a fork test is refused unless fork-tests.yml or the
  RUN_ELSEWHERE table names that workflow.
- Tests for the record's sha and for owed coming from the plan; the
  contract pins MAY_SKIP, RUN_ELSEWHERE, the reach of the workflow script
  (AST) and 7-day record retention.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: kit-as-root checks out the unittest shim; contract pins it (#664)

The kit-as-root job's sparse checkout left out fork-ci-unittest.py, so its
Python own runs could not start. The contract now requires every job that
calls the runner to check out the runner's files (its list, itself and the
shim), with mutants for each way to drop one. Formatting of the runner and
its tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: runner comments within the lint's four-line limit

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: count node tests by reporter, Python runs by plan; run by only per table (#664)

- node: a reporter (fork-ci-node-counts.cjs) counts the tests that ended. A file node reports
  only as itself (empty, a top-level return, an early exit), or tests that started but never
  ended, count nothing, so the record is red. node's stdout totals are no longer read.
- Python: the shim writes a plan line before each run and the counts after it. A plan
  without its counts (a hard exit) counts nothing, so it never falls back to ok lines.
- Skip names keep the module when it is not __main__.
- `run by` another runner only where RUN_ELSEWHERE names it, for every listed test.
- The record check's script reach check is tightened and renamed to what it checks.
- Fixtures kill the three surviving mutants. The fleet-refresh skip's image dependence is noted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* knip: the node test reporter is used by fork-ci-tests.cjs (#664)

fork-ci-tests.cjs passes .github/scripts/fork-ci-node-counts.cjs to
node --test as a reporter path, which knip does not trace.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* knip: trace the node test reporter from its test, not knip.jsonc (#664)

knip.jsonc is an upstream root config, so it must not name a fork file
(fork-owned reads check, seam check). The test now copies the reporter
through require.resolve with a literal, which knip follows as an entry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Slot gate: a thread list that cannot be read refuses the delegation (#705)

* Slot gate: a thread list that cannot be read refuses the delegation

When a delegation needs the running-agent count and the slot gate cannot
read it (upstream's shell read fails, crashes, or takes longer than the
5 s read timeout), the gate now refuses with slots_full instead of
letting the call through on the free-memory floor alone. The message
says the thread list could not be read (error or timeout), that no agent
was started, and that the caller can try again in a moment.

The read now runs in its own fiber that is stopped, not awaited, at the
timeout, so a read that cannot stop at once no longer keeps the refused
call (or the gate's semaphore) waiting. A refused call records nothing:
no starting entry, no held slot used up, no store write.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: at most one count read in flight; callers join it

A refused call no longer leaves a read of its own running. While a count
read runs, every caller that needs the count (delegations, slot waits,
wait_list, the observer) joins that one read with its own 5 s limit. The
marker is cleared when the read ends, whichever way, a late answer too.

A read that ends by an interruption is now a refusal in plain words:
"timeout" when a caller stopped it at the timeout, "error" when it
interrupted itself. A caller cut off while it waits leaves at once and
leaves the read to the next caller. The two Effect.interruptible wrappers
are gone: a forked fiber starts interruptible by default.

Tests: seven refused callers against a stuck read leave one read running
(7 on the old head), a cut-off caller, a joiner of a read stopped by
another caller, a read that interrupts itself, the timeout through
delegate_task, and a refusal in observe mode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: no joined count older than the read limit; one read start at a time

A delegation that joined a shared count read whose starter was cut off could get a
snapshot from long before it arrived and go over the limit. The gate now records when
the read started; an answer later than COUNT_READ_TIMEOUT after that start is a timeout
refusal, as on main where no count was older than its own 5 s read.

The check and the setting of the in-flight marker now run under their own lock, so a
scheduler yield between the fork and the marker cannot start a second read. A test
pins the uninterruptible mask around the shared read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork CI: one automatic re-run for known infrastructure failures only (#130) (#707)

* fork CI: one automatic re-run for known infrastructure failures only (#130)

A failed Fork tests run gets one GitHub "re-run failed jobs", only when
every failed job shows an infrastructure sign: lost runner, full memory
box (OOM kills, memory.max hits, memory.high throttling while stalled),
or a time limit hit while the machine was stalled. Never for a test
failure, never twice, fail closed on unreadable signs.

- fork-ci-pressure.py: start/end steps in each app job of fork-tests.yml;
  prints the memory pressure numbers in the log and leaves them as a notice
  when the job did not succeed. Never fails the job.
- fork-ci-rerun.py + fork-ci-rerun.json: the decision with every rule in
  one script and every project fact in config; warning annotation and job
  summary per re-run, with a 24 h count.
- fork-ci-rerun.yml: scheduled sweep (offset from the fleet sweep) plus
  workflow_dispatch for one run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: name the pressure note fork-ci-pressure (#130)

fork-owned-reads.test.py reads "fork-ci pressure" in the `!`-listed probe
as the fork-owned fork-ci/ folder; the script's own name is no read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI re-run: signs only from GitHub's own words and the job's record, one tracking issue (#130)

Review fixes for the one automatic re-run:
- Text is never a sign: a message counts only in the runner's form (failure,
  no title, .github), as a whole GitHub message (fullmatch), and only when the
  job's steps agree (lost: no failed step, no time limit, its runner, the end
  step never ran; limit: the job or step really ran that long, no other step
  failed). A failing test that prints GitHub's words, or a forged note, is
  left red.
- Memory full needs the job's own note (its end step completed, one note) to
  show a limited box stalled AND events in it, on a runner that is not
  GitHub-hosted; a machine-wide OOM kill or one event alone is no sign. A
  person's cancel never qualifies.
- Every re-run (and fleet-mode report, once) is first a comment on one
  tracking issue, written before the request; the 24 h count reads it.
- Every page of a listing is read (deduped, a cap that errors); trust is the
  fleet's own run_refused; a dispatch has a concurrency group of its own;
  the probe steps get a 1-minute timeout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI re-run: time limits from the workflow file, quoted text made safe (#130)

- A time-limit message counts only when its minutes are the job's (or the
  step's) own timeout-minutes in the workflow file at the run's commit, read
  through the contents API by a strict reader (checked against PyYAML on the
  real workflow). A failing step printing GitHub's exact "after 1 minutes"
  line is no longer re-run.
- Text quoted into the public tracking issue is one line, with no @mention
  and no HTML; only a comment's first line is read as its marker.
- Tests: a run re-run and red again between listing and fresh read is not
  asked for (pins the run_attempt re-check); a tracking issue that cannot be
  read ends the pass red with the reason and asks no re-run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the agent slot lines for every route that starts an agent (#706) (#708)

Lists the seven lines the #706 change adds to two upstream files: two in
the t3_thread_launch handler (its entry's announced list) and five in
ScheduledTaskService.ts (a new entry with "added": []). Step 1 of
"Adding a seam line".

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the slot release and run-now slots_full lines (#706) (#712)

* fork seams: announce the slot release and run-now slots_full lines (#706)

Part of #706. List only (step 1 of "Adding a seam line"): the fix round of
the #706 code change adds three upstream lines.

- ScheduledTaskService.ts: a run that fails before its dispatch ends frees
  its slot at once (Effect.ensuring around the run), not after 10 minutes.
- thread/handlers.ts: the fork import and a mapError so run_scheduled_task_now
  answers slots_full, not orchestration_error, when the gate refuses it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork seams: announce the prettier-ignore that keeps upstream's run-now lines (#706)

A second pipe step in run_scheduled_task_now makes the formatter reflow
upstream's lines; a prettier-ignore above the statement keeps them as they are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the line that stores a waiting direct webhook delivery (#706) (#713)

Part of #706. List only (step 1 of "Adding a seam line"): the last fix round
of the #706 code change adds one upstream line.

- ScheduledTaskService.ts: a pipe step around a direct webhook delivery's run
  (inside its task's webhook permit) gives the fork the raw request and the
  stored-delivery worker's wake-up. Refused for a slot, the delivery is stored
  as a pending row the worker owns, so a restart keeps it and it runs once;
  the in-memory copy ends without running.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Agent slots: every route that starts an agent goes through the slot gate (#706) (#710)

* fork seams: announce the agent slot lines for every route that starts an agent (#706)

Lists the seven lines the #706 change adds to two upstream files: two in
the t3_thread_launch handler (its entry's announced list) and five in
ScheduledTaskService.ts (a new entry with "added": []). Step 1 of
"Adding a seam line".

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Agent slots: every route that starts an agent goes through the slot gate

create_threads, t3_thread_launch and scheduled runs (on schedule, run now,
webhook) now take a slot from the same gate as delegate_task, with the same
count and refusal. A refused run on its schedule is recorded as skipped with
the reason and its next time as after a run; run now fails and writes
nothing; a webhook delivery is marked failed. A launch sent here by another
machine is decided by this machine's gate (no caller). Logic lives in
fork/agentSlotRoutes.ts; upstream files get one call per seam line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork seams: the agent slot lines are added, no longer announced (#706)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* agent slots: a refused scheduled run waits for a slot, never lost (#706)

Review round for the slot gate on every route.

- A run on its schedule (interval, once, fixed time) refused by the gate,
  full or with an unreadable count, stays due and is tried again at each
  poll; it starts once when a slot frees. Its history shows one
  "Waiting for an agent slot" note per due time, not one per poll.
- A webhook delivery refused for slots waits and starts once when a slot
  frees; it ends only if its task is paused, deleted or changed. A waiting
  coalesced delivery is picked up again after a restart.
- A task bound to a thread whose run is active only queues its prompt, so
  it takes no slot. An idle bound thread is gated on its current provider.
- create_threads checks the whole batch before creating any thread; a
  later refusal names the threads already created. A retried thread whose
  run never started is counted again.
- Refusal text fits the route: only an agent caller is told to wait;
  another machine's call and scheduled notes say plainly what happened.
- A run that fails before its dispatch frees its slot at once. Run now
  answers slots_full over MCP.
- A boot test fails when scheduled runs lose the gate in the runtime layer.
- docs/fork/README.md lists the gated routes and the ones that are not
  gated yet (#711).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* agent slots: a refused direct webhook delivery is stored, so a restart keeps it (#706)

A direct (not coalesced) webhook delivery refused for a slot is stored on
its first refusal as a pending delivery the stored-delivery worker owns,
due now; its in-memory copy then ends without running, so the worker runs
it once, and a restart keeps it. One new upstream line (announced in the
seam-only pull request #713, moved to added here) gives the fork the raw
request and the worker's wake-up around the direct run.

Also: an unreadable count logs its warning once while it stays unreadable
(again when the problem changes, and an info line when it reads again);
the waiting note follows the current reason and is written only when its
text changes; a scheduler source clears the note once its task is paused
or moved to a later time. The README names the bound-thread race (#711).
Tests: a direct delivery stored then run once, the same across a restart;
the stop tests free the slot (and cover a re-made task and a trigger
change); the note and the log once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* agent slots: list the note cleanup among the scheduler's timed sources (#706)

The start-paths contract lists every file that registers a timed source
with the shared scheduler (which a held boot pauses); the agent slot note
cleanup is one now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the scheduled task save's MCP profile line (#699) (#715)

Part of #699: the list only (step 1 of "Adding a seam line").

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the schedule_task change line that passes the prompt (#699) (#718)

The early check of a schedule_task change needs the new prompt to refuse,
before the service uses up a webhook secretRef, a narrowed thread's change
to a task bound to a wider thread.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Scheduled tasks: check the saving thread's MCP profile in the service, and at run (#699) (#716)

* fork seams: announce the scheduled task save's MCP profile line (#699)

Part of #699: the list only (step 1 of "Adding a seam line").

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Scheduled tasks: check the saving thread's MCP profile in the service, and at run (#699)

Each scheduled task save records who made it (the owner, or the thread and
its MCP profile) in scheduled-task-mcp-profiles.json in the state folder.
A run that starts a new thread is refused, recorded like a refused run,
when that thread would get more than the recorded profile. Tasks with no
record run as before. The save checks move into the service's own read,
and a narrowed thread cannot change the prompt or thread of a task bound
to a wider thread.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profiles: refuse agent-made tasks with no record, linked saves, late webhook runs (#699)

Review round on the scheduled-task MCP profile record:
- An unbound task an agent made with no record (saved before the record,
  or the record file lost or an older copy restored) is refused at run start
  (schedule, run now, webhook) until the owner saves it once in the app.
  Owner-made tasks with no record still run.
- A save from another machine is recorded as linked with no profile, never
  as the owner's, so its runs wait for the owner's save.
- A refused one-time task's reason says to run it now or give it a new time
  after that save (it has no next time).
- schedule_task checks the bound-to-wider-thread rule before calling the
  service, so that refusal no longer uses up a webhook secretRef.
- A webhook delivery that waited for an agent slot is checked again as it
  starts.

Tests: old or lost record, refusals for interval, once and fixed_time
schedules, a run refused by both the slot gate and its profile, a refused
webhook run (at start and after waiting), a linked save, and the handler's
early check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profiles: order the waiting-webhook test, one-time hint on two refusals (#699)

- The webhook test widens the project with the slot still full and waits
  until the waiting delivery has ended refused, then frees the slot. It no
  longer depends on how far a retry got under load.
- The unreadable-record and unknown-profile refusals of a one-time task now
  say to run it now or give it a new time once that is fixed, with a test.
- README: a continue task after the project widens, and a change saved from
  another machine to a bound task.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(secret-sweep): guard the sweep record's partial writes and reads (#703) (#720)

- Read step: an id and an output `read` (found, none, reset, failed). No record
  while a tag is named like the branch (matching-refs check; a failed check or
  an unusual branch name counts as failed). A re-run reads its own first
  attempt's record first. reset_record leaves an empty record, which the keep
  step keeps even when the scan step fails before writing its own.
- Scan step: a partial record only when the read found a record the scan step
  could read, reset it, or found none; never after a failed read. Recorded tips
  are marked before any lookup, so a partial record keeps every proven tip. A
  20-minute limit in the lookup loop stops it before the job's time limit and
  keeps what it proved.
- Keep step: only on a branch, and also for reset_record's empty record.
- Tests: e2e cases and mutants for each, contract mutants for the new step ids,
  env and keep condition.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork-ci-rerun: close the leftover minors from the #707 reviews (#721)

* fork-ci-rerun: close the leftover minors from the #707 reviews

- Tracking issue: found by a marker in its body (and the bot as author), re-checked just
  before opening one, and a second open one is closed, so a pass that stopped after
  opening it leaves one issue.
- Memory full: only the job's own cgroup's OOM kill counts (an ancestor's memory.events
  holds other jobs' kills); the job's own cgroup must have stalled too.
- Pressure note: refused at GitHub's annotation cap, and its seconds must fit the runner's
  own start and end probe step times, so a note a step printed cannot count.
- Probe steps: stopped after 40 s with a warning, so a stalled probe never skips the tests.
- Runbook: a person's re-run of a run created over list_hours ago is not looked at (why,
  and the run_id dispatch that covers it); every rule line has a test.
- Upstream sync check: git ls-remote runs from / so it never reads a checkout's
  .git/config, where actions/checkout keeps the job token.

Part of #709

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-ci-rerun runbook: formatter layout

Part of #709

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork-ci-rerun: no note after a stopped end probe; review minors

A probe the end step's `timeout ... || echo` stopped (or one that raised)
ends the step green with only a warning and no note, so a note a step
printed earlier stood alone in a window the stop made wide. note_of now
reads no note when the end step took the probe's limit or more, or when
any annotation starts with the probe's own words (fork-ci-pressure:).
Docs no longer claim a printed note can never count: the window stops one
printed well before the end step; one printed just before it is stopped
only by trust and once.

Minors from the reviews of #721:
- The probe limit is one value (the `changes` job's probe_seconds output;
  a workflow-level env is refused by the quiet contract), equal to the new
  config key probe_limit_seconds, with a contract test.
- A duplicate tracking issue is closed first, then commented: a close that
  keeps failing posts no "Duplicate of" each pass, and the pass warns.
- Tests for the `mine in ours` guard and for every pass closing an extra
  issue; the runbook says when that happens and why the 24 h count can
  read one low after a duplicate closes.

Part of #709

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the slot lines on t3_thread_send and its attachments (#711) (#714)

Part of #711. List only (step 1 of "Adding a seam line"): the #711 code change
adds two upstream lines to each of two MCP handler files.

- orchestrator/handlers.ts: t3_thread_send asks the agent slot gate before it
  sends; an agent's send that would start a run in an idle thread takes a slot
  or is refused slots_full, and nothing is sent. Into a running thread it only
  queues: no slot.
- attachment/h…
scuttletoby added a commit that referenced this pull request Nov 29, 2026
… from fork-checks.yml only (#1177)

* run records: first closed tag decides, cut whole characters, strict --to (#619) (#639)

* run records: first readable estimate tag wins, cut whole characters, strict --to (#619)

- An earlier mention of [run-estimate: no longer hides a later tag that reads;
  with none that reads, the first is refused as before. An unclosed tag ends at
  the next [, for run-kind too.
- Tag length and cuts count graphemes, so a cut never splits an emoji.
- --to takes only a real YYYY-MM-DD day.
- Tests pin that an empty refused tag is logged and counted.

Fixes #619

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* run records: first closed tag decides, refuse typos and empty kinds (#619)

Review of #639: "the first tag that reads wins" let a later example
replace a real tag with a typo ([run-estimate: 30-40m] then
[run-estimate: 1h 2M tokens] recorded 1h). Now only unclosed and
too-long openers are passed over; the first closed tag that fits
decides, and is refused (kept, logged, counted) when it is empty or
does not read.

The kind tag follows the same rule: an empty closed kind, or (with no
closed tag) an unclosed one such as [run-kind: lens [x]], is refused,
kept in a new optional kindRefused field, logged and counted in the
summary, instead of being dropped silently.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Pacing advice: honour enforce's back-off, exact scan wording (#642)

In advise mode the note said "enforce would first scan this folder" even
while enforce was backing off after a scan with no result, when it would
not scan. The advice now reads the back-off and gives the same reason
enforce would give. The scan note now says "if it lists the model and the
task can run there", since a listed model can still be refused for its
options or runtime mode.

Tests: an advise call with a current list that lacks the model, enforce
then advise within and after a back-off, and the "lets this effort run"
and lower-effort notes in enforce with the scan mark set.

Fixes #628

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Fork kit shards: workflow quiet-failure contract, shard slow warning, pinned mutants (#633) (#645)

- fork-contracts: no continue-on-error anywhere in fork-tests.yml, no if: on a step that runs fork tests
- fork-ci-tests.cjs: judge() out of main (tested); a warning when a shard takes over twice its expected time
- weightNote boundary and exact-message tests
- setup.test.py: the killed-upgrade test compares files with a whole run's; same_wsl2_walls docstring says which tests do

Co-authored-by: Claude Opus 5.5 <[email protected]>

* head gate: review trigger live check as a setup step, release note, warning on odd run fields (#379) (#650)

Items 1 to 7 of #379 are on main (#392, #406). Item 8, the live check, needs a project that
copies the trigger, so it becomes a written setup step (README step 8) and part of a new
release-notes entry for the trigger, which every ci/v15+ release ships without one. A review
run whose head fields are missing or odd now judges nothing with a ::warning:: instead of a
plain log line, so a live mismatch of GitHub's fields is seen rather than staying green.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Delegated results: remind for linked children a stop lost, and tighten the reminder (#641)

* Delegated results: remind for linked children a stop lost, and tighten the reminder

- At start, read each linked environment's threads made before the start; a parent here
  that one names as delegatedFrom but no task follows gets one queued message (ids from the
  orphans, so a rerun or the next restart never repeats it). Retries while an environment
  does not answer or the parent is busy.
- The startup check also finds parents with unread results but no reserved wake.
- Results with no delivery state count as unread for a day; an open question holds the
  reminder, background work does not.
- task_list: a linked child still running there is read there; one timeout marks the rest
  of that environment unknown; the orphan search says when it read only the newest threads.

Fixes #625
Part of #386

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* FORK_CHANGES: link the delegated results follow-ups on their row

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Delegated orphans: name each orphan once, queue for busy parents, log what is left

- Each orphan gets its own key in the message and command ids; before a send the
  scan reads the parent's sent message ids and accepted receipts, so a grown set
  (late machine, moved one-day window after a restart) sends only the new ones.
  At most 10 orphans per message; the first scan's per-set id still counts.
- A busy parent (also one waiting on a question) is no longer held: the queued
  message is read once its run ends. Orphans are worked out first, so a busy
  parent with none forces no rescan.
- A later page that does not answer is its own state (cut-short): scanned again,
  and named in task_list's next. After the last scan a warning names the
  environments and parents still unchecked. The page-limit line says so.
- Neutral wording (a failed record also leaves an orphan), a minute's clock
  tolerance between machines, a test for the held-start skip, and the upstream
  gap in the docs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* MCP profile carry: per-machine refuse, Claude-only docs, no-store rule (#640) (#648)

* MCP profile carry: per-machine refuse, Claude-only docs, no-store rule (#640)

- New setting mcpCarriedProfiles ("apply" default, "refuse"). With refuse,
  GET /api/fork/features answers mcpProfileCarry: false, the sender refuses
  a narrower-profile task before sending, and a task that still arrives
  with a narrower or unreadable carried profile (and its sub-agents) is
  refused at its turn. A carried all, nothing carried, or the owner's pick
  for the task run as before. No value lets a task get more tools.
- Docs say plainly that only Claude threads apply profiles, carried
  tasks included.
- The adapter's no-store exception now applies only when neither a thread
  store nor a settings service is wired (default settings, so nothing can
  narrow). With settings but no store, a thread with a parent is refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Docs: settings table row for mcpCarriedProfiles (#640)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork-seams: list packages/contracts/src/reviewRules* as fork files (#652)

reviewRules.ts and its test are fork files (#291 added them), but forkFiles did
not name them, so a pull request that changes them (#647, for #302) is judged as
changing an upstream file. A pull request is judged by its base's list, so this
list-only change goes first.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* reviewRules: follow-ups from #291's lens (kept text, null, lens names) (#647)

* reviewRules: follow-ups from #291's lens (kept text, null, lens names)

- A project save takes back kept unreadable reviewRules text only when it
  is the text stored for that project (server save check); other text, text
  for a project that stores none, or a stale client's after a fix elsewhere
  is refused.
- A hand-written project null reads as not set (the server's) for
  reviewRules, playtest and handoff: Schema.Null comes first in the union.
- A lens name may not be an Object.prototype key (constructor);
  effectiveReviewRules builds lensRunners without a prototype, and
  reviewLensRunner looks a lens up with Object.hasOwn.
- Tests for the resolver's unreadable guard and the kept-value key
  whitelist; decidedIn points at #291.

Fixes #302

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(settings): a project's null for playtest, handoff and reviewRules reads as the server's

A hand-written project null decodes as the key left out, and a client's
clear (null) is dropped from upstream's part of the patch, so the resolver,
PlaytestService and the web panels never see null; they get the server's
value. The kept-text tests now send values through a JSON round trip, as
a real client does. Docs say that old files holding a project null change
from off to the server's value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fleet: launcher reads every kill setting, checks its kill; walls list more account files (#636) (#649)

- start reads RuntimeMaxUSec, RuntimeRandomizedExtraUSec, KillMode, SendSIGKILL,
  FinalKillSignal and LoadState next to the two stop timeouts; each must be printed
  once; a collected unit (LoadState=not-found) has nothing left to check
- "killed" only once ActiveState shows the unit dead; else "could not kill it"
- job_etc refuses a FIFO at passwd, group or hosts instead of hanging on it
- never() and the walls' lists add passwd*/group*/hosts* backups, hosts.equiv,
  /var/mail, /var/spool/mail, /var/lib/sss, dnsmasq.leases, /var/lib/dhcp
- walls: inodes of every /etc/**/private folder; a mixed refusal names both fixes
- tests: hours and longer, kill check, FIFO, two-way list sync; docs name the limits

Co-authored-by: Claude Opus 5.5 <[email protected]>

* head gate: review run log tells a skipped branch name from odd fields, counts the listing (#651) (#657)

- A head branch git allows but the gate does not look up (a no-break or
  zero-width space, an emoji joined by a zero-width joiner, longer than 255)
  now gets a plain line that says so, not the warning that blames GitHub's
  fields. The warning stays for missing or malformed sha, repository or
  branch (a branch with a control character git refuses), and names a
  deleted fork as the one known harmless cause.
- "no open pull request has the head" says how many open pull requests
  GitHub listed on that branch, so setup step 8 can tell a wrong filter
  (none listed) from a wrong head sha or repository (some listed).
- Release notes: the trigger's Upgrade needs a pin at ci/v15 or later (not
  "a release that has this entry"); the refused pin is ci/v14 or before; the
  #379 warning is after ci/v20 (that tag does not have it).
- The docs test checks "is refused" too.

Part of #651.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Pacing advice: scan of a folder still loading slash commands (#644) (#659)

advise answered from a current model list even when its slash commands
were still loading, so the note said "enforce" would hold. enforce scans
that folder first (the registry probes any snapshot that is not settled).
advise now answers from the list only where enforce would: during a
back-off, or from a settled list; otherwise it marks the scan.

Tests: the loading case in both modes, advise's own clock-jump case, and
the test helper refuses a settings change combined with unreadable
settings instead of dying on the mock.

Fixes #644

Co-authored-by: Claude Opus 5.5 <[email protected]>

* MCP profile carry: Claude-only docs, no empty name, fail closed, required key (#653) (#658)

- docs: the mcpCarriedProfiles section says a refused task is refused on
  Claude only; Codex and other providers still run it with every tool.
- A refusal no longer shows profile "" when the carried value has no name.
- When the settings read fails and settings.json does not decode, the
  fallback reads mcpCarriedProfiles as refuse, so a narrower carried task
  is refused rather than cut.
- mcpCarriedProfiles is required in McpProfileSettings.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Project null settings: file encode drops a null; explain the split and the save step's clear (#654) (#662)

- nullReadsAsUnset: encode drops a null too, so no future path can write
  one back to the settings file. The patch keeps its own schema, so a
  client's clear still sends its null.
- splitForkSettingsPatch: the comment says the left-out key is removed by
  upstream's merge only, and that the fork's server save must get the
  unsplit patch to see the clear.
- keepLeftOutForkProjectKeys: the null half of the clear branch stays, so
  the step is right on its own; a test pins it (it was an equivalent mutant).

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Announce the MCP carry call that passes the launch's instance (#668)

The carry call in RemoteDelegation passes the launch's scope, target and
instance, so the sender can refuse a narrower profile to an instance whose
driver does not apply one. Announced here; the pull request for #661 moves
it to "added" and drops the old call line.

Part of #661

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Move the slot gate's active-run read out of ProjectionStore (#663)

The slot gate counted running agents with a fork option on upstream's
ProjectionStore.getShellSnapshot (activeRunOnly). That read now lives in
the fork file apps/server/src/slots/ActiveRunShells.ts: one read-only
transaction finds the threads with a run in an active status (index
scan), reads upstream's shells of just those threads, and keeps the ones
whose shell shows an active run. ProjectionStore.ts and
ThreadManagementService.ts are back to upstream, so their pending
ceilings and lost counts leave .github/fork-seams.json in this same
change (the seam check needs a ceiling lowered with its lines).

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Announce the quiet handoff run's ProjectionStore seam lines (#665)

* Move the slot gate's active-run read out of ProjectionStore

The slot gate counted running agents with a fork option on upstream's
ProjectionStore.getShellSnapshot (activeRunOnly). That read now lives in
the fork file apps/server/src/slots/ActiveRunShells.ts: one read-only
transaction finds the threads with a run in an active status (index
scan), reads upstream's shells of just those threads, and keeps the ones
whose shell shows an active run. ProjectionStore.ts and
ThreadManagementService.ts are back to upstream, so their pending
ceilings and lost counts leave .github/fork-seams.json in this same
change (the seam check needs a ceiling lowered with its lines).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Announce the quiet handoff run's ProjectionStore seam lines

List-only: names the three lines the next change adds to upstream's ProjectionStore.ts, so the
thread shell reads a completed quiet handoff run as a stopped run in both its reads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Quiet handoff run: no browser notice (#666)

A completed quiet handoff run now shows in the thread shell as upstream's
stopped run (latestRunStopRequested), in both of the shell's reads: the
JavaScript one (threadShellFromProjection) and the SQL one
(selectShellThreadRows, which the shell and awareness snapshots use). So
the browser's ThreadNotificationCoordinator keeps upstream's quiet gate
unchanged and gives no notice, as the relay already did.

The rule lives in the fork file fork/handoff/handoffShell.ts
(isQuietHandoffRun moved there from handoffQuiet.ts, which imports
ProjectionStore and so cannot be imported by it), with its SQL mirror.
ProjectionStore.ts gets three seam lines: the import, a spread after
upstream's latestRunStopRequested, and the SQL fragment before
upstream's stop-request EXISTS.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(model-guard): drop an inherited agent option; compare Claude levels with T3's model list (#660)

* fix(model-guard): drop an inherited agent option; compare Claude levels with T3's model list

A delegate_task or create_threads pick that names its model no longer
inherits the parent's OpenCode `agent` or Kiro `mode` option: the fork's
delegation checks drop it on a fresh dispatch (a retry passes untouched),
unless the call names the option itself. The model guard never sees an
inherited option, so it could not refuse it.

The self-check now compares each claudeAgent row's efforts with the
levels T3's model list offers the model (and ultracode when the model has
the ultracode option). A level the model does not offer, a model with no
option list, an unreadable list or no list named is a problem; a model not
in the list is a note. A contract test keeps the server's agent option ids
and the guard's list in step.

Fixes #643

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* model guard follow-ups: a child keeps only the options its call names

While a model policy is on (server setting modelPolicy, advise or enforce),
a call that names its model keeps from the parent only the options the call
names, on every launch path: local delegate_task (both seats, and the target
the usage pacer moves to), create_threads, and remote delegate_task. One
shared rule (ownOptions in fork/delegateChecks.ts) replaces the list of agent
option ids. A call that names no model, a retry of an accepted call, and every
call with the policy off keep upstream's inheritance, so upstream's own
inheritance tests stay as they are. An unreadable setting applies the rule.

The tests move out of upstream's OrchestratorMcpService.test.ts into
fork/delegateOwnOptions.test.ts; OrchestratorMcpService.ts loses a fork line
(pending ceiling 35 -> 34).

Self-check: T3's model match order (exact slug, then the first alias), an
ultracode choice stands for xhigh, only a select offers levels, and a model
list that names none of the policy's models is reported. README fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* model guard follow-ups: keep modelPolicy.ts as on main

Its header comment is not a seam line; the docs say what reads the setting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Refuse a narrower MCP profile to a non-Claude instance; one settings fallback (#669)

* Announce the MCP carry call that passes the launch's instance

The carry call in RemoteDelegation passes the launch's scope, target and
instance, so the sender can refuse a narrower profile to an instance whose
driver does not apply one. Announced here; the pull request for #661 moves
it to "added" and drops the old call line.

Part of #661

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Refuse a narrower MCP profile to a non-Claude instance; one settings fallback

A remote delegation with a profile narrower than all now asks the linked
machine's orchestrator_capabilities which driver the launch's instance runs,
and refuses before sending unless it is Claude, the only provider that applies
a profile there. Under either value of the receiver's mcpCarriedProfiles.

Claude turns, a delegation's check of its own profile and the features route
read MCP profile settings the same way: settings.json is checked on each read,
and one that does not decode (also one broken at load, or with legacy keys the
load refuses) reads mcpCarriedProfiles as refuse, the policy's locks on top.
Only "apply" reads as apply; any other value reads as refuse.

Refusals say more: an unreadable carried profile no longer advises apply, and
a sub-agent's refusal names the reason at the top of the chain once.

Fixes #661

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Seam list: the carry line is added now, not announced

The merge of main (with #668's announcement) left the line in both
"added" and "announced", which the seam check refuses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: scuttletoby <[email protected]>

* Wait on the stored renewedAt, not the renew's finished line (#673)

A renew step logs `finished|renew` before it exits, and the service
stores renewedAt only after the process returned and it got the lock.
The thread-read-hangs test waited for the second finished line and then
read renewedAt, so it could read before the store write (CI flake).

- renewedSince(): waits on the stored renewedAt (set, and past a given
  earlier value); used by every renew test that read the session after
  waiting on the finished line.
- The failing-renew lapse test waits on the stored problem (a different
  exit code per try), not on the finished line.
- runnerControl.holdNextReturn holds a step's answer after its process
  exited; a new test uses it to show the finished line is there while
  renewedAt is not stored, that a sweep meanwhile starts no second
  renew, that a T3 stopped there stores no renew, and that a T3 started
  after the write reads the same renewedAt.

Fixes #671

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Fork CI contract: list-driven test steps, hidden exit status, shard warning and file-mode checks (#646) (#655)

* Fork CI contract: list-driven test steps, hidden exit status, shard warning and file-mode checks (#646)

- quiet contract: every test .github/fork-ci-tests.txt lists as run by
  fork-tests.yml must be run by a step's own command (python3, node or bash
  with the test's path as an argument). A fork test step may not have an if:,
  a working-directory, a shell other than bash, cd/pushd, trap, set +e/+o, a
  pipe, ||, a background &, or anything but its own command on the test's line.
- fork-ci-tests.cjs plan(): a runner file's comment lines no longer name a test.
- main() takes a fake runTest and clock; a test pins the ::warning:: line, the
  summary's Slow line and the 60 s boundary.
- pc-agents tests compare files by kind, mode, owner and content
  (same_files()), with a check that a mode change is seen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Fork CI contract: test steps held to an allowlist, comment-proof plan(), group in same_files()

A step that runs tests is now held to an allowlist instead of a blocklist of
shell tricks: its run is only lines of the allowed test forms, its keys, env
and if: come from a fixed set, its job has no defaults, env or container and
no step that writes GITHUB_ENV or GITHUB_PATH, and the workflow has no
defaults or env. Each listed test must be run whole, with the variable that
switches it on. fork-tests.yml moves its set-up lines into steps of their own.

plan() also drops trailing and block comments, readList spells `run by`
paths one way, same_files() compares the group, and the lint-flagged issue
numbers are gone from the test comments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Fork CI contract: runner parts from the accepted lines, sudo env only for root tests, string-aware plan()

- The check that each listed or present test is in exactly one runner part moves into the contract and reads the
  runner calls from the same parsed, accepted test lines (YAML parsed, quotes removed), job by job, with the
  runner's own inPart. A call kept in a YAML comment, a step name or a comment line counts for nothing. The
  raw-text reader in fork-ci-tests.test.cjs is gone.
- `sudo env` is accepted only before python3 and only for the tests REQUIRED_VARS marks as testing as root.
- plan() reads a JS/TS runner file with a small tokeniser (strings, template literals with nested ${}, regular
  expressions), so `'**/*'` in upstream's release-smoke.ts starts no comment.
- A step is a test step only by its code lines; a refusal says what made it one; a trailing # comment gets its
  own reason; "names a test but runs none" names the allowed forms; the docstring matches the rules.
- setup.test.py says when the group part of the killed-upgrade self-check is skipped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Fork CI tests: jsCode's comment within the 4-line limit

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* pr-queue: notify_command runs once per notice on an armed PR it passes over (#129) (#674)

* pr-queue: notify_command runs once per notice on an armed PR it passes over (#129)

An armed PR that goes red, gets stuck or conflicts is told on the PR, but
nobody with GitHub notifications off learns of it. A new optional config key
notify_command (argv, no shell) runs right after the queue posts such a
notice, with repo, PR, head, kind, reason and link. The posted comment is
the record, so later runs, restarts and other runners never run it again
for the same head and reason. A missing, failing or hanging command
(notify_timeout_seconds, default 30, then its session is killed) is a
warning and never holds the queue. The command gets no token.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* pr-queue notify: say the command is not a sandbox

The command's own environment holds no token, but it runs as the queue's
user, so it can read the queue's environment through /proc and the
checkout's saved token. Say so in the README and release notes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Slot gate: pre-select can no longer drop a running agent (#676)

The gate's pre-select copied upstream's active run statuses, so a status
upstream adds or starts to count as active would drop those agents from
the count with no test going red. It now leaves out only upstream's
finished statuses (isTerminalRunStatus) and lets upstream's own shell read
decide by activeRunId. A test walks every run status against upstream's
shell read. If upstream renames the run status index, the read logs an
error once and counts without it instead of failing and letting every
delegation through. A file-database test covers the reader path.

Also: drop quietHandoffAwareness (the shell already carries the quiet
handoff mark, one rule in handoffShell.ts), and note under the handoff
Limits that a browser offline across the turn end misses that notice.

Fixes #670

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Announce the MCP profile turn check's server.ts seam line (#677)

Lists the one server.ts line that wires fork/mcpProfileTurnCheck.ts
(the next pull request, for #672) under "announced", and says in the
entry's "why" what it changes.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Fleet walls: follow-ups from #649's reviews (#667)

* Fleet walls: follow-ups from #649's reviews

start gives systemd-run until START_BY (80 s after the launcher began)
and checks Type=exec, so a Type= drop-in that keeps systemd-run waiting
is killed and refused instead of outliving the agent's limit unchecked.
kill_unit keeps the kill's exit status and says "killed" only once the
unit is inactive or failed with no cgroup left. The not-found skip also
needs ActiveState=inactive and no cgroup. job_etc refuses any entry
already at the target before the write. The walls' mounts message puts
the way out before the paths. More DHCP lease folders are refused. A
link named private under /etc is not followed. span_ms has one guard,
with a test; the two-way never() list test also checks the die count
and every $1 line's shape.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Fleet launcher: kill what a failed systemd-run started; shellcheck in CI (#667)

Fix round for #667's two reviews (#656 follow-ups):
- start: a systemd-run that fails (any exit but the deadline) has its unit
  killed and checked like a deadline miss; "nothing started" only once the
  unit is inactive or failed with no cgroup and its runner user has no
  process left (older systemd lets the cgroup go anyway). Exit 137 is the
  deadline too; never `timeout 0`: under START_MIN (10 s) left, nothing
  starts.
- kill_unit: each systemctl call bounded (CALL_MAX 5 s, none past KILL_BY
  92 s); reads with `show --all`; says "gone" when there was nothing to kill.
- walls: a link named private under /etc makes what it leads to secret,
  not the folders above it.
- job_fs: the folders on the way to a view link are 0755 (mkdir -p -m set
  only the last one, under umask 077).
- CI: shellcheck (pinned, checksummed) on the launcher in the workflows job.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork CI: fleet test weight ~136s (it grew with #667's launcher tests) (#685)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Slot gate pre-select: no forced index; one-transaction and fail-fast reader tests (#678) (#683)

- The pre-select names no index. SQLite picks upstream's (thread_id, status)
  index on its own; a renamed, dropped or partial index now only slows the read.
  Before, a partial index under the same name failed the read ("no query
  solution") and the gate stopped counting. The existence lookup, the error
  log and its flag are gone.
- Tests: the query plan uses the index before and after ANALYZE; the count
  holds with the index dropped, renamed or made partial; a write committed
  between the id read and the shell read is not seen (one state); the reader
  test fails in 10 s with a message instead of a 120 s hang.
- Docs: what an index change and a failed upstream read do.

Fixes #678

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Refuse a narrowed MCP profile at turn start on a provider that cannot apply it (#679)

* Refuse a narrowed MCP profile at turn start on a provider that cannot apply it

A thread whose MCP profile is narrower than "all" no longer starts (or
resumes) a turn on Codex or any other provider but Claude, which would
give it every MCP server and T3 tool. The check runs on the machine that
runs the turn, as it starts, by wrapping upstream's provider instance
registry (fork/mcpProfileTurnCheck.ts, one server.ts line), so every
route is covered: a provider switch, t3_thread_launch, a local
delegation and a task from an older sender.

Also: a remote delegation that names a driver asks the other machine's
provider list once; doc comments moved above the code they describe;
the README says null reads as apply for mcpCarriedProfiles.

Fixes #672

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profile turn check: keep sessions live, look up named remote instances

- Wrap each non-Claude instance, adapter and session runtime in a
  delegating proxy instead of an object spread, so getters such as
  providerSession stay live for every thread, profile all included.
- Check compactThread as well as startTurn and resumeTurn: some
  providers compact by sending a /compact prompt.
- Remote carry asks the remote for its instance list unless no instance
  is named; a named instance the remote does not list is refused again.
- Allow fork/mcpProfileTurnCheck.ts in the startTurn path test.
- Boot test pins the layer's position: the orchestration layer's
  adapter registry and runtime policy read instances through the check.
- Tests: live getters for each runtime shape and driver, servers=all
  with fewer T3 tools refuses, refusal text names no retry, unlisted
  named remote instance refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* pr-queue notify: review follow-ups (#675) (#680)

* pr-queue notify: review follow-ups (#675)

- Both checkouts of the reusable workflow set persist-credentials: false,
  so no job token sits in the workspace the command can read. The README
  says plainly that the command still runs as the queue's user and can read
  the queue's start-up environment through /proc.
- A command that runs too long is stopped with its session and every process
  still linked to it by parent, so a child in its own process group or
  session (coreutils timeout, setsid) goes too. The README names the
  runner's end-of-job cleanup as the backstop for an orphaned daemon.
- The command's output is echoed between ::stop-commands:: and a random
  resume token: the runner reads ##[cmd] anywhere in a line, so the prefix
  alone did not stop that form.
- All notify commands of one run share a 300 s budget; once spent, a notice
  runs nothing (a warning), so slow notices cannot reach the job limit.
- No temp file for the output is a warning, not the end of the run.
- The link is kept only when it is a page of this repository on
  https://github.com/, else the PR page.
- README: a deleted queue comment or a new write-token login runs the
  command once more for every PR passed over, as one burst.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* pr-queue notify: drop checkout tokens by step, review minors (#675)

The reusable workflow no longer sets persist-credentials: false (its cleanup
runs git submodule foreach, which exits 128 on a repository with gitlinks and
no .gitmodules; the contract test forbids it). A step after both checkouts
removes what actions/checkout saved and fails unless nothing is left.

notify: without /proc the command's process group is still killed; workflow
commands are turned back on even if printing its output fails; the link must
be printable ASCII with no dot segments or encoded slashes; a spent budget
posts nothing, so the next run tells it; an unreadable output is no longer
called "could not start".

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* pr-queue README: format the Notify argument table

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* heavy: clean up everything a command started; heavy leftovers names the rest (#687)

heavy now removes its own scope's leftovers on every end:
- a scope guard (a small setsid child that holds no queue ticket) stops the
  scope and removes its containers when heavy itself is killed, even with -9;
- containers a command starts with the heavy owner label are removed when the
  command ends, is stopped or heavy is killed; a kept scope keeps them;
- a command whose parent died is refused at once (double-forked children are
  stopped with the scope).

`heavy leftovers [--older-than AGE] [--json]` looks only: it names processes,
scopes and containers older than a limit, by owner and age, with default rules
when there are no sweep settings. It never stops anything.

Tests cover a killed heavy, a double-forked child, a container started by a
command, a kept scope, missing or stopped Docker, and a rerun after a kill.

Fixes #159

Co-authored-by: Claude Opus 5.5 <[email protected]>

* secret sweep: one cat-file for all tips, no lazy fetch (#637) (#686)

* secret sweep: one cat-file for all tips, no lazy fetch (#637)

The sweep of 11-20 hit the scan job's 30-minute limit before the scan
script started. #539 added a loop that ran `git cat-file -e` once per tip
the activity record lists (about 1500), with lazy fetching on. In the
blob-less checkout each tip the clone lacked (about 400) was then lazily
fetched with no negotiation: the whole commit and tree history again,
about 36 MB each time, as a new pack. And every lookup of a missing
commit reads every promisor pack, so each later check got slower. Measured
against this repository: 3 s per tip from a fresh clone, 34 s after 30
packs.

The loop now checks all tips in one `git cat-file --batch-check` with
GIT_NO_LAZY_FETCH=1 (a failed check fails the job), fetches the tips it
lacks in one batch, and goes one by one only when the batch fails (a
gone tip fails the whole batch), as the scan script already does.

The 11-18 and 11-19 failures (four fake test values, 127 gone tips) were
fixed by #539. "Open, update or close the sweep issue" did not break: it
opened or commented on the issue each time, then exits 1 by design so
the run stays red.

Tests: fork-contracts.test.py runs the workflow's own lookup code end to
end in a blob-less clone of a local origin, with a gh stub: a fresh clone,
run again, stopped half-way, no gone tip, no tips, no clone. On main's
workflow the checks fail (5 cat-file processes and 5 lazy fetches for 5
tips); they pass now. The pinned text and two new mutants cover the rest.

Fixes #637

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Secret sweep: hand the tip lists to the scan in files (#637)

With the lookup fast, the dispatched sweep got past it and failed at the
next program it started: OLD_HEADS (every before and after of the whole
activity record, 131 KB) was exported as one environment string, over
the kernel's 128 KiB cap per string, so git could not start ("Argument
list too long", exit 126).

The workflow now keeps each id once and writes OLD_HEADS and
SCANNED_GONE to files under RUNNER_TEMP (written afresh each run),
exported as OLD_HEADS_FILE and SCANNED_GONE_FILE. The variables are
still exported while they fit, for a default branch whose script copy
predates the files. The scan script reads the files instead of the
variables when they are set (no longer exporting them), and fails the
job when a file cannot be read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the MCP profile launch check lines (#681) (#692)

Announces the four lines the #681 fix adds to two upstream files: a thread
whose MCP profile is narrower than "all" cannot start a thread that gets
more than its own profile, here or on another machine.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Remote completion delivery: a task is reminded once; end-to-end tests for #386 (#688)

Upstream's follower already delivers a remote child's end at least once: it follows each open
task until the end is recorded, again at every start, and retries with back-off while the link
is down. Its delivery keeps the first result and reserves one wake per result. The fork's
backstop reminder keyed its message on the whole owed set, so a set that grew sent a second
message naming a task already reminded. Reminder ids now name per-task keys; a check reminds only
tasks not reminded yet, in batches of ten, and reads ids in the first format as sent.

New end-to-end tests on the real orchestrator and follower pin the delivery: the link down
when the child ends, the parent server restarted (also half-way through recording the end, and
again after), the machine there restarted, duplicate reports, and a child that ended before
the parent knew its id.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the MCP profile launch mark lines in place of the replaced line (#681) (#696)

The announced checkedElsewhere line replaced upstream's remote caller check in
McpToolAccess.startsThreads, which the seam check refuses. Two added lines take
its place (startsHere on the local path, refuseUnlessHere in the modes step), so
upstream's line stays as it is. The import line stays announced.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Seam check: hold a pending file moved to "files" to upstream's lines in CI (#552) (#689)

* Seam check: hold a pending file moved to "files" to upstream's lines in CI (#552)

A pull request that moves a "pending" file to "files" was only held to how
many lines its new entry lists and that the file has them. With --upstream,
fork-checks now fetches upstream's default branch read-only (commits and
trees only, negotiated from the checkout: about a second) and holds the
entry's "added" to exactly the head's fork lines counted from the merge-base
of main and upstream's head. Only such a change fetches. Unreachable, empty
or unrelated upstream: a warning naming why, and the check as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Seam check: read upstream's URL from main's fork-upstream.json, not the workflow

fork-checks.yml stays as it is: a token in its pull_request_target job is
refused by the schema check's own test, and any change to that file is the
owner's. The seam check now takes upstream's git URL from
.github/fork-upstream.json at the list's commit (main, never the pull
request's copy) when a change moves a "pending" file to "files"; --upstream
still overrides it by hand. A malformed file refuses only such a move; no file
keeps the old note. Comments no longer name the issue (lint).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* MCP profiles: a broken settings.json or a launch never widens a thread to all (#681) (#694)

* MCP profiles: a broken settings.json or a launch never widens a thread to all (#681)

A settings.json that did not decode gave every setting its default, so a
thread kept to a narrower MCP profile ran with "all". The MCP profile keys
are now read from the file's text the way a full decode reads them; text
that names a profile key but cannot be read as an object, or a file that
cannot be read from disk, refuses the turn, delegation or launch until it
is fixed. Text that names no profile key sets none, so a typo elsewhere
stops no thread, including the one that fixes the file.

t3_thread_launch from a thread whose profile is narrower than "all" is
refused when the new thread's profile in the target project is not within
the launcher's, and a launch on another machine is refused for such a
thread (that machine would give it its own profile). A launcher whose
profile cannot be worked out is refused, never taken as "all".

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: a narrowed thread's new schedule_task on another machine is refused too (#681)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork seams: the announced MCP profile launch lines are now added (#692 merged)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* mcp profile launch: keep upstream's remote caller check line as it is (#681)

The seam check refuses a replaced upstream line. startsThreads' own path now
marks its caller (startsHere), and its modes step refuses a narrowed caller
nothing marked (refuseUnlessHere), so the remote check refuses a launch or a
new schedule_task on another machine with upstream's line unchanged, and any
other path to the modes fails closed. Tests: schedule_task there is refused
too (an update still goes), and a launch here does not unlock the next call
there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profiles: keep the last read keys for a cut-off settings.json; check create_threads

A settings.json that is empty, cut off before its MCP profile keys, or
garbage no longer gives every thread `all`: the server keeps the MCP
profile keys it last read in this run, and a server started on such a file
refuses until it is fixed. A file that decodes now counts for its MCP keys
over the service's cached settings, so a fix counts before the watcher
reloads.

create_threads from a thread narrower than `all` is refused when its new
top-level thread would get more, through the fork's beforeCreateThread
check, from one settings read with the launcher's. A new thread whose
profile cannot be worked out is refused.

Fixes #681

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profiles: a missing settings.json keeps the keys read; a whole typo file sets none (#681)

- Once this run has read a file's MCP profile keys, a missing settings.json (an editor's
  rename-then-write gap, or a delete) keeps them, with carried profiles read as refuse and the
  policy's locks over them, instead of resetting to the defaults' all. A server that started
  with no file is still a fresh install.
- A whole file with a JSON syntax typo (braces close back to depth 0 at its last character, a
  `}`) whose text names no MCP profile key sets none, so T3 keeps working after a restart as
  upstream does. Text that may be cut off, or names a key it cannot read, still fails closed.
- Reads are numbered as they start, so a read that ends late never stores older keys last.
- Tests: the narrowed -> removed -> empty -> cut off walk, whole typo files at restart, cut-off
  and unreadable files at restart, every strict prefix of a file is not whole, the kept path's
  carried refuse and policy locks, and two reads at once. README says exactly this.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the schedule_task and fork MCP profile lines (#693) (#697)

* fork seams: announce the schedule_task and fork MCP profile lines (#693)

Lists the five lines the #693 fix adds to two upstream files, both new
entries with "added": [] (step 1 of "Adding a seam line").

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork seams: announce the run-now and forwarded-call MCP profile lines (#693)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Secret sweep: stop re-checking deleted tips every run (#691) (#701)

* Secret sweep: stop re-checking deleted tips every run (#691)

The sweep's cost grew with the deleted tips GitHub's activity record still
lists: each was fetched again and its runs looked up again every day (about
231 of 250 API calls), and one deleted tip in the batch fetch sent every
served tip to the one-by-one fetch.

Now the sweep asks GitHub's GraphQL API about every tip the clone lacks
first, fetches the ones it still shows in one batch, and asks git once about
a tip GitHub has no commit for (a network error fails the job). A record of
the deleted tips (restored and saved by actions/cache around the scan step,
sweep runs only) spares the fetch and, for a tip a scan read, the runs
lookup on later runs. The record is trusted only for tips GitHub still has
no commit for; a record that cannot be read is a warning, removed, and every
tip is checked as on a first run. The scan script takes the deleted tips
(DELETED_TIPS_FILE) and does not fetch them again; one the clone has is
still scanned.

Also: the hand-over fails the job when a list too long to export would reach
a default-branch script that reads only the variables, and uses
${RUNNER_TEMP:?}.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Contract tests: a mutant with nothing to break on an older workflow is not a crash

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Keep the sweep's record as its own run artifact, not a cache (#691)

Review of #701: any job of a branch can write a cache its runs restore,
actions/cache unpacks with tar -P anywhere on the runner, and the
repository's caches outgrow their 10 GB, so the record was evicted within
hours. The record is now an artifact of the sweep's own run (90 days). The
scan job's first step, before the checkout and with only its read-only
token, takes it from the newest completed run of fork-secret-sweep.yml
(schedule or workflow_dispatch, this branch, this repository, whose commit
this run's has). It reads the one plain file from the zip in memory, never
unpacks it, and checks every line. Any doubt means a first run.

- When a lookup fails (the API budget, say), the tips already proven
  are written to the record before the job fails, so the sweep catches up
  over a few days.
- A deleted tip that the record does not have as read by a scan is fetched
  every run, so one that git serves again is scanned again.
- reset_record (workflow_dispatch) starts the record afresh.
- Record format 2: only scanned lines.
- End-to-end tests cover the read step (each guard removed turns a case
  red), the partial record, the leftover .new, write-then-rename and NUL
  bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Let the record's tests run in full against code without the read step

They counted a missing step as a crash. Now each such check fails on its own, so the
whole suite can be run against older code: 134 checks fail at the PR's earlier
head, 141 on main, and none here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Give the contract tests a CI weight, and stop each read-step mutant at its first red case

The read step's 52 cases ran in full for each of the 22 mutants, and the file took 72 s on CI
with no weight. Now each mutant stops at its first red case, and the list has ~45s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* MCP profile: schedule_task and fork refuse a thread wider than the caller's (#693) (#700)

* MCP profiles: a broken settings.json or a launch never widens a thread to all (#681)

A settings.json that did not decode gave every setting its default, so a
thread kept to a narrower MCP profile ran with "all". The MCP profile keys
are now read from the file's text the way a full decode reads them; text
that names a profile key but cannot be read as an object, or a file that
cannot be read from disk, refuses the turn, delegation or launch until it
is fixed. Text that names no profile key sets none, so a typo elsewhere
stops no thread, including the one that fixes the file.

t3_thread_launch from a thread whose profile is narrower than "all" is
refused when the new thread's profile in the target project is not within
the launcher's, and a launch on another machine is refused for such a
thread (that machine would give it its own profile). A launcher whose
profile cannot be worked out is refused, never taken as "all".

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: a narrowed thread's new schedule_task on another machine is refused too (#681)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork seams: the announced MCP profile launch lines are now added (#692 merged)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* mcp profile launch: keep upstream's remote caller check line as it is (#681)

The seam check refuses a replaced upstream line. startsThreads' own path now
marks its caller (startsHere), and its modes step refuses a narrowed caller
nothing marked (refuseUnlessHere), so the remote check refuses a launch or a
new schedule_task on another machine with upstream's line unchanged, and any
other path to the modes fails closed. Tests: schedule_task there is refused
too (an update still goes), and a launch here does not unlock the next call
there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profile: schedule_task and fork refuse a thread wider than the caller's (#693)

schedule_task (a task whose runs start new threads, on create and on a
change, unbinding included) and t3_thread_transfer's fork are refused on
this machine when the new thread would get more than the calling thread's
MCP profile, as t3_thread_launch is. A profile that cannot be worked out
refuses, never counts as all. The logic is in fork/launchMcpProfile.ts;
the handlers get one line each.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profile: run_scheduled_task_now and forwarded calls keep to the caller's profile (#693)

run_scheduled_task_now on a task whose runs start a thread wider than
the caller's profile is refused, as a change to it is. A fork, a
scheduled task change or a run now sent to another machine is refused
for a narrowed caller, as a thread started there gets that machine's
profile.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profile: a remote task update from a narrowed thread is refused in #694's test too (#693)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profiles: keep the last read keys for a cut-off settings.json; check create_threads

A settings.json that is empty, cut off before its MCP profile keys, or
garbage no longer gives every thread `all`: the server keeps the MCP
profile keys it last read in this run, and a server started on such a file
refuses until it is fixed. A file that decodes now counts for its MCP keys
over the service's cached settings, so a fix counts before the watcher
reloads.

create_threads from a thread narrower than `all` is refused when its new
top-level thread would get more, through the fork's beforeCreateThread
check, from one settings read with the launcher's. A new thread whose
profile cannot be worked out is refused.

Fixes #681

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork CI: prove each listed fork test really ran, from runtime records (#682)

* fork CI: prove each listed fork test really ran, from runtime records

The runner (fork-ci-tests.cjs) now writes a small record of every listed
fork test it runs: exit code, tests found, skipped and failed, read from
the test's own output. Each part writes one, and so does each own run
(`--run <test>`). Each job uploads its records as
fork-test-records-<job>-<leg>-<attempt>, and fork_ci_result downloads them
all. It goes red when a listed test has no record, ran no test, skipped
more than it may, or failed; when a job or leg uploaded nothing; or when a
record belongs to another run, attempt, job, leg or head.

Tests declare how CI runs them in `fork-ci:` lines (run as root, with
their own <NAME>_TESTS switches, one class; skips at most n). These
replace the fixed REQUIRED_VARS table in fork-contracts.test.py, which
keeps the static check as the fast first one and now also pins the
records wiring.

Fixes #664

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI contracts: a mutant that cannot be made is a named FAIL

On a workflow from before #664 (no records step), the quiet mutants and
the reason checks now report their missing step as a FAIL instead of
stopping the test with a traceback.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI runner: shorter comments (lint)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: comments without issue numbers; fork-fleet weight to its CI time

fork-fleet.test.py takes 140-170 s on CI (main included); its ~67s weight
failed the weight check on a fast runner.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI records: compare with the commit the jobs test

needs.changes.outputs.sha is set only on release runs; on pull_request
and push every checkout takes github.sha. The records check now compares
with needs.changes.outputs.sha || github.sha, as the checkouts do, and an
empty or short SHA is red.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: count each skipped test by name, tight per-test skip lists (#664)

Review fixes for the runtime-proof records:
- Python tests run through fork-ci-unittest.py, which counts every test of
  each unittest run by its own outcome, so a setUpClass or module skip, a
  failed setUpClass or a stop half-way counts each test it left unrun.
- ok-lines tests end with "all passed: <n> ok, <n> skipped", checked against
  their ok and skip lines; a test that stops early or miscounts is red.
- "fork-ci: may skip <Class.test>" replaces "skips at most": a record must
  skip exactly the declared tests, by name, both ways.
- "run by" for a fork test is refused unless fork-tests.yml or the
  RUN_ELSEWHERE table names that workflow.
- Tests for the record's sha and for owed coming from the plan; the
  contract pins MAY_SKIP, RUN_ELSEWHERE, the reach of the workflow script
  (AST) and 7-day record retention.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: kit-as-root checks out the unittest shim; contract pins it (#664)

The kit-as-root job's sparse checkout left out fork-ci-unittest.py, so its
Python own runs could not start. The contract now requires every job that
calls the runner to check out the runner's files (its list, itself and the
shim), with mutants for each way to drop one. Formatting of the runner and
its tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: runner comments within the lint's four-line limit

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: count node tests by reporter, Python runs by plan; run by only per table (#664)

- node: a reporter (fork-ci-node-counts.cjs) counts the tests that ended. A file node reports
  only as itself (empty, a top-level return, an early exit), or tests that started but never
  ended, count nothing, so the record is red. node's stdout totals are no longer read.
- Python: the shim writes a plan line before each run and the counts after it. A plan
  without its counts (a hard exit) counts nothing, so it never falls back to ok lines.
- Skip names keep the module when it is not __main__.
- `run by` another runner only where RUN_ELSEWHERE names it, for every listed test.
- The record check's script reach check is tightened and renamed to what it checks.
- Fixtures kill the three surviving mutants. The fleet-refresh skip's image dependence is noted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* knip: the node test reporter is used by fork-ci-tests.cjs (#664)

fork-ci-tests.cjs passes .github/scripts/fork-ci-node-counts.cjs to
node --test as a reporter path, which knip does not trace.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* knip: trace the node test reporter from its test, not knip.jsonc (#664)

knip.jsonc is an upstream root config, so it must not name a fork file
(fork-owned reads check, seam check). The test now copies the reporter
through require.resolve with a literal, which knip follows as an entry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Slot gate: a thread list that cannot be read refuses the delegation (#705)

* Slot gate: a thread list that cannot be read refuses the delegation

When a delegation needs the running-agent count and the slot gate cannot
read it (upstream's shell read fails, crashes, or takes longer than the
5 s read timeout), the gate now refuses with slots_full instead of
letting the call through on the free-memory floor alone. The message
says the thread list could not be read (error or timeout), that no agent
was started, and that the caller can try again in a moment.

The read now runs in its own fiber that is stopped, not awaited, at the
timeout, so a read that cannot stop at once no longer keeps the refused
call (or the gate's semaphore) waiting. A refused call records nothing:
no starting entry, no held slot used up, no store write.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: at most one count read in flight; callers join it

A refused call no longer leaves a read of its own running. While a count
read runs, every caller that needs the count (delegations, slot waits,
wait_list, the observer) joins that one read with its own 5 s limit. The
marker is cleared when the read ends, whichever way, a late answer too.

A read that ends by an interruption is now a refusal in plain words:
"timeout" when a caller stopped it at the timeout, "error" when it
interrupted itself. A caller cut off while it waits leaves at once and
leaves the read to the next caller. The two Effect.interruptible wrappers
are gone: a forked fiber starts interruptible by default.

Tests: seven refused callers against a stuck read leave one read running
(7 on the old head), a cut-off caller, a joiner of a read stopped by
another caller, a read that interrupts itself, the timeout through
delegate_task, and a refusal in observe mode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: no joined count older than the read limit; one read start at a time

A delegation that joined a shared count read whose starter was cut off could get a
snapshot from long before it arrived and go over the limit. The gate now records when
the read started; an answer later than COUNT_READ_TIMEOUT after that start is a timeout
refusal, as on main where no count was older than its own 5 s read.

The check and the setting of the in-flight marker now run under their own lock, so a
scheduler yield between the fork and the marker cannot start a second read. A test
pins the uninterruptible mask around the shared read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork CI: one automatic re-run for known infrastructure failures only (#130) (#707)

* fork CI: one automatic re-run for known infrastructure failures only (#130)

A failed Fork tests run gets one GitHub "re-run failed jobs", only when
every failed job shows an infrastructure sign: lost runner, full memory
box (OOM kills, memory.max hits, memory.high throttling while stalled),
or a time limit hit while the machine was stalled. Never for a test
failure, never twice, fail closed on unreadable signs.

- fork-ci-pressure.py: start/end steps in each app job of fork-tests.yml;
  prints the memory pressure numbers in the log and leaves them as a notice
  when the job did not succeed. Never fails the job.
- fork-ci-rerun.py + fork-ci-rerun.json: the decision with every rule in
  one script and every project fact in config; warning annotation and job
  summary per re-run, with a 24 h count.
- fork-ci-rerun.yml: scheduled sweep (offset from the fleet sweep) plus
  workflow_dispatch for one run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: name the pressure note fork-ci-pressure (#130)

fork-owned-reads.test.py reads "fork-ci pressure" in the `!`-listed probe
as the fork-owned fork-ci/ folder; the script's own name is no read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI re-run: signs only from GitHub's own words and the job's record, one tracking issue (#130)

Review fixes for the one automatic re-run:
- Text is never a sign: a message counts only in the runner's form (failure,
  no title, .github), as a whole GitHub message (fullmatch), and only when the
  job's steps agree (lost: no failed step, no time limit, its runner, the end
  step never ran; limit: the job or step really ran that long, no other step
  failed). A failing test that prints GitHub's words, or a forged note, is
  left red.
- Memory full needs the job's own note (its end step completed, one note) to
  show a limited box stalled AND events in it, on a runner that is not
  GitHub-hosted; a machine-wide OOM kill or one event alone is no sign. A
  person's cancel never qualifies.
- Every re-run (and fleet-mode report, once) is first a comment on one
  tracking issue, written before the request; the 24 h count reads it.
- Every page of a listing is read (deduped, a cap that errors); trust is the
  fleet's own run_refused; a dispatch has a concurrency group of its own;
  the probe steps get a 1-minute timeout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI re-run: time limits from the workflow file, quoted text made safe (#130)

- A time-limit message counts only when its minutes are the job's (or the
  step's) own timeout-minutes in the workflow file at the run's commit, read
  through the contents API by a strict reader (checked against PyYAML on the
  real workflow). A failing step printing GitHub's exact "after 1 minutes"
  line is no longer re-run.
- Text quoted into the public tracking issue is one line, with no @mention
  and no HTML; only a comment's first line is read as its marker.
- Tests: a run re-run and red again between listing and fresh read is not
  asked for (pins the run_attempt re-check); a tracking issue that cannot be
  read ends the pass red with the reason and asks no re-run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the agent slot lines for every route that starts an agent (#706) (#708)

Lists the seven lines the #706 change adds to two upstream files: two in
the t3_thread_launch handler (its entry's announced list) and five in
ScheduledTaskService.ts (a new entry with "added": []). Step 1 of
"Adding a seam line".

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the slot release and run-now slots_full lines (#706) (#712)

* fork seams: announce the slot release and run-now slots_full lines (#706)

Part of #706. List only (step 1 of "Adding a seam line"): the fix round of
the #706 code change adds three upstream lines.

- ScheduledTaskService.ts: a run that fails before its dispatch ends frees
  its slot at once (Effect.ensuring around the run), not after 10 minutes.
- thread/handlers.ts: the fork import and a mapError so run_scheduled_task_now
  answers slots_full, not orchestration_error, when the gate refuses it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork seams: announce the prettier-ignore that keeps upstream's run-now lines (#706)

A second pipe step in run_scheduled_task_now makes the formatter reflow
upstream's lines; a prettier-ignore above the statement keeps them as they are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the line that stores a waiting direct webhook delivery (#706) (#713)

Part of #706. List only (step 1 of "Adding a seam line"): the last fix round
of the #706 code change adds one upstream line.

- ScheduledTaskService.ts: a pipe step around a direct webhook delivery's run
  (inside…
@scuttletoby
scuttletoby deleted the fork/684-slot-gate-fail-closed branch November 29, 2026 20:11
scuttletoby added a commit that referenced this pull request Nov 29, 2026
* model-guard: pin each built-in driver's effort option id; fail closed for unknown drivers (#629) (#638)

* model-guard: pin each built-in driver's effort option id; fail closed for unknown drivers (#629)

- DRIVER_EFFORT_IDS: the id each of T3's built-in drivers reads its effort from
  (codex reasoningEffort, opencode variant, pi thinking, fx effort, grok/kiro/muse
  reasoningEffort, Claude effort). A pick must name its effort there.
- A row with efforts whose driver has no pinned id (cursor, antigravity, acpRegistry,
  custom drivers) and no effortOptionIds refuses every T3 pick; the self-check names it.
- Claude rows: thinking and fastMode only true or false.
- otherOptionIds never holds the driver's own effort id or an OpenCode agent.
- Contract tests read BUILT_IN_DRIVERS, each driver's kind and effort read, and
  Claude's ids from claudeModelOptions.ts; the files join the three sparse lists.
- Tests for each NOT_OTHER word, old policies and old pick shapes; README updated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* model-guard: exact driver kinds, no agent option as an effort id, a stricter driver-list contract (#638 review)

- A row whose driver is a built-in T3 kind in another case or with spaces
  around it ("Codex") makes the policy invalid: a pick with no driver could
  run on that driver's instance, which reads other option ids (lens B 1).
- An opencode row's "agent" and a kiro row's "mode" (Kiro's agent switch)
  are refused in effortOptionIds as well as otherOptionIds (lens A 1, B 3).
- The contract test fails on any BUILT_IN_DRIVERS entry it cannot read, such
  as a spread (lens A 2), and reads Kiro's agent id from T3's code.
- A test pins that the true/false rule is for Claude rows only (lens B 6).
- README: driver-kind and agent-option rules, the slug gap for any driver,
  inherited options on delegate_task, levels a model lacks, the upgrade
  step (self-check before updating), and the three jobs' sparse lists.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* run records: first closed tag decides, cut whole characters, strict --to (#619) (#639)

* run records: first readable estimate tag wins, cut whole characters, strict --to (#619)

- An earlier mention of [run-estimate: no longer hides a later tag that reads;
  with none that reads, the first is refused as before. An unclosed tag ends at
  the next [, for run-kind too.
- Tag length and cuts count graphemes, so a cut never splits an emoji.
- --to takes only a real YYYY-MM-DD day.
- Tests pin that an empty refused tag is logged and counted.

Fixes #619

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* run records: first closed tag decides, refuse typos and empty kinds (#619)

Review of #639: "the first tag that reads wins" let a later example
replace a real tag with a typo ([run-estimate: 30-40m] then
[run-estimate: 1h 2M tokens] recorded 1h). Now only unclosed and
too-long openers are passed over; the first closed tag that fits
decides, and is refused (kept, logged, counted) when it is empty or
does not read.

The kind tag follows the same rule: an empty closed kind, or (with no
closed tag) an unclosed one such as [run-kind: lens [x]], is refused,
kept in a new optional kindRefused field, logged and counted in the
summary, instead of being dropped silently.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Pacing advice: honour enforce's back-off, exact scan wording (#642)

In advise mode the note said "enforce would first scan this folder" even
while enforce was backing off after a scan with no result, when it would
not scan. The advice now reads the back-off and gives the same reason
enforce would give. The scan note now says "if it lists the model and the
task can run there", since a listed model can still be refused for its
options or runtime mode.

Tests: an advise call with a current list that lacks the model, enforce
then advise within and after a back-off, and the "lets this effort run"
and lower-effort notes in enforce with the scan mark set.

Fixes #628

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Fork kit shards: workflow quiet-failure contract, shard slow warning, pinned mutants (#633) (#645)

- fork-contracts: no continue-on-error anywhere in fork-tests.yml, no if: on a step that runs fork tests
- fork-ci-tests.cjs: judge() out of main (tested); a warning when a shard takes over twice its expected time
- weightNote boundary and exact-message tests
- setup.test.py: the killed-upgrade test compares files with a whole run's; same_wsl2_walls docstring says which tests do

Co-authored-by: Claude Opus 5.5 <[email protected]>

* head gate: review trigger live check as a setup step, release note, warning on odd run fields (#379) (#650)

Items 1 to 7 of #379 are on main (#392, #406). Item 8, the live check, needs a project that
copies the trigger, so it becomes a written setup step (README step 8) and part of a new
release-notes entry for the trigger, which every ci/v15+ release ships without one. A review
run whose head fields are missing or odd now judges nothing with a ::warning:: instead of a
plain log line, so a live mismatch of GitHub's fields is seen rather than staying green.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Delegated results: remind for linked children a stop lost, and tighten the reminder (#641)

* Delegated results: remind for linked children a stop lost, and tighten the reminder

- At start, read each linked environment's threads made before the start; a parent here
  that one names as delegatedFrom but no task follows gets one queued message (ids from the
  orphans, so a rerun or the next restart never repeats it). Retries while an environment
  does not answer or the parent is busy.
- The startup check also finds parents with unread results but no reserved wake.
- Results with no delivery state count as unread for a day; an open question holds the
  reminder, background work does not.
- task_list: a linked child still running there is read there; one timeout marks the rest
  of that environment unknown; the orphan search says when it read only the newest threads.

Fixes #625
Part of #386

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* FORK_CHANGES: link the delegated results follow-ups on their row

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Delegated orphans: name each orphan once, queue for busy parents, log what is left

- Each orphan gets its own key in the message and command ids; before a send the
  scan reads the parent's sent message ids and accepted receipts, so a grown set
  (late machine, moved one-day window after a restart) sends only the new ones.
  At most 10 orphans per message; the first scan's per-set id still counts.
- A busy parent (also one waiting on a question) is no longer held: the queued
  message is read once its run ends. Orphans are worked out first, so a busy
  parent with none forces no rescan.
- A later page that does not answer is its own state (cut-short): scanned again,
  and named in task_list's next. After the last scan a warning names the
  environments and parents still unchecked. The page-limit line says so.
- Neutral wording (a failed record also leaves an orphan), a minute's clock
  tolerance between machines, a test for the held-start skip, and the upstream
  gap in the docs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* MCP profile carry: per-machine refuse, Claude-only docs, no-store rule (#640) (#648)

* MCP profile carry: per-machine refuse, Claude-only docs, no-store rule (#640)

- New setting mcpCarriedProfiles ("apply" default, "refuse"). With refuse,
  GET /api/fork/features answers mcpProfileCarry: false, the sender refuses
  a narrower-profile task before sending, and a task that still arrives
  with a narrower or unreadable carried profile (and its sub-agents) is
  refused at its turn. A carried all, nothing carried, or the owner's pick
  for the task run as before. No value lets a task get more tools.
- Docs say plainly that only Claude threads apply profiles, carried
  tasks included.
- The adapter's no-store exception now applies only when neither a thread
  store nor a settings service is wired (default settings, so nothing can
  narrow). With settings but no store, a thread with a parent is refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Docs: settings table row for mcpCarriedProfiles (#640)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork-seams: list packages/contracts/src/reviewRules* as fork files (#652)

reviewRules.ts and its test are fork files (#291 added them), but forkFiles did
not name them, so a pull request that changes them (#647, for #302) is judged as
changing an upstream file. A pull request is judged by its base's list, so this
list-only change goes first.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* reviewRules: follow-ups from #291's lens (kept text, null, lens names) (#647)

* reviewRules: follow-ups from #291's lens (kept text, null, lens names)

- A project save takes back kept unreadable reviewRules text only when it
  is the text stored for that project (server save check); other text, text
  for a project that stores none, or a stale client's after a fix elsewhere
  is refused.
- A hand-written project null reads as not set (the server's) for
  reviewRules, playtest and handoff: Schema.Null comes first in the union.
- A lens name may not be an Object.prototype key (constructor);
  effectiveReviewRules builds lensRunners without a prototype, and
  reviewLensRunner looks a lens up with Object.hasOwn.
- Tests for the resolver's unreadable guard and the kept-value key
  whitelist; decidedIn points at #291.

Fixes #302

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(settings): a project's null for playtest, handoff and reviewRules reads as the server's

A hand-written project null decodes as the key left out, and a client's
clear (null) is dropped from upstream's part of the patch, so the resolver,
PlaytestService and the web panels never see null; they get the server's
value. The kept-text tests now send values through a JSON round trip, as
a real client does. Docs say that old files holding a project null change
from off to the server's value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fleet: launcher reads every kill setting, checks its kill; walls list more account files (#636) (#649)

- start reads RuntimeMaxUSec, RuntimeRandomizedExtraUSec, KillMode, SendSIGKILL,
  FinalKillSignal and LoadState next to the two stop timeouts; each must be printed
  once; a collected unit (LoadState=not-found) has nothing left to check
- "killed" only once ActiveState shows the unit dead; else "could not kill it"
- job_etc refuses a FIFO at passwd, group or hosts instead of hanging on it
- never() and the walls' lists add passwd*/group*/hosts* backups, hosts.equiv,
  /var/mail, /var/spool/mail, /var/lib/sss, dnsmasq.leases, /var/lib/dhcp
- walls: inodes of every /etc/**/private folder; a mixed refusal names both fixes
- tests: hours and longer, kill check, FIFO, two-way list sync; docs name the limits

Co-authored-by: Claude Opus 5.5 <[email protected]>

* head gate: review run log tells a skipped branch name from odd fields, counts the listing (#651) (#657)

- A head branch git allows but the gate does not look up (a no-break or
  zero-width space, an emoji joined by a zero-width joiner, longer than 255)
  now gets a plain line that says so, not the warning that blames GitHub's
  fields. The warning stays for missing or malformed sha, repository or
  branch (a branch with a control character git refuses), and names a
  deleted fork as the one known harmless cause.
- "no open pull request has the head" says how many open pull requests
  GitHub listed on that branch, so setup step 8 can tell a wrong filter
  (none listed) from a wrong head sha or repository (some listed).
- Release notes: the trigger's Upgrade needs a pin at ci/v15 or later (not
  "a release that has this entry"); the refused pin is ci/v14 or before; the
  #379 warning is after ci/v20 (that tag does not have it).
- The docs test checks "is refused" too.

Part of #651.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Pacing advice: scan of a folder still loading slash commands (#644) (#659)

advise answered from a current model list even when its slash commands
were still loading, so the note said "enforce" would hold. enforce scans
that folder first (the registry probes any snapshot that is not settled).
advise now answers from the list only where enforce would: during a
back-off, or from a settled list; otherwise it marks the scan.

Tests: the loading case in both modes, advise's own clock-jump case, and
the test helper refuses a settings change combined with unreadable
settings instead of dying on the mock.

Fixes #644

Co-authored-by: Claude Opus 5.5 <[email protected]>

* MCP profile carry: Claude-only docs, no empty name, fail closed, required key (#653) (#658)

- docs: the mcpCarriedProfiles section says a refused task is refused on
  Claude only; Codex and other providers still run it with every tool.
- A refusal no longer shows profile "" when the carried value has no name.
- When the settings read fails and settings.json does not decode, the
  fallback reads mcpCarriedProfiles as refuse, so a narrower carried task
  is refused rather than cut.
- mcpCarriedProfiles is required in McpProfileSettings.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Project null settings: file encode drops a null; explain the split and the save step's clear (#654) (#662)

- nullReadsAsUnset: encode drops a null too, so no future path can write
  one back to the settings file. The patch keeps its own schema, so a
  client's clear still sends its null.
- splitForkSettingsPatch: the comment says the left-out key is removed by
  upstream's merge only, and that the fork's server save must get the
  unsplit patch to see the clear.
- keepLeftOutForkProjectKeys: the null half of the clear branch stays, so
  the step is right on its own; a test pins it (it was an equivalent mutant).

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Announce the MCP carry call that passes the launch's instance (#668)

The carry call in RemoteDelegation passes the launch's scope, target and
instance, so the sender can refuse a narrower profile to an instance whose
driver does not apply one. Announced here; the pull request for #661 moves
it to "added" and drops the old call line.

Part of #661

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Move the slot gate's active-run read out of ProjectionStore (#663)

The slot gate counted running agents with a fork option on upstream's
ProjectionStore.getShellSnapshot (activeRunOnly). That read now lives in
the fork file apps/server/src/slots/ActiveRunShells.ts: one read-only
transaction finds the threads with a run in an active status (index
scan), reads upstream's shells of just those threads, and keeps the ones
whose shell shows an active run. ProjectionStore.ts and
ThreadManagementService.ts are back to upstream, so their pending
ceilings and lost counts leave .github/fork-seams.json in this same
change (the seam check needs a ceiling lowered with its lines).

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Announce the quiet handoff run's ProjectionStore seam lines (#665)

* Move the slot gate's active-run read out of ProjectionStore

The slot gate counted running agents with a fork option on upstream's
ProjectionStore.getShellSnapshot (activeRunOnly). That read now lives in
the fork file apps/server/src/slots/ActiveRunShells.ts: one read-only
transaction finds the threads with a run in an active status (index
scan), reads upstream's shells of just those threads, and keeps the ones
whose shell shows an active run. ProjectionStore.ts and
ThreadManagementService.ts are back to upstream, so their pending
ceilings and lost counts leave .github/fork-seams.json in this same
change (the seam check needs a ceiling lowered with its lines).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Announce the quiet handoff run's ProjectionStore seam lines

List-only: names the three lines the next change adds to upstream's ProjectionStore.ts, so the
thread shell reads a completed quiet handoff run as a stopped run in both its reads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Quiet handoff run: no browser notice (#666)

A completed quiet handoff run now shows in the thread shell as upstream's
stopped run (latestRunStopRequested), in both of the shell's reads: the
JavaScript one (threadShellFromProjection) and the SQL one
(selectShellThreadRows, which the shell and awareness snapshots use). So
the browser's ThreadNotificationCoordinator keeps upstream's quiet gate
unchanged and gives no notice, as the relay already did.

The rule lives in the fork file fork/handoff/handoffShell.ts
(isQuietHandoffRun moved there from handoffQuiet.ts, which imports
ProjectionStore and so cannot be imported by it), with its SQL mirror.
ProjectionStore.ts gets three seam lines: the import, a spread after
upstream's latestRunStopRequested, and the SQL fragment before
upstream's stop-request EXISTS.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(model-guard): drop an inherited agent option; compare Claude levels with T3's model list (#660)

* fix(model-guard): drop an inherited agent option; compare Claude levels with T3's model list

A delegate_task or create_threads pick that names its model no longer
inherits the parent's OpenCode `agent` or Kiro `mode` option: the fork's
delegation checks drop it on a fresh dispatch (a retry passes untouched),
unless the call names the option itself. The model guard never sees an
inherited option, so it could not refuse it.

The self-check now compares each claudeAgent row's efforts with the
levels T3's model list offers the model (and ultracode when the model has
the ultracode option). A level the model does not offer, a model with no
option list, an unreadable list or no list named is a problem; a model not
in the list is a note. A contract test keeps the server's agent option ids
and the guard's list in step.

Fixes #643

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* model guard follow-ups: a child keeps only the options its call names

While a model policy is on (server setting modelPolicy, advise or enforce),
a call that names its model keeps from the parent only the options the call
names, on every launch path: local delegate_task (both seats, and the target
the usage pacer moves to), create_threads, and remote delegate_task. One
shared rule (ownOptions in fork/delegateChecks.ts) replaces the list of agent
option ids. A call that names no model, a retry of an accepted call, and every
call with the policy off keep upstream's inheritance, so upstream's own
inheritance tests stay as they are. An unreadable setting applies the rule.

The tests move out of upstream's OrchestratorMcpService.test.ts into
fork/delegateOwnOptions.test.ts; OrchestratorMcpService.ts loses a fork line
(pending ceiling 35 -> 34).

Self-check: T3's model match order (exact slug, then the first alias), an
ultracode choice stands for xhigh, only a select offers levels, and a model
list that names none of the policy's models is reported. README fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* model guard follow-ups: keep modelPolicy.ts as on main

Its header comment is not a seam line; the docs say what reads the setting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Refuse a narrower MCP profile to a non-Claude instance; one settings fallback (#669)

* Announce the MCP carry call that passes the launch's instance

The carry call in RemoteDelegation passes the launch's scope, target and
instance, so the sender can refuse a narrower profile to an instance whose
driver does not apply one. Announced here; the pull request for #661 moves
it to "added" and drops the old call line.

Part of #661

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Refuse a narrower MCP profile to a non-Claude instance; one settings fallback

A remote delegation with a profile narrower than all now asks the linked
machine's orchestrator_capabilities which driver the launch's instance runs,
and refuses before sending unless it is Claude, the only provider that applies
a profile there. Under either value of the receiver's mcpCarriedProfiles.

Claude turns, a delegation's check of its own profile and the features route
read MCP profile settings the same way: settings.json is checked on each read,
and one that does not decode (also one broken at load, or with legacy keys the
load refuses) reads mcpCarriedProfiles as refuse, the policy's locks on top.
Only "apply" reads as apply; any other value reads as refuse.

Refusals say more: an unreadable carried profile no longer advises apply, and
a sub-agent's refusal names the reason at the top of the chain once.

Fixes #661

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Seam list: the carry line is added now, not announced

The merge of main (with #668's announcement) left the line in both
"added" and "announced", which the seam check refuses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: scuttletoby <[email protected]>

* Wait on the stored renewedAt, not the renew's finished line (#673)

A renew step logs `finished|renew` before it exits, and the service
stores renewedAt only after the process returned and it got the lock.
The thread-read-hangs test waited for the second finished line and then
read renewedAt, so it could read before the store write (CI flake).

- renewedSince(): waits on the stored renewedAt (set, and past a given
  earlier value); used by every renew test that read the session after
  waiting on the finished line.
- The failing-renew lapse test waits on the stored problem (a different
  exit code per try), not on the finished line.
- runnerControl.holdNextReturn holds a step's answer after its process
  exited; a new test uses it to show the finished line is there while
  renewedAt is not stored, that a sweep meanwhile starts no second
  renew, that a T3 stopped there stores no renew, and that a T3 started
  after the write reads the same renewedAt.

Fixes #671

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Fork CI contract: list-driven test steps, hidden exit status, shard warning and file-mode checks (#646) (#655)

* Fork CI contract: list-driven test steps, hidden exit status, shard warning and file-mode checks (#646)

- quiet contract: every test .github/fork-ci-tests.txt lists as run by
  fork-tests.yml must be run by a step's own command (python3, node or bash
  with the test's path as an argument). A fork test step may not have an if:,
  a working-directory, a shell other than bash, cd/pushd, trap, set +e/+o, a
  pipe, ||, a background &, or anything but its own command on the test's line.
- fork-ci-tests.cjs plan(): a runner file's comment lines no longer name a test.
- main() takes a fake runTest and clock; a test pins the ::warning:: line, the
  summary's Slow line and the 60 s boundary.
- pc-agents tests compare files by kind, mode, owner and content
  (same_files()), with a check that a mode change is seen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Fork CI contract: test steps held to an allowlist, comment-proof plan(), group in same_files()

A step that runs tests is now held to an allowlist instead of a blocklist of
shell tricks: its run is only lines of the allowed test forms, its keys, env
and if: come from a fixed set, its job has no defaults, env or container and
no step that writes GITHUB_ENV or GITHUB_PATH, and the workflow has no
defaults or env. Each listed test must be run whole, with the variable that
switches it on. fork-tests.yml moves its set-up lines into steps of their own.

plan() also drops trailing and block comments, readList spells `run by`
paths one way, same_files() compares the group, and the lint-flagged issue
numbers are gone from the test comments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Fork CI contract: runner parts from the accepted lines, sudo env only for root tests, string-aware plan()

- The check that each listed or present test is in exactly one runner part moves into the contract and reads the
  runner calls from the same parsed, accepted test lines (YAML parsed, quotes removed), job by job, with the
  runner's own inPart. A call kept in a YAML comment, a step name or a comment line counts for nothing. The
  raw-text reader in fork-ci-tests.test.cjs is gone.
- `sudo env` is accepted only before python3 and only for the tests REQUIRED_VARS marks as testing as root.
- plan() reads a JS/TS runner file with a small tokeniser (strings, template literals with nested ${}, regular
  expressions), so `'**/*'` in upstream's release-smoke.ts starts no comment.
- A step is a test step only by its code lines; a refusal says what made it one; a trailing # comment gets its
  own reason; "names a test but runs none" names the allowed forms; the docstring matches the rules.
- setup.test.py says when the group part of the killed-upgrade self-check is skipped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Fork CI tests: jsCode's comment within the 4-line limit

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* pr-queue: notify_command runs once per notice on an armed PR it passes over (#129) (#674)

* pr-queue: notify_command runs once per notice on an armed PR it passes over (#129)

An armed PR that goes red, gets stuck or conflicts is told on the PR, but
nobody with GitHub notifications off learns of it. A new optional config key
notify_command (argv, no shell) runs right after the queue posts such a
notice, with repo, PR, head, kind, reason and link. The posted comment is
the record, so later runs, restarts and other runners never run it again
for the same head and reason. A missing, failing or hanging command
(notify_timeout_seconds, default 30, then its session is killed) is a
warning and never holds the queue. The command gets no token.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* pr-queue notify: say the command is not a sandbox

The command's own environment holds no token, but it runs as the queue's
user, so it can read the queue's environment through /proc and the
checkout's saved token. Say so in the README and release notes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Slot gate: pre-select can no longer drop a running agent (#676)

The gate's pre-select copied upstream's active run statuses, so a status
upstream adds or starts to count as active would drop those agents from
the count with no test going red. It now leaves out only upstream's
finished statuses (isTerminalRunStatus) and lets upstream's own shell read
decide by activeRunId. A test walks every run status against upstream's
shell read. If upstream renames the run status index, the read logs an
error once and counts without it instead of failing and letting every
delegation through. A file-database test covers the reader path.

Also: drop quietHandoffAwareness (the shell already carries the quiet
handoff mark, one rule in handoffShell.ts), and note under the handoff
Limits that a browser offline across the turn end misses that notice.

Fixes #670

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Announce the MCP profile turn check's server.ts seam line (#677)

Lists the one server.ts line that wires fork/mcpProfileTurnCheck.ts
(the next pull request, for #672) under "announced", and says in the
entry's "why" what it changes.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Fleet walls: follow-ups from #649's reviews (#667)

* Fleet walls: follow-ups from #649's reviews

start gives systemd-run until START_BY (80 s after the launcher began)
and checks Type=exec, so a Type= drop-in that keeps systemd-run waiting
is killed and refused instead of outliving the agent's limit unchecked.
kill_unit keeps the kill's exit status and says "killed" only once the
unit is inactive or failed with no cgroup left. The not-found skip also
needs ActiveState=inactive and no cgroup. job_etc refuses any entry
already at the target before the write. The walls' mounts message puts
the way out before the paths. More DHCP lease folders are refused. A
link named private under /etc is not followed. span_ms has one guard,
with a test; the two-way never() list test also checks the die count
and every $1 line's shape.

Fixes #656

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Fleet launcher: kill what a failed systemd-run started; shellcheck in CI (#667)

Fix round for #667's two reviews (#656 follow-ups):
- start: a systemd-run that fails (any exit but the deadline) has its unit
  killed and checked like a deadline miss; "nothing started" only once the
  unit is inactive or failed with no cgroup and its runner user has no
  process left (older systemd lets the cgroup go anyway). Exit 137 is the
  deadline too; never `timeout 0`: under START_MIN (10 s) left, nothing
  starts.
- kill_unit: each systemctl call bounded (CALL_MAX 5 s, none past KILL_BY
  92 s); reads with `show --all`; says "gone" when there was nothing to kill.
- walls: a link named private under /etc makes what it leads to secret,
  not the folders above it.
- job_fs: the folders on the way to a view link are 0755 (mkdir -p -m set
  only the last one, under umask 077).
- CI: shellcheck (pinned, checksummed) on the launcher in the workflows job.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork CI: fleet test weight ~136s (it grew with #667's launcher tests) (#685)

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Slot gate pre-select: no forced index; one-transaction and fail-fast reader tests (#678) (#683)

- The pre-select names no index. SQLite picks upstream's (thread_id, status)
  index on its own; a renamed, dropped or partial index now only slows the read.
  Before, a partial index under the same name failed the read ("no query
  solution") and the gate stopped counting. The existence lookup, the error
  log and its flag are gone.
- Tests: the query plan uses the index before and after ANALYZE; the count
  holds with the index dropped, renamed or made partial; a write committed
  between the id read and the shell read is not seen (one state); the reader
  test fails in 10 s with a message instead of a 120 s hang.
- Docs: what an index change and a failed upstream read do.

Fixes #678

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Refuse a narrowed MCP profile at turn start on a provider that cannot apply it (#679)

* Refuse a narrowed MCP profile at turn start on a provider that cannot apply it

A thread whose MCP profile is narrower than "all" no longer starts (or
resumes) a turn on Codex or any other provider but Claude, which would
give it every MCP server and T3 tool. The check runs on the machine that
runs the turn, as it starts, by wrapping upstream's provider instance
registry (fork/mcpProfileTurnCheck.ts, one server.ts line), so every
route is covered: a provider switch, t3_thread_launch, a local
delegation and a task from an older sender.

Also: a remote delegation that names a driver asks the other machine's
provider list once; doc comments moved above the code they describe;
the README says null reads as apply for mcpCarriedProfiles.

Fixes #672

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profile turn check: keep sessions live, look up named remote instances

- Wrap each non-Claude instance, adapter and session runtime in a
  delegating proxy instead of an object spread, so getters such as
  providerSession stay live for every thread, profile all included.
- Check compactThread as well as startTurn and resumeTurn: some
  providers compact by sending a /compact prompt.
- Remote carry asks the remote for its instance list unless no instance
  is named; a named instance the remote does not list is refused again.
- Allow fork/mcpProfileTurnCheck.ts in the startTurn path test.
- Boot test pins the layer's position: the orchestration layer's
  adapter registry and runtime policy read instances through the check.
- Tests: live getters for each runtime shape and driver, servers=all
  with fewer T3 tools refuses, refusal text names no retry, unlisted
  named remote instance refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* pr-queue notify: review follow-ups (#675) (#680)

* pr-queue notify: review follow-ups (#675)

- Both checkouts of the reusable workflow set persist-credentials: false,
  so no job token sits in the workspace the command can read. The README
  says plainly that the command still runs as the queue's user and can read
  the queue's start-up environment through /proc.
- A command that runs too long is stopped with its session and every process
  still linked to it by parent, so a child in its own process group or
  session (coreutils timeout, setsid) goes too. The README names the
  runner's end-of-job cleanup as the backstop for an orphaned daemon.
- The command's output is echoed between ::stop-commands:: and a random
  resume token: the runner reads ##[cmd] anywhere in a line, so the prefix
  alone did not stop that form.
- All notify commands of one run share a 300 s budget; once spent, a notice
  runs nothing (a warning), so slow notices cannot reach the job limit.
- No temp file for the output is a warning, not the end of the run.
- The link is kept only when it is a page of this repository on
  https://github.com/, else the PR page.
- README: a deleted queue comment or a new write-token login runs the
  command once more for every PR passed over, as one burst.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* pr-queue notify: drop checkout tokens by step, review minors (#675)

The reusable workflow no longer sets persist-credentials: false (its cleanup
runs git submodule foreach, which exits 128 on a repository with gitlinks and
no .gitmodules; the contract test forbids it). A step after both checkouts
removes what actions/checkout saved and fails unless nothing is left.

notify: without /proc the command's process group is still killed; workflow
commands are turned back on even if printing its output fails; the link must
be printable ASCII with no dot segments or encoded slashes; a spent budget
posts nothing, so the next run tells it; an unreadable output is no longer
called "could not start".

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* pr-queue README: format the Notify argument table

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* heavy: clean up everything a command started; heavy leftovers names the rest (#687)

heavy now removes its own scope's leftovers on every end:
- a scope guard (a small setsid child that holds no queue ticket) stops the
  scope and removes its containers when heavy itself is killed, even with -9;
- containers a command starts with the heavy owner label are removed when the
  command ends, is stopped or heavy is killed; a kept scope keeps them;
- a command whose parent died is refused at once (double-forked children are
  stopped with the scope).

`heavy leftovers [--older-than AGE] [--json]` looks only: it names processes,
scopes and containers older than a limit, by owner and age, with default rules
when there are no sweep settings. It never stops anything.

Tests cover a killed heavy, a double-forked child, a container started by a
command, a kept scope, missing or stopped Docker, and a rerun after a kill.

Fixes #159

Co-authored-by: Claude Opus 5.5 <[email protected]>

* secret sweep: one cat-file for all tips, no lazy fetch (#637) (#686)

* secret sweep: one cat-file for all tips, no lazy fetch (#637)

The sweep of 11-20 hit the scan job's 30-minute limit before the scan
script started. #539 added a loop that ran `git cat-file -e` once per tip
the activity record lists (about 1500), with lazy fetching on. In the
blob-less checkout each tip the clone lacked (about 400) was then lazily
fetched with no negotiation: the whole commit and tree history again,
about 36 MB each time, as a new pack. And every lookup of a missing
commit reads every promisor pack, so each later check got slower. Measured
against this repository: 3 s per tip from a fresh clone, 34 s after 30
packs.

The loop now checks all tips in one `git cat-file --batch-check` with
GIT_NO_LAZY_FETCH=1 (a failed check fails the job), fetches the tips it
lacks in one batch, and goes one by one only when the batch fails (a
gone tip fails the whole batch), as the scan script already does.

The 11-18 and 11-19 failures (four fake test values, 127 gone tips) were
fixed by #539. "Open, update or close the sweep issue" did not break: it
opened or commented on the issue each time, then exits 1 by design so
the run stays red.

Tests: fork-contracts.test.py runs the workflow's own lookup code end to
end in a blob-less clone of a local origin, with a gh stub: a fresh clone,
run again, stopped half-way, no gone tip, no tips, no clone. On main's
workflow the checks fail (5 cat-file processes and 5 lazy fetches for 5
tips); they pass now. The pinned text and two new mutants cover the rest.

Fixes #637

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Secret sweep: hand the tip lists to the scan in files (#637)

With the lookup fast, the dispatched sweep got past it and failed at the
next program it started: OLD_HEADS (every before and after of the whole
activity record, 131 KB) was exported as one environment string, over
the kernel's 128 KiB cap per string, so git could not start ("Argument
list too long", exit 126).

The workflow now keeps each id once and writes OLD_HEADS and
SCANNED_GONE to files under RUNNER_TEMP (written afresh each run),
exported as OLD_HEADS_FILE and SCANNED_GONE_FILE. The variables are
still exported while they fit, for a default branch whose script copy
predates the files. The scan script reads the files instead of the
variables when they are set (no longer exporting them), and fails the
job when a file cannot be read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the MCP profile launch check lines (#681) (#692)

Announces the four lines the #681 fix adds to two upstream files: a thread
whose MCP profile is narrower than "all" cannot start a thread that gets
more than its own profile, here or on another machine.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Remote completion delivery: a task is reminded once; end-to-end tests for #386 (#688)

Upstream's follower already delivers a remote child's end at least once: it follows each open
task until the end is recorded, again at every start, and retries with back-off while the link
is down. Its delivery keeps the first result and reserves one wake per result. The fork's
backstop reminder keyed its message on the whole owed set, so a set that grew sent a second
message naming a task already reminded. Reminder ids now name per-task keys; a check reminds only
tasks not reminded yet, in batches of ten, and reads ids in the first format as sent.

New end-to-end tests on the real orchestrator and follower pin the delivery: the link down
when the child ends, the parent server restarted (also half-way through recording the end, and
again after), the machine there restarted, duplicate reports, and a child that ended before
the parent knew its id.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the MCP profile launch mark lines in place of the replaced line (#681) (#696)

The announced checkedElsewhere line replaced upstream's remote caller check in
McpToolAccess.startsThreads, which the seam check refuses. Two added lines take
its place (startsHere on the local path, refuseUnlessHere in the modes step), so
upstream's line stays as it is. The import line stays announced.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Seam check: hold a pending file moved to "files" to upstream's lines in CI (#552) (#689)

* Seam check: hold a pending file moved to "files" to upstream's lines in CI (#552)

A pull request that moves a "pending" file to "files" was only held to how
many lines its new entry lists and that the file has them. With --upstream,
fork-checks now fetches upstream's default branch read-only (commits and
trees only, negotiated from the checkout: about a second) and holds the
entry's "added" to exactly the head's fork lines counted from the merge-base
of main and upstream's head. Only such a change fetches. Unreachable, empty
or unrelated upstream: a warning naming why, and the check as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Seam check: read upstream's URL from main's fork-upstream.json, not the workflow

fork-checks.yml stays as it is: a token in its pull_request_target job is
refused by the schema check's own test, and any change to that file is the
owner's. The seam check now takes upstream's git URL from
.github/fork-upstream.json at the list's commit (main, never the pull
request's copy) when a change moves a "pending" file to "files"; --upstream
still overrides it by hand. A malformed file refuses only such a move; no file
keeps the old note. Comments no longer name the issue (lint).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* MCP profiles: a broken settings.json or a launch never widens a thread to all (#681) (#694)

* MCP profiles: a broken settings.json or a launch never widens a thread to all (#681)

A settings.json that did not decode gave every setting its default, so a
thread kept to a narrower MCP profile ran with "all". The MCP profile keys
are now read from the file's text the way a full decode reads them; text
that names a profile key but cannot be read as an object, or a file that
cannot be read from disk, refuses the turn, delegation or launch until it
is fixed. Text that names no profile key sets none, so a typo elsewhere
stops no thread, including the one that fixes the file.

t3_thread_launch from a thread whose profile is narrower than "all" is
refused when the new thread's profile in the target project is not within
the launcher's, and a launch on another machine is refused for such a
thread (that machine would give it its own profile). A launcher whose
profile cannot be worked out is refused, never taken as "all".

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: a narrowed thread's new schedule_task on another machine is refused too (#681)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork seams: the announced MCP profile launch lines are now added (#692 merged)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* mcp profile launch: keep upstream's remote caller check line as it is (#681)

The seam check refuses a replaced upstream line. startsThreads' own path now
marks its caller (startsHere), and its modes step refuses a narrowed caller
nothing marked (refuseUnlessHere), so the remote check refuses a launch or a
new schedule_task on another machine with upstream's line unchanged, and any
other path to the modes fails closed. Tests: schedule_task there is refused
too (an update still goes), and a launch here does not unlock the next call
there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profiles: keep the last read keys for a cut-off settings.json; check create_threads

A settings.json that is empty, cut off before its MCP profile keys, or
garbage no longer gives every thread `all`: the server keeps the MCP
profile keys it last read in this run, and a server started on such a file
refuses until it is fixed. A file that decodes now counts for its MCP keys
over the service's cached settings, so a fix counts before the watcher
reloads.

create_threads from a thread narrower than `all` is refused when its new
top-level thread would get more, through the fork's beforeCreateThread
check, from one settings read with the launcher's. A new thread whose
profile cannot be worked out is refused.

Fixes #681

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profiles: a missing settings.json keeps the keys read; a whole typo file sets none (#681)

- Once this run has read a file's MCP profile keys, a missing settings.json (an editor's
  rename-then-write gap, or a delete) keeps them, with carried profiles read as refuse and the
  policy's locks over them, instead of resetting to the defaults' all. A server that started
  with no file is still a fresh install.
- A whole file with a JSON syntax typo (braces close back to depth 0 at its last character, a
  `}`) whose text names no MCP profile key sets none, so T3 keeps working after a restart as
  upstream does. Text that may be cut off, or names a key it cannot read, still fails closed.
- Reads are numbered as they start, so a read that ends late never stores older keys last.
- Tests: the narrowed -> removed -> empty -> cut off walk, whole typo files at restart, cut-off
  and unreadable files at restart, every strict prefix of a file is not whole, the kept path's
  carried refuse and policy locks, and two reads at once. README says exactly this.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork seams: announce the schedule_task and fork MCP profile lines (#693) (#697)

* fork seams: announce the schedule_task and fork MCP profile lines (#693)

Lists the five lines the #693 fix adds to two upstream files, both new
entries with "added": [] (step 1 of "Adding a seam line").

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork seams: announce the run-now and forwarded-call MCP profile lines (#693)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Secret sweep: stop re-checking deleted tips every run (#691) (#701)

* Secret sweep: stop re-checking deleted tips every run (#691)

The sweep's cost grew with the deleted tips GitHub's activity record still
lists: each was fetched again and its runs looked up again every day (about
231 of 250 API calls), and one deleted tip in the batch fetch sent every
served tip to the one-by-one fetch.

Now the sweep asks GitHub's GraphQL API about every tip the clone lacks
first, fetches the ones it still shows in one batch, and asks git once about
a tip GitHub has no commit for (a network error fails the job). A record of
the deleted tips (restored and saved by actions/cache around the scan step,
sweep runs only) spares the fetch and, for a tip a scan read, the runs
lookup on later runs. The record is trusted only for tips GitHub still has
no commit for; a record that cannot be read is a warning, removed, and every
tip is checked as on a first run. The scan script takes the deleted tips
(DELETED_TIPS_FILE) and does not fetch them again; one the clone has is
still scanned.

Also: the hand-over fails the job when a list too long to export would reach
a default-branch script that reads only the variables, and uses
${RUNNER_TEMP:?}.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Contract tests: a mutant with nothing to break on an older workflow is not a crash

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Keep the sweep's record as its own run artifact, not a cache (#691)

Review of #701: any job of a branch can write a cache its runs restore,
actions/cache unpacks with tar -P anywhere on the runner, and the
repository's caches outgrow their 10 GB, so the record was evicted within
hours. The record is now an artifact of the sweep's own run (90 days). The
scan job's first step, before the checkout and with only its read-only
token, takes it from the newest completed run of fork-secret-sweep.yml
(schedule or workflow_dispatch, this branch, this repository, whose commit
this run's has). It reads the one plain file from the zip in memory, never
unpacks it, and checks every line. Any doubt means a first run.

- When a lookup fails (the API budget, say), the tips already proven
  are written to the record before the job fails, so the sweep catches up
  over a few days.
- A deleted tip that the record does not have as read by a scan is fetched
  every run, so one that git serves again is scanned again.
- reset_record (workflow_dispatch) starts the record afresh.
- Record format 2: only scanned lines.
- End-to-end tests cover the read step (each guard removed turns a case
  red), the partial record, the leftover .new, write-then-rename and NUL
  bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Let the record's tests run in full against code without the read step

They counted a missing step as a crash. Now each such check fails on its own, so the
whole suite can be run against older code: 134 checks fail at the PR's earlier
head, 141 on main, and none here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Give the contract tests a CI weight, and stop each read-step mutant at its first red case

The read step's 52 cases ran in full for each of the 22 mutants, and the file took 72 s on CI
with no weight. Now each mutant stops at its first red case, and the list has ~45s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* MCP profile: schedule_task and fork refuse a thread wider than the caller's (#693) (#700)

* MCP profiles: a broken settings.json or a launch never widens a thread to all (#681)

A settings.json that did not decode gave every setting its default, so a
thread kept to a narrower MCP profile ran with "all". The MCP profile keys
are now read from the file's text the way a full decode reads them; text
that names a profile key but cannot be read as an object, or a file that
cannot be read from disk, refuses the turn, delegation or launch until it
is fixed. Text that names no profile key sets none, so a typo elsewhere
stops no thread, including the one that fixes the file.

t3_thread_launch from a thread whose profile is narrower than "all" is
refused when the new thread's profile in the target project is not within
the launcher's, and a launch on another machine is refused for such a
thread (that machine would give it its own profile). A launcher whose
profile cannot be worked out is refused, never taken as "all".

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: a narrowed thread's new schedule_task on another machine is refused too (#681)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork seams: the announced MCP profile launch lines are now added (#692 merged)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* mcp profile launch: keep upstream's remote caller check line as it is (#681)

The seam check refuses a replaced upstream line. startsThreads' own path now
marks its caller (startsHere), and its modes step refuses a narrowed caller
nothing marked (refuseUnlessHere), so the remote check refuses a launch or a
new schedule_task on another machine with upstream's line unchanged, and any
other path to the modes fails closed. Tests: schedule_task there is refused
too (an update still goes), and a launch here does not unlock the next call
there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profile: schedule_task and fork refuse a thread wider than the caller's (#693)

schedule_task (a task whose runs start new threads, on create and on a
change, unbinding included) and t3_thread_transfer's fork are refused on
this machine when the new thread would get more than the calling thread's
MCP profile, as t3_thread_launch is. A profile that cannot be worked out
refuses, never counts as all. The logic is in fork/launchMcpProfile.ts;
the handlers get one line each.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profile: run_scheduled_task_now and forwarded calls keep to the caller's profile (#693)

run_scheduled_task_now on a task whose runs start a thread wider than
the caller's profile is refused, as a change to it is. A fork, a
scheduled task change or a run now sent to another machine is refused
for a narrowed caller, as a thread started there gets that machine's
profile.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profile: a remote task update from a narrowed thread is refused in #694's test too (#693)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profiles: keep the last read keys for a cut-off settings.json; check create_threads

A settings.json that is empty, cut off before its MCP profile keys, or
garbage no longer gives every thread `all`: the server keeps the MCP
profile keys it last read in this run, and a server started on such a file
refuses until it is fixed. A file that decodes now counts for its MCP keys
over the service's cached settings, so a fix counts before the watcher
reloads.

create_threads from a thread narrower than `all` is refused when its new
top-level thread would get more, through the fork's beforeCreateThread
check, from one settings read with the launcher's. A new thread whose
profile cannot be worked out is refused.

Fixes #681

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork CI: prove each listed fork test really ran, from runtime records (#682)

* fork CI: prove each listed fork test really ran, from runtime records

The runner (fork-ci-tests.cjs) now writes a small record of every listed
fork test it runs: exit code, tests found, skipped and failed, read from
the test's own output. Each part writes one, and so does each own run
(`--run <test>`). Each job uploads its records as
fork-test-records-<job>-<leg>-<attempt>, and fork_ci_result downloads them
all. It goes red when a listed test has no record, ran no test, skipped
more than it may, or failed; when a job or leg uploaded nothing; or when a
record belongs to another run, attempt, job, leg or head.

Tests declare how CI runs them in `fork-ci:` lines (run as root, with
their own <NAME>_TESTS switches, one class; skips at most n). These
replace the fixed REQUIRED_VARS table in fork-contracts.test.py, which
keeps the static check as the fast first one and now also pins the
records wiring.

Fixes #664

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI contracts: a mutant that cannot be made is a named FAIL

On a workflow from before #664 (no records step), the quiet mutants and
the reason checks now report their missing step as a FAIL instead of
stopping the test with a traceback.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI runner: shorter comments (lint)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: comments without issue numbers; fork-fleet weight to its CI time

fork-fleet.test.py takes 140-170 s on CI (main included); its ~67s weight
failed the weight check on a fast runner.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI records: compare with the commit the jobs test

needs.changes.outputs.sha is set only on release runs; on pull_request
and push every checkout takes github.sha. The records check now compares
with needs.changes.outputs.sha || github.sha, as the checkouts do, and an
empty or short SHA is red.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: count each skipped test by name, tight per-test skip lists (#664)

Review fixes for the runtime-proof records:
- Python tests run through fork-ci-unittest.py, which counts every test of
  each unittest run by its own outcome, so a setUpClass or module skip, a
  failed setUpClass or a stop half-way counts each test it left unrun.
- ok-lines tests end with "all passed: <n> ok, <n> skipped", checked against
  their ok and skip lines; a test that stops early or miscounts is red.
- "fork-ci: may skip <Class.test>" replaces "skips at most": a record must
  skip exactly the declared tests, by name, both ways.
- "run by" for a fork test is refused unless fork-tests.yml or the
  RUN_ELSEWHERE table names that workflow.
- Tests for the record's sha and for owed coming from the plan; the
  contract pins MAY_SKIP, RUN_ELSEWHERE, the reach of the workflow script
  (AST) and 7-day record retention.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: kit-as-root checks out the unittest shim; contract pins it (#664)

The kit-as-root job's sparse checkout left out fork-ci-unittest.py, so its
Python own runs could not start. The contract now requires every job that
calls the runner to check out the runner's files (its list, itself and the
shim), with mutants for each way to drop one. Formatting of the runner and
its tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: runner comments within the lint's four-line limit

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: count node tests by reporter, Python runs by plan; run by only per table (#664)

- node: a reporter (fork-ci-node-counts.cjs) counts the tests that ended. A file node reports
  only as itself (empty, a top-level return, an early exit), or tests that started but never
  ended, count nothing, so the record is red. node's stdout totals are no longer read.
- Python: the shim writes a plan line before each run and the counts after it. A plan
  without its counts (a hard exit) counts nothing, so it never falls back to ok lines.
- Skip names keep the module when it is not __main__.
- `run by` another runner only where RUN_ELSEWHERE names it, for every listed test.
- The record check's script reach check is tightened and renamed to what it checks.
- Fixtures kill the three surviving mutants. The fleet-refresh skip's image dependence is noted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* knip: the node test reporter is used by fork-ci-tests.cjs (#664)

fork-ci-tests.cjs passes .github/scripts/fork-ci-node-counts.cjs to
node --test as a reporter path, which knip does not trace.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* knip: trace the node test reporter from its test, not knip.jsonc (#664)

knip.jsonc is an upstream root config, so it must not name a fork file
(fork-owned reads check, seam check). The test now copies the reporter
through require.resolve with a literal, which knip follows as an entry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Slot gate: a thread list that cannot be read refuses the delegation (#705)

* Slot gate: a thread list that cannot be read refuses the delegation

When a delegation needs the running-agent count and the slot gate cannot
read it (upstream's shell read fails, crashes, or takes longer than the
5 s read timeout), the gate now refuses with slots_full instead of
letting the call through on the free-memory floor alone. The message
says the thread list could not be read (error or timeout), that no agent
was started, and that the caller can try again in a moment.

The read now runs in its own fiber that is stopped, not awaited, at the
timeout, so a read that cannot stop at once no longer keeps the refused
call (or the gate's semaphore) waiting. A refused call records nothing:
no starting entry, no held slot used up, no store write.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: at most one count read in flight; callers join it

A refused call no longer leaves a read of its own running. While a count
read runs, every caller that needs the count (delegations, slot waits,
wait_list, the observer) joins that one read with its own 5 s limit. The
marker is cleared when the read ends, whichever way, a late answer too.

A read that ends by an interruption is now a refusal in plain words:
"timeout" when a caller stopped it at the timeout, "error" when it
interrupted itself. A caller cut off while it waits leaves at once and
leaves the read to the next caller. The two Effect.interruptible wrappers
are gone: a forked fiber starts interruptible by default.

Tests: seven refused callers against a stuck read leave one read running
(7 on the old head), a cut-off caller, a joiner of a read stopped by
another caller, a read that interrupts itself, the timeout through
delegate_task, and a refusal in observe mode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Slot gate: no joined count older than the read limit; one read start at a time

A delegation that joined a shared count read whose starter was cut off could get a
snapshot from long before it arrived and go over the limit. The gate now records when
the read started; an answer later than COUNT_READ_TIMEOUT after that start is a timeout
refusal, as on main where no count was older than its own 5 s read.

The check and the setting of the in-flight marker now run under their own lock, so a
scheduler yield between the fork and the marker cannot start a second read. A test
pins the uninterruptible mask around the shared read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fork CI: one automatic re-run for known infrastructure failures only (#130) (#707)

* fork CI: one automatic re-run for known infrastructure failures only (#130)

A failed Fork tests run gets one GitHub "re-run failed jobs", only when
every failed job shows an infrastructure sign: lost runner, full memory
box (OOM kills, memory.max hits, memory.high throttling while stalled),
or a time limit hit while the machine was stalled. Never for a test
failure, never twice, fail closed on unreadable signs.

- fork-ci-pressure.py: start/end steps in each app job of fork-tests.yml;
  prints the memory pressure numbers in the log and leaves them as a notice
  when the job did not succeed. Never fails the job.
- fork-ci-rerun.py + fork-ci-rerun.json: the decision with every rule in
  one script and every project fact in config; warning annotation and job
  summary per re-run, with a 24 h count.
- fork-ci-rerun.yml: scheduled sweep (offset from the fleet sweep) plus
  workflow_dispatch for one run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI: name the pressure note fork-ci-pressure (#130)

fork-owned-reads.test.py reads "fork-ci pressure" in the `!`-listed probe
as the fork-owned fork-ci/ folder; the script's own name is no read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI re-run: signs only from GitHub's own words and the job's record, one tracking issue (#130)

Review fixes for the one automatic re-run:
- Text is never a sign: a message counts only in the runner's form (failure,
  no title, .github), as a whole GitHub message (fullmatch), and only when the
  job's steps agree (lost: no failed step, no time limit, its runner, the end
  step never ran; limit: the job or step really ran that long, no other step
  failed). A failing test that prints GitHub's words, or a forged note, is
  left red.
- Memory full needs the job's own note (its end step completed, one note) to
  show a limited box stalled AND events in it, on a runner that is not
  GitHub-hosted; a machine-wide OOM kill or one event alone is no sign. A
  person's cancel never qualifies.
- Every re-run (and fleet-mode report, once) is first a comment on one
  tracking issue, written before the request; the 24 h count reads it.
- Every page of a listing is read (deduped, a cap that errors); trust is the
  fleet's own run_refused; a dispatch has a concurrency group of its own;
  the probe steps get a 1-minute timeout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fork CI re-run: time limits from the workflow file, quoted text made safe (#130)

- A time-limit message counts only when its minutes are the job's (or the
  step's) own timeout-minutes in the workflow file at the run's commit, read
  through the contents API by a strict reader (checked against PyYAML on the
  real workflow). A failing step printing GitHub's exact "after 1 minutes"
  line is no longer re-run.
- Text quoted into the public tracking issue is one line, with no @mention
  and no HTML; only a comment's fir…
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.

Slot gate: a failed shell read lets the delegation through (decide fail closed)

1 participant