Skip to content

feat(genome): her surprise gates the decision; an unsurprised bucket holds - #4796

Merged
joelteply merged 3 commits into
canaryfrom
genome/surprise-gates-the-decision
Oct 5, 2026
Merged

joelteply merged 3 commits into
canaryfrom
genome/surprise-gates-the-decision

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Stacked on #4794. GENE-REUSE-FORK-MINT §2/§3: a gene is minted only when recall alone leaves her surprised. The decision ran on NotYetMeasured while her verdict surprise was already on her strip (#4774).

  • AwarenessSnapshot::verdict_surprise: her tallies folded across activities by counts; None until the room judged one of her stated expectations (not measured is not low).
  • job-create reads it from her own strip and decides on Surprise::Measured { s }; probe says surprise=verdict s=… judged=….
  • SurpriseLow { s } no longer falls through to a mint: Took::Unsurprised { s }, examples stay in the bucket.
  • The trigger holds an unsurprised bucket at the gate (held_for: job → trial → surprise), so the fill is never dispatched just to come back unsurprised; heldBy.kind = unsurprised. One contradicted expectation over the floor releases it — tested end to end through submit with a resident region.
  • An orphan whose examples return to her bucket with nothing continuing them journals returned, not resumed.

Behaviour on the 5090: a citizen whose expectations the room keeps confirming trains nothing until she is surprised; one never judged still trains (unknown never halts). Kimi's strip read 0.50 today.

1460 green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

@joelteply

Copy link
Copy Markdown
Contributor Author

CHANGES REQUESTED at cb76cef: two things before it merges, the rest can follow. The shape is right: never-judged and judged are told apart by type (Option<VerdictSurprise> → NotYetMeasured), not by a sentinel; folding by counts and not by a mean of ratios is correct and unit-tested; and this is a substrate resource gate on training compute, not Rust deciding her cognition.

1. A bucket can hold until someone judges her again. The 24 h window is applied only in SurpriseTally::note (perception_region.rs:123-126), when a new verdict arrives. The read path copies the tally as-is (perception_region.rs:444 surprise: v.surprise), and verdict_surprise (awareness.rs:64-69) sums it without looking at since_ms or the clock. So if Kimi is judged 0 of 2 and the room then stops judging her, her tally stays at 0/2 indefinitely, and every fill of every bucket is heldBy.kind=unsurprised until a new contradiction arrives. The comments that a 0 clock "reads every tally as outside its window" don't match the code. Fix: expire on read (now - since_ms > SURPRISE_WINDOW_MS contributes nothing), so a stale reading becomes NotYetMeasured and she trains. Related: nothing re-decides a held bucket when her surprise rises; release waits for the next submit to that bucket. Fine if intended, but say so.

2. The e2e test doesn't reach the decision it names. The first fill is held at the trigger's pre-gate (ready_to_dispatch → held_for → Unsurprised), so job_create's new surprise read (job_create.rs:386-394) never runs while she is unsurprised. After the contradiction s=1/3, which is over the floor, so Measured{0.33} and NotYetMeasured both mint. Replacing line 392's mapping with Surprise::NotYetMeasured would leave the test green. Also, "a mind never judged is not held" is in the // what this catches: but nothing asserts it. A job_create-level case where the decision itself returns Took::Unsurprised, plus a never-judged fill that dispatches, would pin both.

Can follow:
3. One reading gates every competence. held_for(key) → unsurprised(key.persona_id) ignores trait_kind/base_model, and the read folds every activity. Two confirmed reviews in career-wrangler hold her unrelated rust-code bucket. If persona-wide is the interim, the doc should say it, since §3 defines S(C) per competence.
4. No minimum sample. judged > 0 makes one confirmation a measured 0.0. With the reset in note(), 19 contradictions yesterday plus one confirmation today read as s=0 and hold everything. A named minimum judged before the reading counts would fix it.
5. Debug text in the durable journal. training_trigger.rs:427 passes &format!("{took:?}") to journal_returned(.., held_by: &str, ..). Took is Serialize, so journal the value; Debug output changes with a field rename and the journal outlives the binary.

joelteply added a commit that referenced this pull request Oct 5, 2026
…ments; the decision's own arm is tested (Cormac on #4796)

1. The 24 h window was applied only when a NEW verdict arrived; the read path
   summed the tally as-is, so a room that stopped judging her left her held
   at her last number indefinitely. verdict_surprise now reads at the
   snapshot's own clock: a tally whose window closed contributes nothing, and
   she is NOT MEASURED, which trains. MIN_JUDGED = 3: one confirmation after a
   reset is not "surprise 0.0, hold everything". Release still waits for the
   next submit to the bucket (intended; said in the probe docs).
