Skip to content

Training admission follows the lane: its memory pool and its own identity check (card 781885cb) - #5264

Merged
joelteply merged 4 commits into
canaryfrom
781885cb/training-admission-follows-the-lane-its
Oct 22, 2026
Merged

joelteply merged 4 commits into
canaryfrom
781885cb/training-admission-follows-the-lane-its

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

A run leased and fitted against Vram whatever lane it trained in, and re-read the node's
live lane to decide whether its chosen lane still held it. Both were the resident lane's
answers. A CPU-placed lane (IntelMac) keeps its bytes in Ram, and a lane stood up for the
run is never the live-lane record. Each lane source now answers for its own lane:

  • LaneChoice.memory: the governed pool its bytes live in. The resident lane reads it from
    its placement; training_admission (request, wait, wait_bound, acquire) and
    governed_training_free take the kind instead of hard-coding Vram.
  • LaneLease.still_bound: the source's check that the chosen lane (incarnation, endpoint,
    base) still answers, run inside the admission hold. Unbound::{Gone, Replaced} keeps the
    existing split: only a replaced lane returns her examples (card 0b8de4da).
  • LanePlacement::pool_kind owns placement -> pool. modules::serving_daemon::pool_kind_for
    is deleted, serving_pool_kind delegates to it, and genome reads it without an upward
    import.
  • Tests: eleven LaneChoice literals become LaneChoice::at(url, window).

Stacked on #5262 (LaneSource). The engine-lane source (A3b) builds on this. No local
compile (IntelMac serves); CI checks.

Co-Authored-By: Claude Opus 5.5 (1M context) [email protected]
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

@joelteply

Copy link
Copy Markdown
Contributor Author

REQUEST CHANGES — exact ea215d0. Hosted checks are green, but the new pool selection is not durable engine truth.

[P2] Preserve the bound engine memory pool across recovery. In engine_lora_adapter/move_adapter.rs, reclaim_resident_leases now calls request(&consumer, resident_memory(), work.reserved_bytes). resident_memory reads main_lane_placement(), which reads current configuration. ResidentWork records the engine incarnation and bytes but not the pool. If a GPU engine and training run survive a core restart after CONTINUUM_SERVING_PLACEMENT changes to cpu, recovery reserves Ram while the surviving run still consumes Vram. The opposite transition charges Vram for a CPU run. This defeats the boot-time accounting guarantee and can admit competing work into the pool actually in use. The same configuration-derived read in live_lane_for can mislabel an already-running lane before a configured placement change takes effect.

Capture the actual lane placement/pool with its incarnation and persist the bound pool for recovery; do not infer a surviving engine's allocation from the next launch's configuration. Handle older records explicitly. Regression: bind a Vram job, retain the same engine, change configured placement to Cpu, recover, and assert that the Vram reservation remains; also exercise the reverse direction. This should use the existing resource/reattach fixtures, not a second recovery implementation.

The shared ResourceKind threading and identity callback are otherwise a useful consolidation. Please also exercise resident_still_bound's same-incarnation-but-changed endpoint/base rejection: the test LaneSource currently always returns Ok, so the modified fixtures do not cover the production callback. No local compilation or deployment performed.

joelteply and others added 2 commits October 21, 2026 20:15
…tity check (card 781885cb)

A run leased and fitted against Vram whatever lane it trained in, and re-read the node's
live lane to decide whether its chosen lane still held it. Both were the resident lane's
answers. A CPU-placed lane (IntelMac) keeps its bytes in Ram, and a lane stood up for the
run is never the live-lane record. Each lane source now answers for its own lane:

- LaneChoice.memory: the governed pool its bytes live in. The resident lane reads it from
  its placement; training_admission (request, wait, wait_bound, acquire) and
  governed_training_free take the kind instead of hard-coding Vram.
- LaneLease.still_bound: the source's check that the chosen lane (incarnation, endpoint,
  base) still answers, run inside the admission hold. Unbound::{Gone, Replaced} keeps the
  existing split: only a replaced lane returns her examples (card 0b8de4da).
- LanePlacement::pool_kind owns placement -> pool. modules::serving_daemon::pool_kind_for
  is deleted, serving_pool_kind delegates to it, and genome reads it without an upward
  import.
- Tests: eleven LaneChoice literals become LaneChoice::at(url, window).

