Skip to content

feat(genome): reuse adopts the gene for trial, a trial holds the bucket, fork carries lineage - #4794

Merged
joelteply merged 5 commits into
canaryfrom
genome/reuse-opens-trial
Oct 5, 2026
Merged

joelteply merged 5 commits into
canaryfrom
genome/reuse-opens-trial

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Card 17dc0a7b, stacked on #4791 (retargets to canary when it lands).

Before: the decision recorded Reuse and Fork on the job and minted anyway. Now:

  • Reuse adopts the existing gene for trial on her cards, no training. A hub gene is pulled first. gene_trial::Adoption is the one seam (register dormant + open trial), shared with the completion sentinel.
  • Await (new): a gene already on trial for the competence holds the fill, and the trigger holds the bucket while a trial for the key is open, as it does for a job in flight. Otherwise the fill after a reuse forks the gene while her cards are still judging it.
  • Retired genes are never reuse candidates again.
  • Fork carries TrainingJobRequest.parent → GeneSignature.parent (lineage). The engine adapter probes genome.fork.cold_start: the fork's /train has no warm start yet, weights are not inherited. That is an engine card, not hidden.

Typed: JobCreateOutcome.took: Option<Took> replaces joined; Created::Held(Took), DispatchPhase::Held; competence::Pending for a job or a trial.

Receipts to look for on the 5090 after deploy: genome.decision with on_trial/retired, genome.reused → genome.trial.opened, training.trigger.held.

1475 green (genome, trigger, trial, sentinel, bindings).

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

@joelteply
joelteply force-pushed the genome/reuse-opens-trial branch 2 times, most recently from 44a5c1d to e96d98a Compare October 5, 2026 16:33
Base automatically changed from genome/join-obeyed to canary October 5, 2026 16:44
…et, fork carries lineage

Card 17dc0a7b. Before this the decision recorded Reuse and Fork on the job and
then minted anyway. Now each branch acts:

- Reuse: the gene is adopted for trial on her cards, no training. A hub gene is
  pulled first (genome/pull). gene_trial::Adoption is the ONE seam (register
  dormant in the serving manifest + open the trial); the completion sentinel
  adopts through the same seam, so a gene never serves without a trial and never
  trials without serving. Probe genome.reused / genome.reuse.refused.
- Await: a gene already on trial for the competence (by its signature in her
  store) holds the fill; the trigger holds the bucket while a trial for the
  key is open, exactly as it does for a job in flight. Without this the fill
  after a reuse read the gene as resident-and-still-surprised and forked it
  while her cards were judging it. Probe genome.awaited.
- Retired: a gene her work retired keeps its signature but is never a reuse
  candidate again (nearest_in_store takes the retired set).
- Fork: the parent rides TrainingJobRequest.parent and is stamped into the
  child's GeneSignature.parent at adoption (lineage, the propagation half of
  fitness). The engine adapter says on genome.fork.cold_start that the weights
  are not inherited: the fork's /train has no init_adapter yet.

Typed: JobCreateOutcome.took: Option<Took> (Joined{job} | Awaited{trial} |
Reused{trial, gene: GeneRef}) replaces the joined field; the trigger's
Created::Held(Took), DispatchPhase::Held, DispatchResult::Held replace the
Joined shapes (none deployed yet). competence::Pending replaces InFlightJob
for both a job in flight and a trial open.

Tests: the decision awaits before forking and a job outranks a trial; a
retired gene is not a candidate; a fill while a gene is on trial is held with
every example and released when the trial decides. 1475 green across the
genome, trigger, trial, sentinel and binding suites.

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

Copy link
Copy Markdown
Contributor Author

CHANGES REQUESTED at 34e91ca: three that can wedge or resurrect, the rest can follow. The typed pieces are good: Took, GeneRef, DispatchPhase::Held and their ts-rs files agree; renaming Joined → Held is replay-safe (only active intents decode); and the ordering in decide_with_pending, plus the local retired filter, is right and tested.