2. The e2e was held at the trigger's gate and never reached job-create's arm.
   A job-create test now registers a resident region with 3 confirmed, 0
   contradicted and asserts the DECISION returns Took::Unsurprised before any
   reuse is considered, then that the same world never judged reuses.
3. (persona-wide for now) said in the doc §3 and on VerdictSurprise.
5. journal_returned takes the serialized Took, never its Debug text.
Trigger e2e: three confirmations, the real clock.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the genome/surprise-gates-the-decision branch from cb76cef to b69df9b Compare October 5, 2026 19:17
joelteply added a commit that referenced this pull request Oct 5, 2026
…ments; the decision's own arm is tested (Cormac on #4796)

1. The 24 h window was applied only when a NEW verdict arrived; the read path
   summed the tally as-is, so a room that stopped judging her left her held
   at her last number indefinitely. verdict_surprise now reads at the
   snapshot's own clock: a tally whose window closed contributes nothing, and
   she is NOT MEASURED, which trains. MIN_JUDGED = 3: one confirmation after a
   reset is not "surprise 0.0, hold everything". Release still waits for the
   next submit to the bucket (intended; said in the probe docs).
2. The e2e was held at the trigger's gate and never reached job-create's arm.
   A job-create test now registers a resident region with 3 confirmed, 0
   contradicted and asserts the DECISION returns Took::Unsurprised before any
   reuse is considered, then that the same world never judged reuses.
3. (persona-wide for now) said in the doc §3 and on VerdictSurprise.
5. journal_returned takes the serialized Took, never its Debug text.
Trigger e2e: three confirmations, the real clock.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the genome/surprise-gates-the-decision branch from b69df9b to e36f00b Compare October 5, 2026 19:23
@joelteply

Copy link
Copy Markdown
Contributor Author

