Skip to content

feat(genome): one typed return of a job's examples, and a verb for the jobs that never trained - #4800

Merged
joelteply merged 3 commits into
canaryfrom
fix/one-typed-return-of-a-jobs-examples
Oct 6, 2026
Merged

joelteply merged 3 commits into
canaryfrom
fix/one-typed-return-of-a-jobs-examples

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Stacked on Fable's genome/train-share-ppm (#4794/#4796/#4798) so the stack inherits the typed return in its Held arm. When that stack merges, retarget this to canary before the base branch is deleted (a stacked PR auto-closes on base deletion).

Why: a job takes its examples out of the bucket when it's dispatched. A job that ends without training a step leaves them in its directory, and no fill sees them again. On the 5090 on 2026-10-05, 18 of Kimi's jobs stranded about 500 examples that way.

One typed path back:

  • read_job_request(dir): the one reader of a job's request.json. resumable_request uses it and now says why a request can't be read.
  • SubmitParams::returning(request, job): the one conversion of a job back into a submit. Only the bucket key and examples ride back; the bucket pins its own policy. The job's id is the batch identity, so returning the same job twice is a replay.
  • submit_batch: submit's body, shared, so a returned batch is accepted, deduped and dispatched exactly like any other.

The boot Held arm: it used an inline serde_json::Value with unwrap_or(Null) per required field, and counted a refused submit (success: false) as returned. It now goes through returning, decodes SubmitOutcome, and requires success before journaling.

genome/training-trigger/return {jobId}: hands back a job that ended without training.

  • It refuses an open job, which trains or resumes itself.
  • It refuses a trained job, whose checkpoint or adapter is its outcome.
  • It journals through job_board::journal_returned.
  • Not automatic on failure, deliberately: a deterministic failure (out of device memory at its window) would refill, re-dispatch and fail forever.

Also: registration(job)/is_terminal(job) read the ledger through orphan_of (now the one reading of a registration row). default_job_dir no longer falls back to . without a home directory.

Tests: training_trigger + job_board: 54 passed. The new return test runs over an explicit board and genome root and never touches the node's ledger; it checks the job is returned once, a replay doesn't double it, an open job is refused, and a trained job is refused.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc

@joelteply

Copy link
Copy Markdown
Contributor Author

Read it; the shape is right (one reader, one conversion, job id as the replay identity, refuses open and trained, journal_returned). One defect before a word: SubmitParams::returning sets eval_set: None, lora: None, schedule: None, local_artifact_dir: None, but PendingBatch::same_policy (durable.rs:338) compares exactly those, and the producer submits evalSet whenever the trait has a gym (training_producer.rs:1148, code does). So a return into a bucket that already holds the producer's batch for that key is refused as InconsistentBucket and the examples stay stranded — loudly, but stranded. The request.json carries eval_set, lora, schedule, local_artifact_dir: map them through, and add the test case: return into a bucket that already holds a producer batch with an eval set. Word on that head.

joelteply added a commit that referenced this pull request Oct 5, 2026
…e on #4800)

SubmitParams::returning dropped eval_set/lora/schedule/local_artifact_dir, and
same_policy compares them exactly, so a return into a bucket that already held a
producer's batch (code traits carry the gym's evalSet) was refused
InconsistentBucket and the examples stayed stranded. Mapping the job's fields through
alone would not fix it either: the trainer's adapter writes its own defaults into the
job's request.json, so a returned lora: Some(default) never equals a producer's None.

So the one return, return_request, ADOPTS the policy the key already holds (the
pending bucket's, else the active dispatch's, through TrainingTriggerState::held_policy)
and pins the job's own (now mapped through by returning) only into an empty key.
BucketPolicy is THE set of fields a bucket pins; same_policy compares it, so what
acceptance requires and what a return adopts cannot drift. The boot Held arm calls
return_request directly (resume_orphans_once takes self: &Arc<Self>) instead of
round-tripping JSON through the executor.

Test: a producer's batch (evalSet, no lora) then a returned job (evalSet + the
adapter's default lora) gives 1 + 2 examples in one bucket, not InconsistentBucket.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
@joelteply
joelteply force-pushed the genome/train-share-ppm branch 2 times, most recently from a2eadf7 to e2aab85 Compare October 5, 2026 19:23
@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVED at 4f3ac34, pending its checks. return_request adopting the key's held policy (pending bucket, else active dispatch) and pinning the job's own otherwise is the right cut — the adapter writing its defaults into request.json is exactly why mapping alone would not have matched. The replay identity (job id as submission id) composes with #4794's BucketHeldFull nit (replay recognised first) and with journal_returned now taking the serialized Took. One operational note: the base branch (genome/train-share-ppm) was force-pushed in the restack, so this PR carries the old 4796/4798 commits until it is rebased onto e2aab85 — content-identical, but the diff view and the eventual retarget will be cleaner after a rebase.

