Repository navigation
Fix auto-resume: resume all resumable checkpoint states - #451
Conversation
…checkpoints recover_interrupted() only caught Running→Interrupted transitions. On second restart, checkpoints were already Interrupted and got skipped. Now resumes Running, Interrupted, AND BudgetExhausted checkpoints.
There was a problem hiding this comment.
Pull request overview
Updates Sentinel checkpoint recovery so auto-resume can pick up not only pipelines that were Running when the process died, but also pipelines already in other resumable states.
Changes:
recover_interrupted()now returns handles for checkpoints inInterruptedandBudgetExhaustedstates in addition to convertingRunning → Interrupted.- Renames local accumulator from
interruptedtoresumableto reflect broadened semantics.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// Scan for orphaned pipelines (status=Running on disk means process died mid-execution). | ||
| /// Returns handles that were marked as Interrupted. | ||
| pub fn recover_interrupted() -> Result<Vec<String>, String> { | ||
| let checkpoints = list_checkpoints()?; | ||
| let mut interrupted = Vec::new(); | ||
| let mut resumable = Vec::new(); |
There was a problem hiding this comment.
The doc comment is now misleading: recover_interrupted() returns handles that are already Interrupted or BudgetExhausted, not just ones newly marked as Interrupted. Please update the comment (and possibly the function name) to reflect that it returns all resumable checkpoint handles.
| } else if cp.status == PipelineStatus::Interrupted | ||
| || cp.status == PipelineStatus::BudgetExhausted | ||
| { | ||
| // Already interrupted or budget-exhausted from a previous restart — still resumable | ||
| resumable.push(cp.sentinel_handle); | ||
| } |
There was a problem hiding this comment.
New behavior adds Interrupted/BudgetExhausted checkpoints to the returned list without modifying them. Please add tests that (1) create a checkpoint with status Interrupted and verify it is returned, and (2) create one with status BudgetExhausted and verify it is returned and not rewritten unexpectedly.
…anual flip becomes algorithm (#451) The first graded pass needed an operator flip: Atlas wrote his artifact but the grade only ran when a human closed his card. The sweeper encodes exactly that hand-move: benchmark_grade ticks every 180s (a periodic actuator — lease expiry is a time fact with no wire event) and closes any bench-titled card whose claim LAPSED (card_holder::hold_of, the one lease predicate) with an owner and a real artifact behind it (gym: non-empty solution_file; SWE: dirty workspace tree — an untouched clone graded would burn a fake capability-zero, the #384 class). The close is the whole action: its wire echo drives the proven bridge → bus → receiver → grade tail. ONE grade path; the sweeper only detects. A live claim is never preempted; a citizen's own done still beats the sweep; normal work cards are never touched; ≤3 closes/tick so a backlog trickles instead of storming the room. Provenance note posted before each close. sweep_ready is a pure truth table with a pinned test. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… success, loud error probes (#451) First live tick: 21 sweep_close probes in 0.6s, sailing past the 3-close cap. The cap only counts SUCCESSES, so 21 probes means the closes themselves were refused — and the Err path had no probe, so the entire failure mode was invisible (my own glass-box rule, violated in my own module). Worse, the provenance note posted BEFORE the close attempt: a persistently-failing close would have spammed every old bench room once per tick. Reordered: change_work_card_state first; provenance note only on Ok (still lands before the verdict — grading takes seconds); sweep_close_failed probe with the refusal error on Err. Next tick's probes will name WHY airc refuses. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… — the WRITE half of #345 (#451) The instrumented tick named the refusal in one pass: 'work card X is not in current room …; switch to the card's room before mutating it' — airc's change_work_card_state guards against the author's CURRENT room, while the sweeper's targets live in per-run bench rooms. Reads grew room-scoped variants (work_board_in); mutates never did. Fixed at the native seam (contribute-up): airc #1363 adds change_work_card_state_in(room, req) — same guard strength, room as a parameter — merged to airc canary as 103fd898. Continuum: bump airc rev 574ce235 → 103fd898; sweeper closes via the room-scoped verb against the room whose board it just read. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…2322) * feat(cognition): causal memory slice B — compact typed receipt heads + room-scoped archive + scope-first ledger (#447) Receipt heads now store the compact call form (name(args), 48-char arg cap) instead of full prose dragging its ~250-char because-clause — ~5x more act history in the same char budget. Heads carry an Option<room> tag; the StepsLedger renders scope-first (this room's acts at real depth, cross-room remainder as one honest line, unscoped heads never hidden at the upgrade boundary). VolatileSnapshot round-trips the room tags via a parallel receipt_head_rooms array (serde-default, old snapshots restore as unscoped). Also fixes a 100%-reproducible SELF-DEADLOCK found by the suite: snapshot() took receipt_heads.lock() twice inside one struct literal — the first guard (a literal temporary) lives until the whole expression ends, so the second lock waits on ourselves forever. Every deploy-pause snapshot would have wedged. One lock now builds both parallel arrays. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(work): grader hears the STORE not the VERB — bridge wire CardStateChanged onto the bus, single emitter (#450) Found positive-controlling the done→grade tail with Asha's real rle_roundtrip artifact: 'airc work state <card> closed' changed the board and reached every persona's stream, but benchmark_grade never fired — it subscribed to the internal bus event only continuum's work/state verb emitted. One fact, two disjoint event planes: a card closed by the operator CLI or a remote peer graded NOTHING. bridge_wire_work_event in modules/work.rs is now THE one emitter of work.card.state_changed: pure decode via airc-work's real codec (transcript_is_work_event → decode_transcript_work_event → CardStateChanged), once-per-event-id dedup (every resident persona's subscribe stream echoes the same wire event), publish through the existing WORK_EVENT_BUS. Called from the persona inbound raw-event loop — the only channel-complete receiver this core has (the daemon attach covers ONE room) — before the perceptual filter and the self-skip, so a citizen's own work/state echo counts. The verb-side emit is deleted; payload upgrades to the full hyphenated card UUID + snake_case CardState serde form (the exact is_terminal/parse_state vocabulary). Tests pin the decode contract against the real encoder, the non-state/non-work refusals, and the first-sighting dedup. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(grade): room-scoped grading — read the CARD'S board, post the verdict IN the run room, glass-box every step (#450) Live diagnosis after the bridge fired for Atlas's real balanced_brackets close: the grade task parked forever with zero receipts. grade_card read the board via work_board_complete — which airc-lib's own doc names as the #345 wrong-room trap: it resolves current_room(), i.e. whatever room the grading citizen sits in (academy), not the bench room the card lives in. The bridge payload now carries the event's room_id (the card's own room — the wire event knows). grade_card resolves that room from the citizen's subscription set (same pattern as claim_following_card_room), reads work_board_in(&room), and posts the verdict via publish_text_in_room into the RUN room the citizens are standing in — Joel's #329 slice-3 targeting, no more current-room dependency anywhere in the grade path. A missing/unresolvable room fails LOUD instead of grading a guessed board. Glass box per Joel ('this is why we have probes'): benchmark_grade.start, benchmark_grade.verdict (both arms), benchmark_grade.error — the tail can never again park silently. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(grade): subscribe on the LIVE bus tier — grade-on-done shipped on a dead dispatch path and never once fired (#450) Third and final dead link in the done→grade tail, proven live: two bridged publishes reached the bus, zero handle_event probes. Root cause is the runtime's own documented trap (runtime.rs:99): config().event_subscriptions installs synchronous-tier subscriptions the registry marks synchronous=false — which publish() filters OUT. 'The (currently unused) synchronous publish path.' Grade-on-done was born on it (#439) and has never fired in production. Fix is the runtime's own prescription: initialize() spawns a bus-receiver task (same shape as chat::spawn_persist_listener) filtering WORK_CARD_STATE_CHANGED; the reaction logic is extracted into on_card_state_changed, shared with handle_event (kept for the synchronous tier should it ever dispatch). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(grade): sweep lapsed bench claims with written artifacts — the manual flip becomes algorithm (#451) The first graded pass needed an operator flip: Atlas wrote his artifact but the grade only ran when a human closed his card. The sweeper encodes exactly that hand-move: benchmark_grade ticks every 180s (a periodic actuator — lease expiry is a time fact with no wire event) and closes any bench-titled card whose claim LAPSED (card_holder::hold_of, the one lease predicate) with an owner and a real artifact behind it (gym: non-empty solution_file; SWE: dirty workspace tree — an untouched clone graded would burn a fake capability-zero, the #384 class). The close is the whole action: its wire echo drives the proven bridge → bus → receiver → grade tail. ONE grade path; the sweeper only detects. A live claim is never preempted; a citizen's own done still beats the sweep; normal work cards are never touched; ≤3 closes/tick so a backlog trickles instead of storming the room. Provenance note posted before each close. sweep_ready is a pure truth table with a pinned test. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(grade): sweep closes were failing SILENTLY — close first, note on success, loud error probes (#451) First live tick: 21 sweep_close probes in 0.6s, sailing past the 3-close cap. The cap only counts SUCCESSES, so 21 probes means the closes themselves were refused — and the Err path had no probe, so the entire failure mode was invisible (my own glass-box rule, violated in my own module). Worse, the provenance note posted BEFORE the close attempt: a persistently-failing close would have spammed every old bench room once per tick. Reordered: change_work_card_state first; provenance note only on Ok (still lands before the verdict — grading takes seconds); sweep_close_failed probe with the refusal error on Err. Next tick's probes will name WHY airc refuses. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(grade): sweep closes through airc's room-scoped mutate (airc #1363) — the WRITE half of #345 (#451) The instrumented tick named the refusal in one pass: 'work card X is not in current room …; switch to the card's room before mutating it' — airc's change_work_card_state guards against the author's CURRENT room, while the sweeper's targets live in per-run bench rooms. Reads grew room-scoped variants (work_board_in); mutates never did. Fixed at the native seam (contribute-up): airc #1363 adds change_work_card_state_in(room, req) — same guard strength, room as a parameter — merged to airc canary as 103fd898. Continuum: bump airc rev 574ce235 → 103fd898; sweeper closes via the room-scoped verb against the room whose board it just read. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Fable 5 <[email protected]>
…t-on-change probes (#2323) * fix(persona): claim renewal is EARNED by cognition, not by breathing (#451 follow-up) The presence-bound renewal ('her work stays hers while she breathes') fixed #331 by overcorrecting into lease-immortality-while-idle: overnight, 600/600 inbound events filtered non-turn, zero turn.starts for hours, three leases renewing on the minute — a stalled round reading as 'actively held' forever, with three finished artifacts the lapsed-claim sweeper could never recover. persona/cognition_pulse.rs (one concern, one module): per-persona 'when did she last THINK' stamps. Stamped at spawn (one lease-length of grace covers the post-boot deaf window, #412) and at every service-loop turn start — a turn that defers on serving pressure still counts; only true silence lapses. The renewal loop gates on it: no cognition within one lease-length → skip renewal (loud renewal_skipped_idle probe) → the hold lapses naturally → the card is re-claimable (#2286) and any written artifact gets graded by the sweeper. Contract pinned by a pure truth-table test. Same round, before this landed: Anon organically closed expr_eval and the grade tail posted RESOLVED:true in 1s — the citizen loop works; this fix makes its recovery path honest when a citizen goes silent. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(cognition): recent-results feedback channel — act results survive acts and turns (#414b, the Anwen regression) The missing feedback, measured from her own captures: act result bodies lived only in the K=1 last_action slot (any act overwrites — a list_files destroyed her compile error) and the settlement-gated pinned block (gone once she spoke). Heads persisted (slice B archive); RESULTS did not. She re-ran the same unfixed code three turns running, wandering discovery tools between, blind to the error she had already been given. recent_results: char-bounded deque of (seq, room, result TAIL) in working memory — window-derived share (ContextBudget::recent_results_chars, 1/32), tails are the result's final chars (errors/conclusions live at the end), eviction oldest-first by total chars. Rendered every turn as its own trailing block before the pinned full-latest — small, append-only, KV-prefix stable, deliberately NOT settlement-gated (the #139 full-dump objection doesn't apply to ~300-char tails). Snapshot/restore round-trips it (serde default for old snapshots). Regression test pins the contract: a finding survives later trivial acts; the buffer respects its bound. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(substrate): kill restart-resurrection of lapsed claims + emit-on-change probes (#399, overnight stalemate root cause) Two defects burned the night of 2026-08-15→16 (round stalled 'actively held', zero convergence, and the evidence rotated away before morning): 1. RESTART RESURRECTION: the honest-heartbeat birth grace stamped a cognition pulse at spawn, so every core restart re-armed 30 minutes of 'earned' claim renewals — and the renewal loop resurrected already-lapsed claims faster than the 180s sweeper could observe them. Convergence-by-lapse was structurally impossible across restarts. REMOVED: renewal is earned only by actual cognition (turn.start pulse); never-stamped ⇒ denied ⇒ holds lapse within one TTL of boot unless she thinks. Live-verified: leases lapsed at 08:30, sweeper closed+graded both artifacts 13s later, board went 4/4. 2. ARCHEOLOGICAL PROBE STREAM: serving.plan emitted identical rows per tick — measured 2.6 rows/s, 51% of the stream — so the probe file held 17 minutes of history and every incident became forensics on destroyed evidence. Emit-on-change everywhere (Joel: 'dynamic and easy to probe, not archeological'): - plan probe fires only when its fingerprint changes (windows quantized to 1k buckets in the fingerprint only — token-level free-memory wobble is noise, not a plan change) - warm-slot-oversubscribed moved OUT of the pure planner (called 2x/tick on different budgets — any per-call dedup alternates and floods) onto the daemon's adopted-plan path behind the same gate - renewal_skipped_idle fires once at the denial TRANSITION, with a paired renewal_resumed when cognition returns — not every 60s tick forever Measured after: 0.07 rows/s serving.plan (39x), renewal probe exactly one row per citizen, stream span 17min → hours. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(probes): serving.plan triggers on decisions + relative window deadband, oversubscribed probe on adopted plan (#399 final) Live measurement defeated the quantized fingerprint twice: served_window wobbles ~1k tokens/tick (1k buckets → 146 rows/3min) and usable_gb churns ±1-2GB live (GB granularity → 563 rows/15min). Trigger on DECISIONS only; measured fields ride as payload; window changes emit past a >1/8 relative deadband (the #415 deadband shape) — a real re-plan clears it, wobble never does. The warm-slot-oversubscribed probe (removed from the pure planner in the previous commit — plan_serving_stable calls it twice per tick on different budgets, defeating any per-call dedup, measured 260 rows/3min) lands here on the daemon's ADOPTED-plan path behind the same gate. Measured steady state after deploy: 0.07 rows/s (was 2.6/s). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Fable 5 <[email protected]>
…ttled → done (#371) (#2328) WHY: benchmark/dispatch posted cards + kickoffs and then NOTHING owned the round — no stage announcements, no END; progress was probe archaeology. Joel 8/16: "random and directed by agent, not an ecosystem." Grading was already event-driven (#450 work.card.state_changed subscriber, #451 sweep), but the ROUND itself had no owner and no terminal transition anybody could perceive. THE SLICE (smallest true spine, event-driven per system law — no polling): - cognition/bench_round.rs: BenchRound tracker. Round id IS the run room's uuid (dispatch already mints one per run, #329a — never a second id). Stage enum Working → Done; per-card settled set keyed by FULL card uuid (the bus event's identity, not the 8-char CLI short). - dispatch registers the round after its card loop (bench.round.staged probe; an empty dispatch stages and immediately ends — honest, no unsettleable map entry). - the EXISTING #450 bus-receiver in modules/benchmark_grade forwards each work.card.state_changed payload to the tracker — ONE subscription, two reactions (advance the round, grade the card). No new task, no tick. - probes at TRANSITIONS ONLY: bench.round.staged / bench.round.card_settled (remaining count) / bench.round.done (exactly once — the round is removed on that transition, so once is structural). - ONE definition of "terminal": benchmark_grade::is_terminal now delegates to bench_round::is_terminal_card_state (grader and lifecycle can never disagree about doneness). Tests (each with // what this catches): all-settled fires Done exactly once; a duplicate settle never double-counts; a card outside the set is ignored; the bridge-payload seam parses + removes the round on done. Deliberately NOT built: BenchViewState round-stage field — the bench fold is a ledger-scan projection (ipc/positron_bench_source.rs) and threading a stage through positron types + fold + scan is well over the ~30-line budget for this slice; probes are the deliverable. Grade info is not in the END probe because the state-change payload doesn't carry it (the grade runs minutes after close). Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo Co-authored-by: Claude Fable 5 <[email protected]>
…ve that looks right Written after a live session that recovered two SWE-bench Lite passes by hand and then found 11 more ungraded artifacts on disk. Locates the automation precisely and records the design constraint I nearly violated. THE HEADLINE, and why this is a doc rather than a patch: I proposed a periodic sweep that scans for ungraded artifacts. `modules/benchmark_grade.rs` opens by forbidding exactly that — "nothing scans the board on a clock — the transition event fires the grade" ([[the-whole-system-is-event-based-not-polling]]). The sweep would have worked, and would have quietly converted an event-driven substrate into a polling one. The module's own doc is what caught it, not me. The doc now carries that as a ⚠ block so the next reader (or the next amnesiac model) cannot reflex-code it. The correct question is never "when do we scan" but "which EVENT did we fail to emit". Both answers already have homes: - SEAM 1 — `swe_bench::reap_orphaned_solve_runs_in` (swe_bench.rs:186) already runs at boot and rewrites frozen `running` markers as FAILED. That IS the event; it journals the death and stops. It should also grade the orphaned ARTIFACT, which is the same class of thing as an orphaned process (#452, boot owns reap-or-adopt). - SEAM 2 — grep finds NO lease-expiry event in `modules/work.rs`. Expiry is passive, computed at read time by `work/list`, so a claim can lapse over a finished patch with no transition anywhere. That is why #451 ("lapsed claim + artifact → auto-close") does not fire despite being marked complete. Expiry must emit `work.card.state_changed` through the existing single emitter, and then the EXISTING grade-on-done subscriber needs no new grading path at all. Also recorded: the two tail gaps measured live — workspace cards get truncated off the board by the recency sort (1 of 13 visible at the default limit), and a `--workspace` grade writes no ledger entry (which is why the two passes I graded still read `ungraded`). Plus the honest cost note: the per-tree `git diff` is expensive enough that a hand-rolled equivalent timed out at 5 minutes. Acceptance is the doc's own standard, not a new one: kill a solve mid-patch, reboot, and a verdict exists with no operator command; and afterwards there is still exactly ONE `grade_swe` and ONE `workspace_candidate_diff` in the tree. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…t, and the axis is DETERMINISM Two corrections to the plan of record I committed hours ago, both found by reading the code instead of my own summary of it. 1. SEAM 2 IS RETRACTED. I claimed no lease-expiry mechanism existed and that #451 "does not fire in practice despite being marked complete." It is complete and correct, and it lives in `modules/benchmark_grade.rs` — the file I had open when I wrote that. I grepped `modules/work.rs` for MY concept (an event) instead of for the JOB's name, found nothing, and reported an absence. `sweep_lapsed_bench_cards` is thorough: a pure `sweep_ready` truth table, artifact presence per bench kind, room-SCOPED close, provenance note, per-tick cap, error probe on refusal, live claims never preempted. [[read-the-code-you-intend-to-replace-before-designing-its-replacement]] And the 13 ungraded artifacts are not its business: MEASURED, all 13 carry `card: None, owner: None` — detached agent/solve artifacts with no board card at all (#425). The sweep operates on cards, so not seeing them is correct. 2. THE ⚠ BLOCK WAS SCOPED TOO BROADLY. I wrote "do not add a periodic sweep" as a flat taboo. The same module already ticks at 180s and its comment draws the real line: "actuators may tick; condition-polls may not." A tick that ACTUATES a time fact the wire cannot carry is permitted; ticking to ask "has anything become gradeable" is not. My rule would have blocked a correct build — a guard scoped too broadly, the same shape as #422. JOEL'S FRAMING, which is better than either and now leads the section: "if it's deterministic and not scan it or polling it's reliable." That explains WHY rather than restating the taboo. A scan's answer depends on when it ran, what was on disk, how results sorted, whether a cap truncated — all real here (the board lost 12 of 13 artifacts to a recency sort against a 200-tree cap). A deterministic actuator answers the same way every time regardless of timing. So the test is not "does it have a timer" but "given the same state, same outcome?" With the corollary today taught the hard way: determinism over the WRONG THING is worthless. The reaper fixed in f3cb3a6 was perfectly deterministic over a filename no writer had ever produced — it answered "nothing here" every single time. Reliable and blind are not the same property. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
recover_interrupted() now catches Running + Interrupted + BudgetExhausted. Previously only caught Running→Interrupted on first restart.