Revised at e36f00b (restacked on #4794's revision): (1) verdict_surprise reads at the snapshot's own clock — a tally whose window closed contributes nothing, so a room that stopped judging her leaves her NOT MEASURED (trains), never held at her last number; MIN_JUDGED = 3 so one confirmation after a reset is not a measured 0.0. Release still waits for the next submit to that bucket (intended, said). (2) A job-create test registers a resident region (3 confirmed, 0 contradicted) and asserts the DECISION returns Took::Unsurprised before any reuse is considered; the same world never judged then reuses. (3) persona-wide said in §3 and on the type. (5) journal_returned takes the serialized Took. Trigger e2e now uses three confirmations and the real clock. 1465 green.

@github-actions github-actions Bot added size: L and removed size: M labels Oct 5, 2026
@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVED at e36f00b, pending its lib-test check. Verified: verdict_surprise filters on the snapshot's clock (since_ms > 0 and within SURPRISE_WINDOW_MS), the test pins that a stale tally is not a reading, MIN_JUDGED=3 is a named floor, the decision's own Unsurprised arm is tested at job_create with a never-judged counterpart, and the journal takes the serialized Took. Persona-wide is now said in §3, which is the honest interim.

joelteply added a commit that referenced this pull request Oct 5, 2026
…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 added a commit that referenced this pull request Oct 5, 2026
…ments; the decision's own arm is tested (Cormac on #4796)

1. The 24 h window was applied only when a NEW verdict arrived; the read path
   summed the tally as-is, so a room that stopped judging her left her held
   at her last number indefinitely. verdict_surprise now reads at the
   snapshot's own clock: a tally whose window closed contributes nothing, and
   she is NOT MEASURED, which trains. MIN_JUDGED = 3: one confirmation after a
   reset is not "surprise 0.0, hold everything". Release still waits for the
   next submit to the bucket (intended; said in the probe docs).
2. The e2e was held at the trigger's gate and never reached job-create's arm.
   A job-create test now registers a resident region with 3 confirmed, 0
   contradicted and asserts the DECISION returns Took::Unsurprised before any
   reuse is considered, then that the same world never judged reuses.
3. (persona-wide for now) said in the doc §3 and on VerdictSurprise.
5. journal_returned takes the serialized Took, never its Debug text.
Trigger e2e: three confirmations, the real clock.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the genome/surprise-gates-the-decision branch from e36f00b to 1858757 Compare October 5, 2026 20:02
joelteply added a commit that referenced this pull request Oct 5, 2026
…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
Base automatically changed from genome/reuse-opens-trial to canary October 5, 2026 21:26
@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVED at 1858757, pending its lib-test check. Checked against my e36f00b word: the fix commit's patch is identical, and the one new commit (d43d3ae) only adds comments.

One nit in that commit: the now_ms_for_decision comment says a 0 clock "puts every tally outside its window = not measured". The read does the opposite. verdict_surprise keeps a tally when at_ms.saturating_sub(since_ms) <= SURPRISE_WINDOW_MS, and with at_ms = 0 that's 0 <= window, so every tally counts as current. A pre-epoch clock won't happen, but the comment shouldn't claim the safe outcome. Either say "unreachable", or make the read treat at_ms < since_ms as outside the window.

@joelteply
joelteply enabled auto-merge (squash) October 5, 2026 22:09
joelteply and others added 3 commits October 5, 2026 17:48
…holds

GENE-REUSE-FORK-MINT §2 and §3: a gene is minted only when recall alone
leaves her surprised in a competence. Until now the decision ran on
Surprise::NotYetMeasured and the probe said not_measured, with her verdict
surprise already on her strip (#4774).

- AwarenessSnapshot::verdict_surprise folds her tallies across activities BY
  COUNTS (contradicted / judged), None until the room judged at least one of
  her stated expectations. Not measured is not low.
- job-create reads it from her own strip (awareness_of) and decides on it:
  Surprise::Measured { s }; the probe says surprise=verdict with s and judged.
- NothingBecause::SurpriseLow { s } carries the number; the arm no longer
  falls through to a mint. It returns Took::Unsurprised { s } and the bucket
  keeps its examples.
- The trigger holds an unsurprised bucket at the gate (held_for: job in
  flight, trial open, then her surprise below the floor), so a fill that
  would only come back unsurprised is never dispatched; the outcome names it
  (heldBy.kind = unsurprised, s). One contradicted expectation over the floor
  releases it: tested end to end through submit with a resident region.
- An orphan whose examples returned to her bucket with nothing continuing
  them journals `returned` (lineage ends), not `resumed` into a trial.
- TooFewExamples at job-create is named for what it is: a full bucket IS a
  competence by the room's own threshold; the clustering floor applies to
  competences found within her curriculum, the follow-on.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ments; the decision's own arm is tested (Cormac on #4796)

1. The 24 h window was applied only when a NEW verdict arrived; the read path
   summed the tally as-is, so a room that stopped judging her left her held
   at her last number indefinitely. verdict_surprise now reads at the
   snapshot's own clock: a tally whose window closed contributes nothing, and
   she is NOT MEASURED, which trains. MIN_JUDGED = 3: one confirmation after a
   reset is not "surprise 0.0, hold everything". Release still waits for the
   next submit to the bucket (intended; said in the probe docs).
2. The e2e was held at the trigger's gate and never reached job-create's arm.
   A job-create test now registers a resident region with 3 confirmed, 0
   contradicted and asserts the DECISION returns Took::Unsurprised before any
   reuse is considered, then that the same world never judged reuses.
3. (persona-wide for now) said in the doc §3 and on VerdictSurprise.
5. journal_returned takes the serialized Took, never its Debug text.
Trigger e2e: three confirmations, the real clock.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the genome/surprise-gates-the-decision branch from 1858757 to 29d3484 Compare October 5, 2026 22:56
@joelteply
joelteply disabled auto-merge October 5, 2026 23:04
@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVED at 29d3484, pending its lib-test check. I compared each rebased commit's patch with its original: 7e2d836 == 9c7bb59 and c9db1cc == d43d3ae byte for byte, and 29d3484 differs from 1858757 only in one unchanged context line of the doc (canary now has §3a above it). The content is identical.

@joelteply
joelteply enabled auto-merge (squash) October 5, 2026 23:06
@joelteply
joelteply merged commit 49a0c23 into canary Oct 5, 2026
7 checks passed
@joelteply
joelteply deleted the genome/surprise-gates-the-decision branch October 5, 2026 23:17
joelteply added a commit that referenced this pull request Oct 6, 2026
…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 added a commit that referenced this pull request Oct 6, 2026
…e jobs that never trained (#4800)

* feat(genome): one typed return of a job's examples, and a verb for the 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

* fix(genome): a returned job's examples join the bucket's policy (Fable 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

* fix(genome): the return verb journals through #4796's typed journal_returned

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
joelteply added a commit that referenced this pull request Oct 6, 2026
…nce (#4814)

Joel, 2026-10-06, on attach replay: "it should be impossible". Replay is going
away in the daemon (Cormac), but the consumer must not depend on that: her
surprise tally counted every Reviewed event it was handed, so a replayed gap
or a re-sent event counted her expectation as confirmed or contradicted a
second time. That number now gates whether she trains (#4796), so a
duplicate delivery was corrupting a decision.

- RoomWork::Reviewed and BoardChange::Reviewed carry the review's own id
  (airc's review_id).
- ActivityView keeps the reviews it has counted (bounded by
  UNPERCEIVED_CAP); a review already counted is skipped and probed
  (mind.surprise.duplicate). A new review of the same card still counts.

Test: the same review twice leaves the tally unchanged; a new review of the
same card moves it.


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

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