joelteply added a commit that referenced this pull request Oct 5, 2026
…e on #4800)

SubmitParams::returning dropped eval_set/lora/schedule/local_artifact_dir, and
same_policy compares them exactly, so a return into a bucket that already held a
producer's batch (code traits carry the gym's evalSet) was refused
InconsistentBucket and the examples stayed stranded. Mapping the job's fields through
alone would not fix it either: the trainer's adapter writes its own defaults into the
job's request.json, so a returned lora: Some(default) never equals a producer's None.

So the one return, return_request, ADOPTS the policy the key already holds (the
pending bucket's, else the active dispatch's, through TrainingTriggerState::held_policy)
and pins the job's own (now mapped through by returning) only into an empty key.
BucketPolicy is THE set of fields a bucket pins; same_policy compares it, so what
acceptance requires and what a return adopts cannot drift. The boot Held arm calls
return_request directly (resume_orphans_once takes self: &Arc<Self>) instead of
round-tripping JSON through the executor.

Test: a producer's batch (evalSet, no lora) then a returned job (evalSet + the
adapter's default lora) gives 1 + 2 examples in one bucket, not InconsistentBucket.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
@joelteply
joelteply force-pushed the fix/one-typed-return-of-a-jobs-examples branch from 4f3ac34 to faa29b0 Compare October 5, 2026 19:37
joelteply added a commit that referenced this pull request Oct 5, 2026
@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVED at faa29b0 (restacked on e2aab85; the two unwrap_or on the submit defaults are the pre-existing lines moved into submit_batch). The verb journals through the typed journal_returned; 4802 changes that function's signature to &impl Serialize (your &str reason still fits) — whichever of 4800/4802 rebases last resolves the Held arm, and I take it if it is mine.

@joelteply
joelteply force-pushed the genome/train-share-ppm branch from e2aab85 to 845ca43 Compare October 5, 2026 20:03
joelteply added a commit that referenced this pull request Oct 5, 2026
joelteply added a commit that referenced this pull request Oct 5, 2026
…e on #4800)

SubmitParams::returning dropped eval_set/lora/schedule/local_artifact_dir, and
same_policy compares them exactly, so a return into a bucket that already held a
producer's batch (code traits carry the gym's evalSet) was refused
InconsistentBucket and the examples stayed stranded. Mapping the job's fields through
alone would not fix it either: the trainer's adapter writes its own defaults into the
job's request.json, so a returned lora: Some(default) never equals a producer's None.

So the one return, return_request, ADOPTS the policy the key already holds (the
pending bucket's, else the active dispatch's, through TrainingTriggerState::held_policy)
and pins the job's own (now mapped through by returning) only into an empty key.
BucketPolicy is THE set of fields a bucket pins; same_policy compares it, so what
acceptance requires and what a return adopts cannot drift. The boot Held arm calls
return_request directly (resume_orphans_once takes self: &Arc<Self>) instead of
round-tripping JSON through the executor.

Test: a producer's batch (evalSet, no lora) then a returned job (evalSet + the
adapter's default lora) gives 1 + 2 examples in one bucket, not InconsistentBucket.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
@joelteply
joelteply force-pushed the fix/one-typed-return-of-a-jobs-examples branch from faa29b0 to 55bc80c Compare October 5, 2026 20:11
@joelteply

Copy link
Copy Markdown
Contributor Author

Word stands at 55bc80c (rebase onto 845ca43, content as approved).

@joelteply
joelteply force-pushed the genome/train-share-ppm branch from 845ca43 to 3d52bfb Compare October 5, 2026 23:27
joelteply added a commit that referenced this pull request Oct 5, 2026
Base automatically changed from genome/train-share-ppm to canary October 6, 2026 01:44
joelteply and others added 3 commits October 6, 2026 00:57
…e jobs that never trained

A job takes its examples out of the bucket when it is dispatched. A job that then ends
without training a step leaves them in its directory, and no fill sees them again: on
the 5090 2026-10-05, 18 of Kimi's jobs stranded ~500 examples that way.

ONE typed path back:
- read_job_request(dir) is the one reader of a job's request.json (the planner's spec
  restored to the registry id); resumable_request uses it and now reports why a
  request can't be read instead of an empty Option.
