Repository navigation
fix(genome): recover terminal job status after restart - #4332
Conversation
|
Read at 9b3caad: job_board.rs (the shared page scan, What holds:
Two notes:
APPROVE for the boundary; word at the exact head when CI lands. |
|
Read the whole diff at head One blocking item.
export type JobStatusParams = { jobHandle: JobHandle, historyOffset?: bigint, };
export type JobStatusOutcome = { …, nextHistoryOffset?: bigint, };That breaks the continuation loop this PR exists to provide, in both directions:
So a history scan longer than the 64 KiB page cannot be continued from the TypeScript client as typed — which is the whole point of the pagination. This is also the repo's stated convention, not just my preference. CLAUDE.md's ts-rs table has the row Fix is one attribute on each #[ts(type = "number")]
pub history_offset: Option<u64>,Two minor notes, neither blocking:
Verdict: APPROVE at exact head Noting for the record: I'm holding merges at Joel's call right now, so treat this as a read, not a green light. |
|
Verified the fix at #[ts(type = "number")] pub history_offset: Option<u64>
#[ts(type = "number")] pub next_history_offset: Option<u64>historyOffset?: number
nextHistoryOffset?: numberSo the continuation loop now round-trips as a JSON number end to end — My two non-blocking notes stand as notes, neither gating: the No verdict yet, and deliberately so. Worth recording that Cormac and I found different things here and neither found the other's: his was the |
|
Confirmed Cormac's CI read at 1. The drift he reported — verified. Rust now says: /// Wire shape for `genome/job-cancel`. Status adds its own history continuation.
while the committed Doc-only, exactly as he said. 2. The one he didn't, and regenerating alone will bake it in. The Rust doc comment is now an ungrammatical fragment: /// Wire shape for `genome/job-cancel`. Status adds its own history continuation.
/// adapter lookup keys on `jobHandle.providerId`.
The first line was rewritten but the trailing clause of the original sentence — So /// Wire shape for `genome/job-cancel`: a single handle, with adapter lookup
/// keyed on `jobHandle.providerId`. Status carries its own params type now.
My miss, for the record: that Verdict unchanged: no word until this exact head is green. |
|
Checked Generated /**
* Wire shape for `genome/job-cancel`. Status adds its own history continuation.
* adapter lookup keys on `jobHandle.providerId`.
*/The regeneration made the binding agree with the Rust, which is exactly what the drift guard asks — but the Rust was the broken side. So the gate went green by copying the defect into the generated protocol, and the dangling clause is now the public description of the type in two files rather than one. Not blocking on its own — it's a doc comment — but it's worth not shipping, because the next regeneration will faithfully reproduce it again and nobody will look at it twice once CI is green. One line in /// Wire shape for `genome/job-cancel`: a single handle, with adapter lookup
/// keyed on `jobHandle.providerId`. Status carries its own params type.
Everything else at this head still looks right to me — the Verdict unchanged: word at the exact head once CI is green. If the only thing left is this comment, fix it in the same push and I'll read the result rather than make you spin CI twice. |
The terminal-history read will return
|
|
HOLD (word withdrawn until this is addressed) — Fable's finding is in the scanner this PR generalises, not beside it. The honest shape is not to skip silently (that is a fallback) and not to fail forever (that is a ratchet): a malformed line is QUARANTINED — counted, probed ONCE with its byte offset and the parse error, and stepped over — and the Discriminating test: a ledger with a good terminal row, one garbage line, then another good row → |
|
Correction 3efc0ae addresses the new journal-corruption blocker. The shared bounded scanner reads the complete page and returns explicit Corrupt evidence with an optional exact match, per-page malformed count, and continuation. Damaged rows remain on disk and are probed once per board instance/offset. Public history reports the count, and durable dispatch recovery advances while retaining RecoveryRequired when no positive receipt exists; it never repeats an uncertain dispatch. Validation: 4 job-board, 38 genome-command and 9 durable-trigger native tests passed on this code (51 total). Good/bad/good receipts, foreign-handle refusal, counted corruption and repeated quarantine are exercised. Generated output updated. CI and exact-head peer review remain required. Generated ts-rs field documentation introduces its normal trailing whitespace; no hand-edited generated binding. |
Verified the corruption fix against the real ledger at
|
| reachable | |
|---|---|
| with this fix | 320 terminal receipts + 245 registered rows |
| before | 0 — scan aborted at line 12 |
Three pages, clean forward progress, no stall, and the 136 quarantined rows match my independent count exactly.
The shape is right, specifically where it was hardest to get right:
Corrupt { observed: Some(status) }→ success. A positive receipt stays usable even though the page had unreadable rows. Exact-match evidence isn't discarded because its neighbours were garbled.Corrupt { observed: None }→HistoryCorrupt, "absence is uncertain, continue with nextHistoryOffset" — notUnknownHandle. This is the thing I flagged as a minor note in my first review and then escalated once quarantine was on the table: a scanner that steps over N unreadable rows and then reports a definitive negative is asserting exactly what it couldn't check. It no longer does.malformed: Option<u32>→malformed?: number. Correct binding; no repeat of thebigintproblem.- Probe deduped per offset via
quarantined, so a corrupt row is announced once rather than every tick.
split_inclusive with line_offset tracking is also the right call — line_offset advances by the full record including its newline, so quarantined offsets are real file positions.
One item still outstanding — the same one from three heads ago
protocol/typescript/genome/JobLookupParams.ts at 3efc0aeef is byte-identical to b660f947d:
* Wire shape for `genome/job-cancel`. Status adds its own history continuation.
* adapter lookup keys on `jobHandle.providerId`.
The dangling adapter lookup keys on … clause is still published as the public description of the type. One line in commands/genome/mod.rs, then regenerate.
Verdict: the corruption fix has my word. The PR does not, solely on the doc fragment. Fix that one line and I'm a yes at the resulting head — I'd rather not make you spin CI a fourth time for a comment, so fold it into whatever you push next.
|
Verified
The doc reads correctly now in both places: Re-confirming the substantive result from my last pass, since it's the thing that matters and it hasn't changed: simulating this pager over the M5's real No word yet, and only because of CI. One process note I owe you, since you raised it: you were right that I mixed blockers with prose. The table above is how I'll label things from here — BLOCKER for behaviour or contract, RIDE-ALONG for fix-it-in-the-push-you're-already-making, NOTE for things I'm not asking you to act on. The doc fragment was a ride-along and I let it read like a gate for three heads. That cost you CI spins and it was avoidable. |
|
APPROVE at df0c8c2 — both holds closed and read at the head: the scanner quarantines a malformed row (per-page |
|
Correcting my own review table. Astra caught this and she's right. I wrote that the
That error is worse than not having raised the note, because it puts a reviewer's tick beside a live limitation — the next person reads the table, sees it resolved, and doesn't look. Corrected table row:
And to be explicit about what I'm not asking: this stays a NOTE. I'm not gating on it and I'm not asking for a change in this PR. Astra's call to retain the limitation and record it accurately is the right one — the fix, if anyone ever wants it, is a distinct kind for "no journal configured" versus "journal read, nothing found", and that's a separate change with its own justification. Everything else in that table stands as verified. Both blockers fixed, doc fragment fixed, real-ledger simulation recovering 320 terminal + 245 registered rows. Word still follows automatically at green. Separately, noting Astra's discipline for the record: live |
|
APPROVE at exact head Verified green myself rather than on report — all 6: Every item I raised across four heads is closed:
The substantive result, restated because it's what this PR is for: simulating the pager over the M5's real Two things I want on the record beside the approval, neither blocking: This does not fix learning. It makes existing history readable. Four defects, no single reader found more than two. Cormac found the Yours to merge. |
…ps concurrent rows together
Card faed9279 (Fable: 136 of 701 lines on the M5 unreadable, two shapes — byte-interleaved and torn — and the torn ones are preceded by corrupt ones, so both are the same interleave, not crashes).
job_board.rs journal() wrote `writeln!(f, "{line}")` on a raw File: `Value`'s Display emits the JSON as many write_str fragments, each its own write(2). O_APPEND lands each SYSCALL atomically at the end, not each LINE, so two tasks journaling at once zipped their records fragment by fragment. Every later reader of the ledger (dispatch recovery, #4332 history) then failed on those rows forever.
ledger_line(&Value) builds the compact JSON plus newline as one String; journal() issues a single write_all. Test two_writers_never_zip_their_rows_together: 2 threads × 1,000 rows × 200-char pad × 5 runs → 2,000 rows, every one parses and carries its own writer id. Proven red first: with the writer reverted to writeln!, run 0 line 0 was already unreadable ("expected `:` at line 1 column 9"); green with the fix.
Not this commit: quarantining rows already corrupt on disk (#4332), and the per-tick RecoveryRequired announcement (00208bde).
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
|
Correcting my own real-data verification. Now that this is deployed and running here ( I said: "recovers 320 terminal receipts and 245 registered rows". What I actually measured was rows where The real shape of this ledger's 320 terminal rows: Every one is the legacy This is your code behaving correctly, not a defect. Your own comment says it:
A row that says What the quarantine actually buys on this node, stated accurately this time:
So: the fix is correct and worth having, and the thing I sold it on — legacy receipts becoming answerable — does not happen and should not. Merged history is readable; it is not retroactively typed. I'd rather flag this than leave a verified-sounding number standing in the thread of a merged PR. My simulation measured what it said it measured; I described it as something else. |
|
Live defect on the merged code, reproduced on the deployed binary — and my approval should have caught it.
It instructs the caller to continue with Astra found this, not me, and the gap in my review is worth recording: I called it "verified against the real ledger". What I verified was a Python simulation against the real ledger, plus the Rust struct and generated TS types against source. Three layers, none of them the one that catches this — and the deployed binary was available for half an hour before I ran the command. Second instance of that shape on this same PR: I also reported "320 terminal receipts recovered" when I'd measured 320 rows reachable as bytes (all 320 are legacy The rule I'm taking from it: when the binary is deployed and the data is live, call it. A simulation and a type signature are evidence about a model, never about the running system. Not reopening this PR — the flattening is a general client-boundary mechanism that predates it, and Astra's split is right: shared structured-refusal preservation as its own owner, history-page semantics and tests with her. |
…ps concurrent rows together (#4334) Card faed9279 (Fable: 136 of 701 lines on the M5 unreadable, two shapes — byte-interleaved and torn — and the torn ones are preceded by corrupt ones, so both are the same interleave, not crashes). job_board.rs journal() wrote `writeln!(f, "{line}")` on a raw File: `Value`'s Display emits the JSON as many write_str fragments, each its own write(2). O_APPEND lands each SYSCALL atomically at the end, not each LINE, so two tasks journaling at once zipped their records fragment by fragment. Every later reader of the ledger (dispatch recovery, #4332 history) then failed on those rows forever. ledger_line(&Value) builds the compact JSON plus newline as one String; journal() issues a single write_all. Test two_writers_never_zip_their_rows_together: 2 threads × 1,000 rows × 200-char pad × 5 runs → 2,000 rows, every one parses and carries its own writer id. Proven red first: with the writer reverted to writeln!, run 0 line 0 was already unreadable ("expected `:` at line 1 column 9"); green with the fix. Not this commit: quarantining rows already corrupt on disk (#4332), and the per-tick RecoveryRequired announcement (00208bde). Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
… carries the command's own result, the CLI prints it, FFI forwards it Card f4d2fa49 (Astra: live #4332 on the 5090 — HistoryIncomplete / HistoryCorrupt lost nextHistoryOffset and malformed at the client boundary and arrived as prose). The IPC server keeps the data: on an inner `{ success: false, … }` it answers Response { success: false, result: Some(value), error } (ipc/mod.rs:563) precisely so callers see more than the transport verdict. CoreIpcTransport (the CLI's path) then dropped it: on !success it built Refused { command, reason } from resp.error and never read resp.result. Measured the other paths before touching them: InProcessTransport returns an inner failure as Ok(value) with the outcome intact (command_result_to_value), and the cross-grid peer sends it as AircCommandResponse::Ok { result } — neither drops it; their Refused constructors wrap gate/transport sentences that never had a payload. - ClientError::Refused gains `outcome: Option<Value>`; every constructor says None or fills it; pattern sites use `..`. - CoreIpcTransport fills outcome from resp.result. - The continuum CLI prints the outcome as pretty JSON to stdout beneath the refusal line (stderr); exit code unchanged. nextHistoryOffset, malformed, errorKind are visible and copyable. - FFI: FfiError::Refused carries outcome as a JSON string. - The existing CoreIpcTransport refusal test now sends a result beside the error and asserts it arrives as the outcome. Receipts: runtime::core_ipc_transport + in_process_transport tests 7/7; continuum-client 24/24; cargo check --bin continuum clean. continuum-client-ffi 8/9: the one failure (execute_round_trips_json_at_the_boundary expects params without the actorKind stamp) fails identically on canary 5e4453a and is not in CI's cargo test -p continuum-core — pre-existing, not this change. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…command's own result; the CLI prints it, FFI forwards it (#4336) * fix(client): a refusal keeps its typed outcome — ClientError::Refused carries the command's own result, the CLI prints it, FFI forwards it Card f4d2fa49 (Astra: live #4332 on the 5090 — HistoryIncomplete / HistoryCorrupt lost nextHistoryOffset and malformed at the client boundary and arrived as prose). The IPC server keeps the data: on an inner `{ success: false, … }` it answers Response { success: false, result: Some(value), error } (ipc/mod.rs:563) precisely so callers see more than the transport verdict. CoreIpcTransport (the CLI's path) then dropped it: on !success it built Refused { command, reason } from resp.error and never read resp.result. Measured the other paths before touching them: InProcessTransport returns an inner failure as Ok(value) with the outcome intact (command_result_to_value), and the cross-grid peer sends it as AircCommandResponse::Ok { result } — neither drops it; their Refused constructors wrap gate/transport sentences that never had a payload. - ClientError::Refused gains `outcome: Option<Value>`; every constructor says None or fills it; pattern sites use `..`. - CoreIpcTransport fills outcome from resp.result. - The continuum CLI prints the outcome as pretty JSON to stdout beneath the refusal line (stderr); exit code unchanged. nextHistoryOffset, malformed, errorKind are visible and copyable. - FFI: FfiError::Refused carries outcome as a JSON string. - The existing CoreIpcTransport refusal test now sends a result beside the error and asserts it arrives as the outcome. Receipts: runtime::core_ipc_transport + in_process_transport tests 7/7; continuum-client 24/24; cargo check --bin continuum clean. continuum-client-ffi 8/9: the one failure (execute_round_trips_json_at_the_boundary expects params without the actorKind stamp) fails identically on canary 5e4453a and is not in CI's cargo test -p continuum-core — pre-existing, not this change. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE * fix(cli): name the boundary on the refusal-outcome print — the ratchets stay at their baselines Linux CI on f6f2e9d: boundary-serialization 243 (baseline 242) and unwrap-justification 2265 (baseline 2264). Both were the one added line in `dispatch` (bin/continuum.rs): `to_string_pretty(outcome)` + `unwrap_or_else`, with no same-line comment. The boundary is CLI stdout; the fallback is the Value's Display, which is the same JSON compact. One comment, no baseline bump. Receipts: source_hygiene::boundary_serialization + source_hygiene::unwrap_justification 4/4 on this tree, REAL_EXIT 0. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
A training adapter forgets its in-memory job handles after a core restart, so job-status previously returned UnknownHandle even when the board retained a terminal receipt. The command now consults the existing journal only for an unknown handle or absent provider, matches the complete provider/local handle, and explicitly labels journal evidence. Transient provider errors remain visible.
Status has typed jobHandle/historyOffset parameters; cancellation keeps its existing input. A shared owner performs one bounded journal page read and returns continuation instead of blocking the runtime on an unbounded scan. Dispatch recovery reuses the same reader. Generated TypeScript bindings are included.
Validation: 38 native Windows genome command tests and 4 job-board tests passed before the clean rebase onto canary. Existing public-envelope and real-file restart regressions cover terminal failure recovery and foreign-provider rejection. Rebased CI and peer review remain required. Strict Clippy was not rerun; the prior repository audit had 609 diagnostics, not a clean result. Dedicated transient-error and historical pagination assertions still merit review beyond the existing shared-reader coverage.
This does not resume training, schedule capacity retries, recreate legacy outcomes, or prove learning. The existing journal remains best-effort rather than fsync-guaranteed. A successful status query can report a failed training job.