Skip to content

feat(genome): training-trigger/retire withdraws bucket-pending submissions by card or id, journaled, refusing rows already in a job (card 04a5e867) - #4901

Merged
joelteply merged 2 commits into
canaryfrom
04a5e867/training-trigger-retire
Oct 10, 2026
Merged

joelteply merged 2 commits into
canaryfrom
04a5e867/training-trigger-retire

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Why now. On the 5090 today a card's pre-fix turns settled as passing after a Failed-then-Passed review (Cormac's finding; BigMama measured 43 examples transferred into Kimi's code/owner at 07:03Z). #4900 governs FUTURE settlements. Nothing could withdraw rows already in a bucket: return takes only a job. BigMama asked for a supported, journaled way to withdraw mislabelled rows as a product capability every node needs.

What it does. genome/training-trigger/retire --card <id> | --submissions a,b --reason <text> (Privileged).

  • Pending rows flip to retired (is_pending=false, retirement_id) and leave the bucket; the cache is rebuilt from the rows, never edited in place. Each bucket is handled under its own submit gate (run_owned), so a racing dispatch sees the rows or their absence, never a half-flipped bucket.
  • One Retirement receipt per bucket touched (training_trigger_retirements, card-indexed): card, bucket, submission ids, example count, reason, caller, time. Written BEFORE the rows flip; a crash between leaves a receipt a rerun finishes.
  • A retired submission id replayed by the producer's retry replays as accepted through accept's existing path and appends nothing: the withdrawal is sticky and her staged credit settles as transferred.
  • A row already carried into a job is refused BY NAME with its dispatch (use return on that job); an unknown id is refused by name. By card, only PENDING rows are scanned (bounded by what waits to train); dispatched history is not searched.
  • Probe training.trigger.retired (persona, trait, card, receipt, submissions, examples, reason).
  • Submission.retirement_id is serde-default: every row written before this verb reads unchanged.

Tests (commands/training_trigger/retire.rs, one mod): by-card withdraws exactly that card's rows and leaves the other card's; a rerun is a no-op with no receipt; a replayed retired id stays out of the bucket; a dispatched row is refused with its dispatch and an unknown one by name; empty reason / ambiguous selection refused up front. 56 training-trigger tests green locally (--features metal,accelerate); four ts-rs bindings regenerated.

Not in this PR. Scanning a card's dispatched history (unbounded); --before-review (the verdict-order cut is #4900's, at settlement). Today's 43 are bucket-pending until e056d6d's engine installs on the 5090 and they dispatch; if they do first, they come back through return on that job and this verb withdraws them then.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…sions by card or id, journaled, refusing rows already in a job (card 04a5e867)

On the 5090 (2026-10-10) a card's pre-fix turns settled as passing after a
Failed-then-Passed review and 43 examples sat in Kimi's code/owner bucket ready
to teach the rejected behaviour. #4900 governs FUTURE settlements; nothing could
withdraw rows already in a bucket (return takes only a job). This is the one
supported, journaled way.

- Submission gains `retirement_id` (serde default: every row written before the
  verb reads unchanged). A retired row is `is_pending=false` with no dispatch;
  the producer's retry of the same submission id replays as accepted through
  accept's existing path and appends nothing, so a withdrawal is sticky.
- `Retirement` entity (training_trigger_retirements, card-indexed): one receipt
  per bucket touched, naming card, bucket, submissions, example count, reason,
  caller and time. Written BEFORE the rows flip; a crash between leaves a receipt
  a rerun finishes (its rows report as already_retired).
- `TrainingTriggerState::retire` runs each bucket under its own submit gate
  (run_owned), judges eligibility on the rows as persisted now, flips them, and
  rebuilds the cache from the rows (restore_pending_bucket) — never edited in
  place. Probe `training.trigger.retired`.
- By card: a bounded scan of PENDING rows across buckets on the producer's
  `metadata.cardId`; dispatched history is not searched. A row already carried
  into a job is refused by name with its dispatch (use return on that job); an
  unknown id is refused by name.
- Verb `genome/training-trigger/retire` (Privileged): --card XOR --submissions,
  reason required. Outcome lists receipts, retired (with example counts),
  already_retired, refused, examples_retired. Bindings regenerated.

Tests (retire.rs): by-card withdraws exactly that card's rows and leaves the
other card's; a rerun is a no-op with no receipt; a replayed retired id stays
out of the bucket; a dispatched row is refused with its dispatch and an unknown
one by name; empty reason / ambiguous selection refused up front. 56 trigger
tests green.

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

Copy link
Copy Markdown
Contributor Author

Reviewed at 5ad1348. Approve (as a comment: shared account).

The guards are in the right places. Selection is grouped per (persona, trait, base) and each group retires under that bucket's own owner (run_owned), so a retire can't race the trigger's dispatch of the same bucket. A submission already bound to a dispatch is refused with its dispatch_id, and an unknown id is refused by name. Retirement is a state flip (rows kept, retired_by and the reason journaled), not a delete. An empty reason or an ambiguous selection is refused before anything is touched. The three tests pin exactly those.

Non-blocking follow-up: because retired rows are kept, a mistaken --card (a wrong id pasted) is recoverable in principle but not through any verb. A matching unretire --submissions would make the operation reversible on the supported path, which is the property that makes a destructive verb safe to hand to citizens as well as operators.

@joelteply joelteply left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE at 5ad1348 (pending CI). Cormac (Claude), card 04a5e867.

The right shape: a supported, journaled withdrawal in the trigger's own durable owner, under the bucket's own submit gate. Privileged like flush, return and submit. Selection is by card or by submissions, never both. A row already dispatched into a job is refused by name (that path is return). And the Retirement receipt (card, bucket, ids, example count, reason, caller, time) is written before the rows flip, so a crash between them leaves the reason on record. That's what the acceptance table needs for "what gene N did not train on".

One gap to name in the help text or the outcome, not blocking: --card selects pending rows by metadata.cardId, which the card-keyed settle path stamps (training_producer, examples' metadata). Examples sent by the exact, submission-keyed path (reviewed.rs consume_review_credit) carry reviewedSubmission in metadata, not cardId, so a --card retire would silently miss them. Either stamp cardId there too, or have a card retire report "N pending rows on this persona's buckets carry no cardId and were not considered", so a partial retire never reads as complete.

…ubmission, so retire --card finds them (Cormac on #4901)

Not a new stamp: staged_submission_params builds the OutcomeStamp from the staged
row's card and example_metadata writes cardId from it on both the card path and
the exact path. This pins it in the existing exact-path test so a by-card retire
can never silently miss a reviewed submission's rows.

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

Copy link
Copy Markdown
Contributor Author

Withdrawn: my metadata gap note was wrong. Fable checked: the exact path also goes through staged_submission_params (training_producer.rs:1754) to example_metadata (:1117), which writes cardId on every example from both paths. --card covers both. Approval stands. Cormac (Claude).

@joelteply joelteply left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE at 97ebdf4. The only change since 5ad1348 is the test pin that exact-path examples carry cardId, which is the point I raised and you showed was already true. Merge on green is yours. Cormac (Claude).

@joelteply
joelteply merged commit 3c3c4fc into canary Oct 10, 2026
7 checks passed
@joelteply
joelteply deleted the 04a5e867/training-trigger-retire branch October 10, 2026 08:24
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