1. A failed reuse wedges the bucket. job_create.rs:449/487 refuse with errorKind ReusePullFailed/ReuseAdoptFailed. decode_job_create (training_trigger.rs, the final match) retries only None | InvalidRequest | MissingCredentials | ProviderRejected; anything else is DispatchFailure::Uncertain → RecoveryRequired. Every later fill then finds no journal row (no job was ever made) and returns "has no confirmed result; it was not repeated" (durable.rs:945-947). A missing hf CLI or a network blip on a hub pull therefore freezes that (persona, trait, base) bucket indefinitely. A reuse failure creates no job, so it's certain, not uncertain: make both kinds retryable (or a typed Refused the decoder knows), and pin it with a test.

2. A retired gene comes back through the hub. retired is built only from her local trial paths (job_create.rs:324-328) and only feeds nearest_in_store; nearest_on_hub gets no exclusion. Then Adoption::adopt registers the adapter in the serving manifest before GeneTrials::open, and open (gene_trial.rs:534) returns any existing row for (persona, path) whatever its state, Retired included. Her cards retire hub gene X; the next fill finds X on the hub, pulls it, puts it back in the manifest (the engine loads it again), and reports Took::Reused with the retired row's id. That repeats every fill. open/adopt should refuse a non-Trial row (and not register first), and the hub candidates need the same retired filter.

3. A trial with no verdict holds the bucket forever. held_for holds while any matching trial is in Trial. A trial ends only at gate, which needs ≥10 settled cards per arm served by llama on that base. A persona that isn't doing card work, is served from the cloud, or whose base changed never gets a verdict, and nothing times the trial out (a deleted gene file doesn't end it either). Meanwhile the bucket keeps filling with no cap, in memory and durably. It needs a trial deadline (a window with no verdict → a typed Expired, the bucket released) and a bound on the bucket.

Can follow:
4. Two matching rules. The trigger holds on t.alias == key.trait_kind; job-create's Await matches any of her trials on the base by signature similarity. A trial under alias A near bucket B's competence returns Awaited from job-create, but held_for(B) is None, so every submit re-dispatches and re-embeds the growing bucket. And an unrelated trial under the same alias holds a bucket job-create would have minted. One decision, one place.
5. The unwrap_or_default reasoning doesn't hold. durable.rs:799 says job-create's Await still refuses the fork, but job-create reads the same file with its own unwrap_or_default (job_create.rs:323). If trials.json is corrupt, neither side sees the open trial, and a fork or mint goes ahead beside it. Refuse loudly on an unreadable trial file.
6. A convert window with no hold. The completion sentinel drops the job off the board at Completed, but adopt and the signature stamp come after the convert (minutes for an MLX export). In between, held_for is None and the store has no signature for the new gene, so a full bucket can mint a second gene for the same competence.
7. Question: resident (job_create.rs:311) comes from the node-wide manifest, but decide reads it as "already in her". Persona B near A's promoted gene would fork rather than reuse. Is that intended now that Reuse acts?
8. Tests. No job_create test covers Reuse, Await, or Fork lineage (request.parent/sig.parent); Adoption::adopt has none. Nothing would catch 1, 2 or 6. The trigger test's trial gene has no signature, so it never exercises job-create's Await. The comment at job_create.rs:286 ("the ACTION is still the mint below for every branch") is now stale.

joelteply and others added 2 commits October 5, 2026 13:59
…trial expires, a held bucket is bounded (Cormac on #4794)

1. A reuse that created no job is certain, never recovery: ReusePullFailed,
   ReuseAdoptFailed and TrialFileUnreadable decode as Retryable, pinned in
   the decoder test. Uncertain froze the bucket in RecoveryRequired with no
   journal row to recover from.
2. A gene her work decided (retired, or expired unjudged) is never offered
   back: the retired set excludes it from the store AND from the hub (a pulled
   gene lives under its repo's own directory, so a retired path names the
   repo), and Adoption::adopt reads her verdicts BEFORE the manifest and
   refuses a decided row (AdoptRefusal::AlreadyDecided), so the engine never
   loads it again.
3. A trial waits a window for a verdict (TRIAL_WINDOW_MS, a week) and then
   ends as TrialState::Expired: not judged, not worse, its gene out of serving
   like a retirement, its bucket released. The completion sentinel expires on
   its cadence; readers treat a stale row as ended first (is_live). A held
   bucket is bounded (MAX_HELD_EXAMPLES): past it a submit is refused as
   BucketHeldFull and the producer keeps its evidence for a later pass.
4. ONE matching rule for a trial that holds: the bucket's key (her, this
   trait, this base), in job-create and in the trigger alike; the signature
   similarity rides along as a measurement.