Stacked on #5262 (LaneSource). The engine-lane source (A3b) builds on this. No local
compile (IntelMac serves); CI checks.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…ames its own placement (Codex on #5264)

Codex's REQUEST CHANGES at ea215d0: recovery and the lane choice read the pool from the
current configuration (`main_lane_placement()`), so a placement change across a core
restart charged Ram for a run still using Vram, or the reverse.

- LaneRecord.placement: stamped at launch from the target. `LaneRecord::memory()` is the
  lane's own pool. A lane recorded before the field reads the configuration under the
  `training.lane.placement_unrecorded` probe until it relaunches. That is explicit and
  bounded to lanes an older build launched.
- ResidentWork.memory: the pool `reserved_bytes` was leased in, recorded at bind.
  `bound_memory()` reads it; a record without one was written by a build whose admission
  leased Vram unconditionally, so Vram is that record's own history.
- reclaim_resident_leases re-takes each lease via `work.bound_memory()`. Split into
  `reclaim_resident_leases_in(&daemon)` so the test hands in its own governor.
- The identity callback is `still_bound_to(rec, base, chosen, url)`, a pure function over the
  lane record, and the production closure calls it with `live_lane()`.

Tests:
- recovery_retakes_each_surviving_run_in_the_pool_it_was_bound_in: Vram-bound, Ram-bound and
  pre-field bindings, each re-taken in its own pool, with this node's configuration never
  read;
- a_lane_is_still_bound_only_at_its_incarnation_endpoint_and_base: the same lane passes; a
  moved endpoint, another base, another incarnation and no lane are refused.

Rebased on canary after #5262 merged. Not compiled here (IntelMac serves); CI checks.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply
joelteply force-pushed the 781885cb/training-admission-follows-the-lane-its branch from ea215d0 to 897815d Compare October 22, 2026 01:18
@joelteply

Copy link
Copy Markdown
Contributor Author

Delta review at exact 1b2b04c: persisted ResidentWork memory and launch-stamped placement address restart reclamation for newly recorded bindings; the Arc receiver correction is consistent. One original correctness gap remains in lane_memory: placement=None still selects main_lane_placement() from current configuration. An inherited GPU engine after a CPU configuration change therefore still admits new training against RAM (and conversely). The probe documents the mismatch but does not prevent it. Please refuse training when legacy placement cannot be established from the actual engine, or obtain authoritative launch placement; do not infer it from current configuration. Add a legacy live-lane/config-change regression. Approval remains withheld pending that delta and exact-head CI.

…priced from config (Codex on #5264)

Codex's remaining block at 1b2b04c: lane_memory read the current configuration for a lane
recorded before placements were. That configuration is the NEXT launch's truth, so a GPU
lane inherited across a change to cpu was priced in Ram.

lane_choice(rec, base) is now the one pure owner. A record without a placement gives no
choice (probe training.lane.placement_unrecorded), so the resident lane isn't offered until
its next launch records one. lane_memory and its fallback are deleted.

Test a_lane_is_priced_in_its_recorded_placement_and_an_unrecorded_one_is_not_offered: Gpu
gives Vram and Cpu gives Ram whatever the configuration; an unrecorded placement and another
base give no choice.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply

Copy link
Copy Markdown
Contributor Author

Source review PASS at exact a5b4280, conditional on remaining hosted CI. The final delta removes the current-configuration fallback entirely: lane_choice refuses unknown legacy placement and uses recorded GPU/CPU placement for known lanes. The new fixture covers both pools, unknown placement, and wrong base; prior persisted binding reclamation and incarnation checks remain intact. This resolves my outstanding findings. This is source approval, not deployment or live training acceptance.

@joelteply
joelteply merged commit 48b605f into canary Oct 22, 2026
8 checks passed
@joelteply
joelteply deleted the 781885cb/training-admission-follows-the-lane-its branch October 22, 2026 02:33
joelteply added a commit that referenced this pull request Oct 22, 2026
… lane serves (card d67fd801, A3b) (#5269)

* In-engine training on a lane stood up for the run, for a base no live lane serves (card d67fd801, A3b)

IntelMac, 2026-10-22: Delia's due bucket is for base qwen2.5-coder-0.5b while the live lane
serves 1.5b. An Intel Mac has neither MLX nor CUDA, so no trainer advertised the base, and
dispatch 7a68a4c6 stayed 'retryable' forever. Nothing on that node could train her examples.

- EngineLane (engine_lane.rs), a LaneSource:
  - stands up a single-purpose lane for the base the way a gene eval does
    (cognition::single_purpose_lane: memory headroom, window plan, GPU-first placement under
    a governed lease, EphemeralServingLane::spawn_with_reservation; --train-dir and, for CPU
    weights, --no-repack come from the shared prepare);
  - reads its LaneChoice from the lane's own LaneRecord via lane_choice (#5264), so the pool
    is the placement it was launched with, and pins the window to the lane's served /props;
  - still_bound checks that lane's record by port; the lane lives as long as the run holds
    the lease.
- It declines any base a live lane serves, whatever that lane's placement record says, so a
  resident base is never loaded twice beside itself. stands_up_for is the pure rule.
- TrainingPlace::EngineLaneHere, declared after GridPeer and before SeparateCopyHere, so a
  lane of our own engine outranks a separate trainer process (MLX/CUDA Python) even where
  that one has the native accelerator, and the resident lane outranks it.
- LaneSource declares provider() and place() (one owner each). The tuner reads them, and
  EngineLoraFineTuner::on_engine_lanes() is the same tuner on these lanes, registered as
  'engine-lane'. Its artifacts stay the engine-local kind.
- trains_in_engine(provider) owns 'is an in-engine job'; genome/job-pause uses it, so
  engine-lane jobs pause like resident ones instead of being refused as Unsupported.
- The lane lease: TRAIN_LANE_TERMS, pinned for the run, like every training lease. Port base
  58_300 is its own range (eval 58_200, vision 58_091).

Tests:
- an_engine_lane_beats_a_native_separate_trainer_and_the_resident_lane_beats_it;
- a_lane_is_stood_up_only_for_local_weights_no_live_lane_serves (IntelMac's case, a resident
  base, missing weights).

Not compiled here (IntelMac serves); CI checks. Measured after deploy, owner Cormac: on
IntelMac the next 0.5b bucket dispatch selects engine-lane, the probe
training.lane.stood_up fires, and the run completes or fails loud.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* A lane acquisition failure keeps its type; a base that turns resident before the spawn is refused (Codex on #5269)

Codex at 66fe092:
- [P2] LaneSource::acquire returned String, and create_job mapped every failure to
  InvalidRequest (never retried as-is), so memory pressure, a lane that would not start, or a
  transient /props error marked a valid due bucket as a bad request.
- acquire never rechecked residency after selection and the headroom wait.

Now:
- LaneSource::acquire returns FineTuningError. An unknown model, or no live lane for the
  resident source, is InvalidRequest. The headroom wait, the spawn, the lane record and the
  served-window read are Transient. create_job passes the error through unchanged.
- refuse_if_resident(base, live) runs after the headroom wait, before placement. A base a
  live lane now serves is refused as Transient, so the retried dispatch selects the resident
  trainer instead of loading a second copy.

Tests:
- a_lane_acquisition_failure_keeps_its_type_through_create_job: through create_job with a
  refusing lane source (no serving process); Transient stays Transient, InvalidRequest stays
  InvalidRequest;
- a_base_that_became_resident_before_the_spawn_is_refused_as_transient.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
joelteply added a commit that referenced this pull request Oct 22, 2026
…22aa3379) (#5270)

* A kept lane records its placement from its engine's own /props (card 22aa3379)

A deploy keeps healthy engines, so a lane launched before lane records carried
a placement keeps placement=None, and training (#5264) withholds a lane whose
pool it cannot name. IntelMac today: lane pid 52415, weights all CPU_Mapped
980 MB on /props, record without placement, resident training paused.

- WeightResidency::observed_placement: all host bytes -> Cpu; weights on a known
  GPU backend -> Gpu even beside host staging buffers; no bytes, no field, or any
  unknown accelerator (RPC, ...) -> None, fail closed.
- placement_stamp.rs: the pure decision placement_to_record(before, live,
  observed, after) stamps only a record without a placement, whose live process
  is the recorded incarnation (pid + start time + port), and which is the same
  incarnation, still unstamped, when re-read after the /props read. A launch
  record is never overwritten; a replacement is never stamped with its
  predecessor's placement. The observed probe reports agreement with the pool
  serving plans this host's lanes in (main_lane_placement).
- LlamaServerControl::record_observed_placement (default no-op), called by
  ensure_model_serving_if_current on every AlreadyServing, so all three
  adoption rails (owned child, decode-proven orphan, busy-alive orphan) record
  it; no serving restart needed.

Tests: classifier (CPU, GPU+host, CUDA+host, unknown, mixed unknown, empty, no
field), stamp decision (stamped, replaced during read, other process, launch
record kept, nothing decided, record gone), reconcile adoption calls the hook
once and a rejected orphan's respawn does not. Not compiled here: IntelMac
serves residents (plan rule 2); CI is the compile.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* Placement stamp: process identity after the read, the charged pool, a guarded write (Codex on #5270)

- The live incarnation is sampled before AND after the /props read; both must
  be the recorded one. An unchanged record proved nothing about the process
  (Codex: an engine exiting mid-read and another taking the port).
- Agreement is a precondition, not a diagnostic: serving charges every lane,
  kept or launched, to serving_pool_kind() = main_lane_placement().pool_kind()
  (modules/serving_daemon/consumer.rs:183, holds.rs:114). An observation in
  another pool is not written, so training stays withheld; the probe names why
  (typed Unstamped). IntelMac: CONTINUUM_SERVING_PLACEMENT=cpu, lane
  --n-gpu-layers 0, /props CPU_Mapped only -> Cpu in Ram, agrees.
- lane_registry::restamp_placement writes only onto the exact record read
  (compare under the registry's write lock, temp + rename), never recreates a
  removed record and never clears another live record as record_in would.
  record_in, remove_in and sweep_in take the same lock.

Tests: the pure decision (replaced/exited after the read with an unchanged
record, not the recorded process, undecided, disagreeing pool, launch record
kept); restamp onto the exact record only (changed, other incarnation,
removed and not recreated, other record untouched). Not compiled here
(serving node); CI is the compile.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* lane_registry: one encoder for both record writers, justified at the disk boundary; poisoned-lock recovery justified

CI on 0f91396: serialization 248 -> 249 and unwraps 2353 -> 2354, both from
restamp_placement_in. record_in and restamp now share encode(), the one
same-line-justified site, so the serialization count falls to 247 (baseline
lowered); the lock's unwrap_or_else carries its reason.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[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