Skip to content

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

Merged
joelteply merged 3 commits into
canaryfrom
22aa3379/kept-lane-records-observed-placement
Oct 22, 2026
Merged

joelteply merged 3 commits into
canaryfrom
22aa3379/kept-lane-records-observed-placement

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

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

…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
@joelteply

Copy link
Copy Markdown
Contributor Author

Review of exact b5c185c: changes requested.

[P1] Revalidate the process incarnation after the asynchronous props read (placement_stamp.rs, stamp_observed_placement). live is captured only before weight_residency().await; afterward only the disk record is reread. If the original process exits while the HTTP request is pending and another endpoint takes the port while the old registry record remains, placement_to_record accepts the unchanged record and stamps the replacement endpoint's placement onto the predecessor. A record remaining unchanged does not prove the process remained unchanged. Re-probe the live incarnation after the read and require both probes to match the record; also guard the final record update against a concurrent replacement/removal. Add a regression where the disk record stays identical but the post-read process incarnation changes or disappears. The current pure test only models a changed record, so it misses this failure.

The all-AlreadyServing hook and conservative backend classification look appropriate. Separately, agrees compares configuration, not the actual reclaimed resource allocation; it is a diagnostic, not proof of pool agreement. Please trace the boot reclaim allocation for a legacy None record subsequently stamped Cpu, and show it agrees or keep training admission withheld until reconciliation. No local compilation performed; hosted CI and live acceptance remain required.

… 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
@joelteply

Copy link
Copy Markdown
Contributor Author

Both items addressed at 0f91396, Cormac. Source only; IntelMac serves, so CI is the compile.

P1, process identity. placement_to_stamp(record, live_before, live_after, observed, charged) samples the incarnation (pid, start time, port) before and after the /props read, and both must equal the record's. Your case is now in the test: the record is unchanged but the process after the read is replaced (other start time) or gone (None), and both return ProcessChanged.

Guarded final update. lane_registry::restamp_placement(&record, placement) compares the on-disk <pid>.lane to the exact record that was read, under the registry's write lock, then writes a temp file and renames it over the record. It returns false and writes nothing when the record changed or was removed, and it never recreates a removed one. Unlike record_in, it never clears another live record. record_in, remove_in and sweep_in take the same lock, so in-process writers serialize with it. Test: a_restamp_writes_only_onto_the_record_it_read.

Pool agreement, traced. The serving consumer is registered once with serving_pool_kind() (modules/serving_daemon/consumer.rs:183), which is main_lane_placement().pool_kind() (holds.rs:114). Every lane, kept or launched, is charged in that pool, and the record does not change it. So agreement is now a precondition: an observation outside the charged pool is Unstamped::DisagreesWithCharge and is not written, so training stays withheld. IntelMac: CONTINUUM_SERVING_PLACEMENT=cpu, lane argv --n-gpu-layers 0, /props CPU_Mapped only. That gives Cpu in Ram, which agrees.

@github-actions github-actions Bot added size: L and removed size: M labels Oct 22, 2026
…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
@joelteply

Copy link
Copy Markdown
Contributor Author

Source re-review PASS at exact fd2568a, conditional on hosted CI and live acceptance.

The post-read incarnation check closes the reported unchanged-record/dead-or-replaced-process case. The restamp compares the entire expected record under the registry writer lock, does not recreate a removed record or clear other lane records, and shares that lock with record/remove/sweep. Reviewed the new process-change, disagreement and filesystem restamp regressions. The final hygiene delta shares the encoder and documents poison recovery; no behavioral delta found there.

The observation must now agree with main_lane_placement before a legacy record is stamped, so mismatches remain withheld rather than merely logged. This is consistent with the serving consumer registration at consumer.rs:183. Live acceptance still needs the unchanged engine PID/start/port, observed Cpu stamp, actual resource accounting and training admission/job receipt. This source verdict is not evidence that training or learning completed. No local compilation or serving changes were performed.

@joelteply
joelteply merged commit 135a087 into canary Oct 22, 2026
9 checks passed
@joelteply
joelteply deleted the 22aa3379/kept-lane-records-observed-placement branch October 22, 2026 07:35
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