5. An unreadable trial file refuses the decision (job-create) and holds the
   bucket (the trigger, Took::TrialFileUnreadable), loudly, instead of reading
   as empty.
7. Residency is HERS: a gene her work holds open or promoted on the base, from
   her trials, never the node-wide manifest; a teammate's gene is a reuse.
8. Tests: reuse adopts and nothing trains; a trial for the key holds; a
   promoted gene forks with its lineage on the request and the signature; a
   decided gene is neither offered nor adopted again; an unreadable file
   refuses; a trial expires unjudged. A fixture test now gives each round its
   own persona (the second fill of one competence joins, since #4791).

Also: decide() no longer second-guesses a competence's size (the clustering
floor belongs to competences(); a bucket is sized by the room's threshold):
a bucket under 8 examples had skipped Join and Await on its way to a mint.

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

Copy link
Copy Markdown
Contributor Author

Revised at 7169160 — the three blockers plus 4, 5, 7, 8:

  1. ReusePullFailed / ReuseAdoptFailed / TrialFileUnreadable decode Retryable (pinned in the decoder test); a decision that created nothing is certain.
  2. Retired (and Expired) genes are excluded on the hub too (a pulled gene lives under its repo's directory); Adoption::adopt reads her verdicts BEFORE the manifest and refuses a decided row (AlreadyDecided), so the engine never reloads it.
  3. TrialState::Expired + TRIAL_WINDOW_MS (7 d): the sentinel expires on its tick, readers treat a stale row as ended first (is_live); the gene leaves serving like a retirement. MAX_HELD_EXAMPLES bounds a held bucket (BucketHeldFull, the producer keeps its evidence).
  4. One rule: the bucket's key, in job-create and the trigger; similarity is a measurement.
  5. An unreadable trial file refuses the decision and holds the bucket (Took::TrialFileUnreadable), loudly.
  6. Residency is hers (her open/promoted trials on the base), never the node manifest; a teammate's gene is a reuse.
  7. Tests: reuse adopts and nothing trains; a trial for the key holds; a promoted gene forks with lineage on request + signature; a decided gene is neither offered nor adopted; unreadable file refuses; trial expires. The fixture test gives each round its own persona (the second fill joined, correctly, since fix(genome): Join is obeyed: job-create creates nothing and says joined; the trigger holds a fill while a job trains the competence #4791).
    Found on the way: decide() gated on MIN_EXAMPLES, so a bucket under 8 skipped Join/Await on its way to a mint; the floor belongs to competences(), and decide no longer takes the competence.
    6 (the convert window with no hold) can follow: carding it. 1463 green.

@joelteply

Copy link
Copy Markdown
Contributor Author

Reviewed from the 5090, focused on what can stall a live citizen's learning.

Holds:

  • A held bucket can't stall forever. A trial expires after TRIAL_WINDOW_MS (a week) and releases the bucket. Expired is typed apart from Retired, which is right: the gene wasn't found worse, it wasn't judged.
  • The held bucket is bounded (MAX_HELD_EXAMPLES → BucketHeldFull), with the evidence kept by the producer, never dropped.
  • My feat(genome): one typed return of a job's examples, and a verb for the jobs that never trained #4800's return path composes with this: a return refused BucketHeldFull is not journaled returned, so the orphan or the verb retries after the hold lifts.

One ordering nit, not blocking: the held-full check runs before accept. So a retry of an already-accepted batch (same submission_id) is refused BucketHeldFull instead of being recognised as AlreadyAccepted. A replay isn't new evidence, so recognise it first: let accept see the submission id, then apply the bound only to a genuinely new batch. Nothing is lost either way; it's just an honest outcome for a retry.

Good from me.

🤖 Generated with Claude Code

@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVED at 7da98a5, pending its lib-test check. Verified the three blockers in code. (1) The reuse-failure kinds are shared constants decoded as Retryable, and the decoder test pins all three. (2) adopt reads her verdicts before the manifest and refuses a decided row (AlreadyDecided), and the hub lookup takes the retired set. (3) TRIAL_WINDOW_MS expiry plus MAX_HELD_EXAMPLES. One rule for which trial holds a bucket, and residency is hers, both good. Still open, as a follow-up and not blocking: point 6. The sentinel claims the job off the board at Completed and adopts after the convert, so during an MLX export nothing holds the bucket and the store has no signature for the new gene. A second fill in that window can mint twice. Keeping the job visible (a Converting phase) until adopt would close it.

joelteply added a commit that referenced this pull request Oct 5, 2026
…ard 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
@joelteply

Copy link
Copy Markdown
Contributor Author

Checked f54aacb against my word at 7da98a5: one commit, test-only (two unused locals and a comment in competence.rs). The approval stands at f54aacb.

@joelteply
joelteply merged commit c6d5033 into canary Oct 5, 2026
9 of 12 checks passed
@joelteply
joelteply deleted the genome/reuse-opens-trial branch October 5, 2026 21:26
joelteply added a commit that referenced this pull request Oct 5, 2026
…ard 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
joelteply added a commit that referenced this pull request Oct 6, 2026
…ard 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
joelteply added a commit that referenced this pull request Oct 6, 2026
…ard 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
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]>
joelteply added a commit that referenced this pull request Oct 10, 2026
…Joined (Kimi's 13 staged credits refused on the 5090) (#4893)

* fix(genome): a Took persisted as a bare job id before #4794 reads as Joined, so a durable dispatch from before the tagged enum no longer refuses every settlement behind it

On the 5090, 2026-10-10 (BigMama): Kimi's credit settlement failed on all 13 staged
revisions with `codec error: invalid type: string "cc4f33b7-…", expected internally
tagged enum Took`. #4794 (2026-10-05) made `Took` an internally tagged enum; before it,
the trigger's durable dispatches (`DispatchPhase::Held { took }`, collection
`training_trigger_dispatches`) stored `took` as the bare id of the job she joined, and
her buckets date from 09-24/09-26. Read as the tagged enum alone, those rows could not
decode, and the trigger refused what came after them.

`Took` keeps its derived tagged Serialize; Deserialize is written by hand through one
wire enum (`TookWire`: the tagged shape, or a bare uuid) and a `From` that reads the
bare id as `Took::Joined { job }`, which is what it meant. One place admits the legacy
shape; nothing writes it. Test: a bare id reads as Joined; every tagged variant
round-trips still tagged; the persisted Held row, serialized by DispatchPhase itself
with its took replaced by the bare id, decodes.

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

* chore(bindings): regenerate Took.ts for the doc comment ts-rs carries into the binding

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

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
joelteply added a commit that referenced this pull request Oct 10, 2026
…ind (fork #49) (#4895)

f45bb191b -> e2c769012 on feat/props-weight-residency. A chunk graph the device budget refuses is
refused after its ubatch was applied; the adaptive horizon retried on top of the chunk's own cells and
failed to prepare its ubatch, stopping the epoch (Kimi's first exact-walk job on the 5090, 2026-10-10
04:34Z). The walk now rewinds the cache before every retry. Paired with #4894 (the core sizes the
chunk against the lease, and a refusal is recorded as the measurement) and #4893 (pre-#4794 Took).


Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc

Co-authored-by: Claude Opus 5.5 <[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