- SubmitParams::returning(request, job) is the one conversion of a job back into a
  submit: only the bucket key and examples ride back (the job's LoRA, schedule and
  eval set are the bucket's to pin), and the job's id is the batch identity, so a
  second return of the same job is a replay, never a second copy.
- submit_batch is submit's body, shared, so a returned job's examples are accepted,
  deduped and dispatched exactly as any batch.

The held-orphan arm at boot used an inline serde_json::Value with unwrap_or(Null) per
required field, and counted a refused submit (success=false) as returned. It now
goes through SubmitParams::returning and decodes SubmitOutcome, requiring success
before it journals the orphan returned.

genome/training-trigger/return {jobId} hands back a job that ended without training:
it refuses an open job (it trains or resumes itself) and a trained one (its checkpoint
or adapter is its outcome), and journals through job_board::journal_returned.
Deliberately a verb, not automatic on failure: a deterministic failure (out of device
memory at its window) would refill, re-dispatch and fail forever.

Job-board lookups registration(job) and is_terminal(job) read the ledger through
orphan_of, now the one reading of a registration row. default_job_dir no longer
falls back to "." without a home directory; job_dir_under is the one job layout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
…e on #4800)

SubmitParams::returning dropped eval_set/lora/schedule/local_artifact_dir, and
same_policy compares them exactly, so a return into a bucket that already held a
producer's batch (code traits carry the gym's evalSet) was refused
InconsistentBucket and the examples stayed stranded. Mapping the job's fields through
alone would not fix it either: the trainer's adapter writes its own defaults into the
job's request.json, so a returned lora: Some(default) never equals a producer's None.

So the one return, return_request, ADOPTS the policy the key already holds (the
pending bucket's, else the active dispatch's, through TrainingTriggerState::held_policy)
and pins the job's own (now mapped through by returning) only into an empty key.
BucketPolicy is THE set of fields a bucket pins; same_policy compares it, so what
acceptance requires and what a return adopts cannot drift. The boot Held arm calls
return_request directly (resume_orphans_once takes self: &Arc<Self>) instead of
round-tripping JSON through the executor.

Test: a producer's batch (evalSet, no lora) then a returned job (evalSet + the
adapter's default lora) gives 1 + 2 examples in one bucket, not InconsistentBucket.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
…eturned

Restacked onto e2aab85: journal_returned takes held_by as the serialized Took. An
operator's return is held by no Took, so it is named by the verb.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
@joelteply
joelteply force-pushed the fix/one-typed-return-of-a-jobs-examples branch from 55bc80c to 54f1d3b Compare October 6, 2026 06:08
@joelteply
joelteply enabled auto-merge (squash) October 6, 2026 06:08
@joelteply
joelteply merged commit b3d1ed4 into canary Oct 6, 2026
7 checks passed
@joelteply
joelteply deleted the fix/one-typed-return-of-a-jobs-examples branch October 6, 2026 06:29
joelteply added a commit that referenced this pull request Oct 6, 2026
joelteply added a commit that referenced this pull request Oct 6, 2026
joelteply added a commit that referenced this pull request Oct 6, 2026
…ard cb14cc13) (#4802)

* fix(genome): a completed job holds its competence through adoption (card cb14cc13)

The sentinel claimed a job off the board the instant it saw Completed, then
converted (minutes for an MLX export), registered, opened the trial and
stamped the signature. In between: not on the board, no trial yet, no
signature in the store. A full bucket in that window minted a second gene
for the same competence (Cormac on #4794, point 6).

- TrainingJobBoard keeps completed jobs in an `adopting` set; `pending()`
  (in flight + adopting) is what the gates read (held_for, job-create's
  join); `snapshot()` stays the sentinel's poll set. In memory only: a core
  that dies mid-adoption loses the adoption as before, and the ledger's
  terminal row already stands.
- The chain holds an AdoptionHold guard; dropping it on any path out
  (adopted or refused) calls adoption_done. The no-executor path releases
  explicitly.
- The signature is stamped BEFORE the trial opens, so from the moment the
  gene is live a fill finds it by distance.
- Test: a fill during adoption joins the job; after adoption_done the
  competence decides again.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(genome): journal_returned serializes the reason itself; an unserializable one is written as that, never as null (BigMama on #4800)

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* docs(genome): §6 says what exists after tonight (the surprise gate, Expired, the bound, the lease)

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(genome): canary's operator-return caller lends its reason to journal_returned (Cormac on #4802)

journal_returned takes the held-by reason by reference since this PR (it serializes it
itself); the operator return verb landed on canary after with a by-value json!.

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

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
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