Skip to content

feat(genome): genome/job-pause and job-resume; a job's pause is persisted intent keyed by the job - #4522

Merged
joelteply merged 3 commits into
canaryfrom
feat/training-hold-is-a-persisted-fact
Sep 28, 2026
Merged

joelteply merged 3 commits into
canaryfrom
feat/training-hold-is-a-persisted-fact

Conversation

@joelteply

@joelteply joelteply commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

The in-memory training holds (#4485) had no production caller. A direct engine /train/pause with no hold is steered back by design, so this adds the one door, with the intent persisted.

Design (settled on airc: Cormac, the owner is the job; Codex, persist intent, never inheritable, bounded TTL):

  • training_hold_store.rs: state/training-holds.json holds {id, job, reason, createdMs, ttlMs}.
    • The TTL is required and at most one day; a longer one is refused, never clamped.
    • The file follows deploy-hold's shape (state/deploy-hold is also a plain state file), now with a TTL, because TTL-less deploy-hold paused the fleet for three days (card ee76c0df).
    • An expired entry is simply no longer live; no task times it out.
  • The run reads its job's live entries every 2 s tick beside the in-memory holds.
  • An unreadable store holds (Codex). This DEPARTS from the deploy-hold precedent, which reads fail-open (deploy_tracker.rs:251, .ok()?, so an unreadable hold file means no hold; Kimi). Only a missing file means no pauses. A read error or a corrupt file makes the run hold, and add and release refuse rather than overwrite intent they could not read.
  • A real job end (finished, failed, cancelled) releases the job's entries. A dropped future (a core shutdown) does not.
  • Not yet: no path re-attaches a relaunched core to a run already in the engine (the job board reconciles it as an orphan, and run begins with a POST). The file is durable intent for that re-attach path, which is its own change. This PR does not claim a pause survives a relaunch.
  • genome/job-pause {jobHandle, reason, ttlMs}: in-engine jobs only, and only while queued, waiting or running.
  • genome/job-resume {jobHandle}: releases every pause on the job.
  • A paused run keeps its allocation, so a pause reduces compute and never relieves memory. Pressure holds are out of scope.

Tests:

  • a_pause_is_its_jobs_until_released_or_expired_and_never_longer_than_a_day (store).
  • a_persisted_pause_steers_its_job_and_ends_with_it (end to end on the fake lane). The pause steers the engine; a release resumes and finishes; a cancel while paused takes the job's pause with it; another job's pause stands.
  • a_pause_is_refused_for_a_job_that_is_not_in_engine.

Not compiled locally (M5, no cargo): the two TS bindings (JobPauseParams.ts, JobPauseOutcome.ts) are hand-written in ts-rs's format, so the drift detector is the judge. Live validation (pause, a served turn, resume on the normal mind) happens with Codex once attempt 2 is running.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…sisted fact keyed by the job, so it outlives the core

The in-memory training holds (#4485) had no production caller, and a core relaunch
emptied them. The engine keeps training across the seam and is adopted, so an adopted
run's steering resumed a run someone had paused. A direct engine /train/pause with
no hold is steered back by design.

Per the design settled on airc (Cormac: the owner is the job; Codex: persist intent,
never inheritable by the next job, bounded TTL):
- training_hold_store: state/training-holds.json holds {id, job, reason, created_ms,
  ttl_ms}. The TTL is required and at most one day, refused and never clamped. The
  shape follows deploy-hold's state file, now with a TTL (the deploy-hold lesson, card
  ee76c0df). An expired entry is simply no longer live; no task times it out.
- The run reads its job's live entries every 2 s tick beside the in-memory set, so the
  first tick after a relaunch sees the pause before any steer. A real job end
  (finished, failed, cancelled) releases the job's entries. A dropped future (a core
  shutting down) does not, so an adopted run keeps its pause.
- genome/job-pause {jobHandle, reason, ttlMs}: in-engine jobs only, and only while
  queued, waiting or running. genome/job-resume {jobHandle}: releases every pause on
  the job.
- A paused run keeps its allocation: a pause reduces compute, never memory (Cormac).
  Pressure-driven holds are not in this change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Review at 8a7fe42 (Cormac). Not approved yet: CI is still running and one change is requested. The design matches what we settled:

  • the pause is keyed by the job, so the next job on the lane inherits nothing;
  • it is read on every tick, including the first tick after a relaunch, before any steer;
  • a TTL is required and refused, never clamped;
  • the job's real end releases it, and a dropped future does not;
  • the docs say a pause never relieves memory.

I checked that genome/job-resume IS reachable even though command_objects only adds job-pause: a unit-struct action_command! auto-registers through inventory. Fine as is.

Requested: a corrupt store must not read as "no holds." parse does unwrap_or_default(), which fails in two ways:

  1. live_on on every tick reads a corrupt or half-written training-holds.json as empty, so the run is steered to RESUME a job someone deliberately paused, with no probe. That is exactly the relaunch failure this PR exists to remove, coming back through a different door.
  2. add and release_job then do read → filter → write, so the next pause or resume REWRITES the corrupt file with only the new entry and silently drops every other job's live pauses.

The write is tmp+rename, so a torn file is unlikely from us, but hand edits and disk-full both happen. The shape I'd want, following no-fallbacks:

  • read/parse return Result, with a missing file still Ok(vec![]);
  • add/release_job refuse with errorKind: Store and leave the file as it is;
  • live_on returns the error and the tick probes training.hold.store_unreadable, then leaves the pause state as it is (skip steer_pause that tick) instead of resuming.

Then a test with a garbage file: a paused run stays paused, and add refuses.

Follow-up, not blocking (Codex's condition): TTL expiry is not visible anywhere yet. When a hold lapses, the run just emits training.run.resumed with holds="", which looks the same as the engine's own serving yield ending. A reason=expired on that resume, or the job's ViewState showing pausedUntil, would close it. Fine as a card.

Minor: store_path() reaches for crate::commands::benchmark::continuum_home() from genome code. There is a home resolver card (95eabd87); worth a TODO pointing at it so this does not become a third copy.

…efuses over intent it cannot read; restart claims narrowed (Codex on #4522)

Only a missing file means no pauses. A read error or a corrupt file is an Err. The run
treats it as a hold ('hold store unreadable'), and add and release refuse rather than
overwrite it. The regression is in the store test.

Nothing re-attaches a relaunched core to a run already in the engine (the job board
reconciles it as an orphan, and run begins with a POST). So the docs no longer claim
the pause outlives the core. It is durable intent for that re-attach path, which is
its own change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply joelteply changed the title feat(genome): genome/job-pause and job-resume; a job's pause is a persisted fact keyed by the job feat(genome): genome/job-pause and job-resume; a job's pause is persisted intent keyed by the job Sep 28, 2026
@joelteply
joelteply merged commit 6b1bad4 into canary Sep 28, 2026
8 checks passed
@joelteply
joelteply deleted the feat/training-hold-is-a-persisted-fact branch September 28, 2026 12:24
@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVED at e299353 (Cormac). All 8 checks succeeded. Since my request at 8a7fe42: the store read is a Result, and only NotFound means no holds. An unreadable store holds the run and refuses writes, leaving the file as it is, and there is a regression test for it. The relaunch claim is scoped honestly to "durable intent until re-attach" (card 7bb4e5a2). The module-count test is updated for job-pause. TTL-expiry visibility is card acdc729f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant