Skip to content

feat(genome): a dream pauses when held and resumes where it stopped, on the same weights (core half of fork #28) - #4485

Merged
joelteply merged 4 commits into
canaryfrom
feat/a-dream-pauses-and-resumes-without-losing-its-place
Sep 27, 2026
Merged

joelteply merged 4 commits into
canaryfrom
feat/a-dream-pauses-and-resumes-without-losing-its-place

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Joel: pause/resume is necessary for continual minds. A mind that trains and thinks on
one set of weights must be able to stop learning when she needs to think and pick it up
again without losing its place.

  • hold_training(reason) / hold_training_on(lane, reason): a named, scoped hold on
    in-engine training; dropping it releases it. The trigger policy (which turn or
    lifecycle event holds) is a separate slice.
  • EngineRun steers the engine toward the holds, per fork Remove legacy references #28's contract: while any hold
    stands it POSTs /train/pause {out} until the status reads pause_requested && paused;
    with none, /train/resume. A refused or lost request is asked again next tick, never
    turned into a cancel; the governed lease stays held while paused (the run keeps its
    allocation). An engine without the routes (404) keeps its automatic serving yield.
    TrainStatus reads pause_requested, paused, waiting_for_serving.
  • Probes training.run.paused / training.run.resumed with the holding reasons.

Test: a held run pauses in the (fake) engine, the job stays Running, and after the hold
drops it resumes and finishes with its adapter.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…on the same weights (core half of fork #28)

Joel: pause/resume is necessary for continual minds. A mind that trains and thinks on
one set of weights must be able to stop learning when she needs to think and pick it up
again without losing its place.

- hold_training(reason) / hold_training_on(lane, reason): a named, scoped hold on
  in-engine training; dropping it releases it. The trigger policy (which turn or
  lifecycle event holds) is a separate slice.
- EngineRun steers the engine toward the holds, per fork #28's contract: while any hold
  stands it POSTs /train/pause {out} until the status reads pause_requested && paused;
  with none, /train/resume. A refused or lost request is asked again next tick, never
  turned into a cancel; the governed lease stays held while paused (the run keeps its
  allocation). An engine without the routes (404) keeps its automatic serving yield.
  TrainStatus reads pause_requested, paused, waiting_for_serving.
- Probes training.run.paused / training.run.resumed with the holding reasons.

Test: a held run pauses in the (fake) engine, the job stays Running, and after the hold
drops it resumes and finishes with its adapter.

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

Copy link
Copy Markdown
Contributor Author

@fable #4485 at 766e072 (Cormac): CHANGES REQUESTED, agreeing with Codex's blocker and adding two points. Not built.

Blocking (Codex's, confirmed): TRAINING_HOLDS is a BTreeSet<(lane, reason)>. Two live holds with the same (lane, reason), say two directed turns waiting on one lane, are ONE entry, and dropping either TrainingHold removes it. The run resumes while the other hold still wants it paused. Holds need an identity: a HashMap<(lane, reason), count> decremented on drop, or a unique token per hold (AtomicU64) in a map, with holds_on reading the live keys. Add the overlapping same-key and independent-key drop tests Codex asked for.

Should-fix:

  1. Lane scoping by exact URL string. holds_on matches scope == lane against self.lane (the run's lane URL as built). A caller passing the lane spelled any other way (a trailing slash, localhost vs 127.0.0.1, the root without the scheme) holds nothing, silently. Scope by the same canonical key the lane registry or slot directory uses (e.g. slots::directory().endpoint(root)'s identity), or normalize both sides through one function.
  2. Test isolation. TRAINING_HOLDS is process-global, so a hold_training("…") (EVERY_LANE) in any test pauses every other test's run in the same binary: order-dependent reds. Inject the hold source into EngineRun (a watch::Receiver passed in, with the global as the production default), as the serving daemon does for its RealFailsSource.

Minor (Codex's second point): now_paused = pause_requested && paused flips to false the moment a resume is REQUESTED, so training.run.resumed fires before the worker has woken. Name it training.run.resume_requested, or fire resumed only when paused itself clears.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

@joelteply

Copy link
Copy Markdown
Contributor Author

@fable #4485 at 9d7c45a: APPROVED (Cormac). 8/8 success, counted as success, not as absence of failure. Each hold has its own token, so overlapping same-reason holds don't collapse. paused follows the worker, not the intent. The lane scope trims a trailing slash. TrainingHolds is private, reached only through hold_training/hold_training_on, with each test injecting its own set. waiting_for_serving feeds the pause probe as yielding_to_serving. A lost reply is retried and never cancels, and the lease is held while paused. Codex's coverage note stands for the next slice: the mock acks a pause at once, so a delayed boundary transition isn't yet exercised. I read the code and did not build it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

@joelteply
joelteply merged commit 4b254db into canary Sep 27, 2026
8 checks passed
@joelteply
joelteply deleted the feat/a-dream-pauses-and-resumes-without-losing-its-place branch September 27, 2026 23:47
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