Repository navigation
Closed
Description
Follow-up to #711 / #717. #717 gates the routes #711 names, plus the delegated-result reminder, PR-watch wake-ups and usage-limit resume. These four routes can still start a run in an idle thread with no slot:
- The fork's context handoff (
apps/server/src/fork/handoff/HandoffService.ts,start_immediatelywith fresh context). The idle-timer trigger (fork/handoff/handoffDecision.ts) fires after the thread's turn ended, when its slot is already free. It is fork code and opt-in, so it can be gated without a seam. - Provider continuation (
orchestration-v2/ProviderContinuationService.ts, "Background task completed"). An agent that ends its turn while its own background work runs starts again when that work ends. This is common and has no bound. It needs a seam. - Delegated question replies (
orchestration-v2/DelegatedTaskQuestionReactor.ts) wake an idle parent. Needs a seam. - Idle compaction (
orchestration-v2/IdleCompactionService.ts,start_immediately). Needs a seam.
For each route: gate it like the other wake-ups (a refused one waits for a slot, is never lost and never sent twice, and survives a restart), or write down in docs/fork/README.md why it stays open.
Minors from the #717 round-2 reviews
Review B (comment):
- m1. A refused PR-watch wake costs API quota. Upstream's reactor logs a warning on every sweep, and while a slot stays refused it reads the pull request in full again (detail + activity) every 2 min (
fork/pullRequestWatchSlot.ts,PullRequestWatchReactor.tssendOne). Several watched PRs on a full host spend GitHub API budget and fill the log. Either back off, or say so in the README. - m2. A granted thread that is then deleted or archived holds 2 slots until its hold expires (
reserveSeconds, 120 s by default).WaitServicehands the wait over asgone, but nothing drops the gate's memory hold, which also counts a wake-up that will never come. This fails safe and ends by time. Fix:gate.drop([key])on thegone/stoppedhand-over. - m3.
SlotGate.ts:721(childThreadId: intoon the entry made indecide) has no failing test when it is removed. Add a test that runs a secondacquirebetweenacquireandstarted.
Review A (comment):
- The orphan scan's retry has no cap and no log for
unreadable(fork/delegatedResults/DelegatedOrphanScan.ts,untilSlot). A parent that stays unreadable (a deleted project, a broken linked machine) loops until the server stops, with nothing in the log. Log once, or stop after N tries and leave it to the next start. - The orphan scan's retry reuses its first list (
checkParent(parentThreadId, first.linked)). An orphan of the same parent that ends while that parent waits for a slot is left until the next server start. - The PR-watch sets are never pruned (
fork/pullRequestWatchSlot.ts,endingRefused/waiting). A watch that is removed, or whose thread is deleted, keeps its key until restart. Small memory cost only. - A slot wait whose wake-up waits keeps its hold only in memory. A
deliveringwait's hold expires afterreserveSecondsand is gone after a restart, so its wake-up then competes like any other start. This means a late wake-up, never one over the limit. Add a README sentence.
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
No labels
Activity
Fork docs: name the four routes that still start a run with no slot
Fork: gate agent messages and wait wake-ups that start a run in an id…
Fork: one held-wakes save at a time; keep a bad file; log unreadable …
Fork: gate the last four routes that start a run in an idle thread (#724
Fork: gate agent messages and wait wake-ups that start a run in an id…
Fork: gate the last four routes that start a run in an idle thread (#724
Fork: gate agent messages and wait wake-ups that start a run in an id…
Fork: gate the last four routes that start a run in an idle thread (#724
Fork: gate agent messages and wait wake-ups that start a run in an id…
Fork: gate the last four routes that start a run in an idle thread (#724
Fork: gate agent messages and wait wake-ups that start a run in an id…
Fork: gate the last four routes that start a run in an idle thread (#724
Fork: gate agent messages and wait wake-ups that start a run in an id…
Fork: gate the last four routes that start a run in an idle thread (#724