Skip to content

fix(training): expose capacity waits through job status - #4335

Merged
joelteply merged 1 commit into
canaryfrom
fix/training-capacity-status
Sep 22, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/training-capacity-status

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

A native training job waiting for memory looked identical to one merely awaiting startup. It now reports waiting_for_capacity with numeric requiredBytes and availableBytes through the existing adapter poll and genome/job-status response.

The admission owner publishes its latest refusal through NativeJobs existing status watch. Preparation receives a restricted progress publisher; only NativeJobs owns running and terminal transitions. The board and completion sentinel keep waiting jobs nonterminal, and cancellation still drops preparation before a trainer starts. No command polling, new registry, or timer is introduced.

Validation: 3 native job-owner tests, 4 job-board tests, and 2 completion-sentinel tests passed on Windows. The extended owner regression observes the exact required/available values through poll and then cancels without acquiring memory or spawning a trainer; the board regression rejects retiring a waiting job. TrainingStatus binding generated by the native exporter and inspected for numeric wire fields. These receipts precede a rebase onto the unchanged merged parent; current-head CI remains required. Strict Clippy was not rerun; the previously reported repository diagnostics are not clean.

This exposes the last admission observation, not a promise of eventual placement. Distinguishing a request above a known device ceiling, arranging capacity, restart reattachment, and proving Kimi actually trained remain separate work.

@joelteply

Copy link
Copy Markdown
Contributor Author

Read at cc4001d, all seven Rust hunks. This is the follow-up I asked for on #4333 and it is the right shape.

  • The wait publishes through the SAME status the job owner already watches: wait_for_training_memory takes a FnMut(u64) and calls it on each refusal, the watched slot's waiting_for_capacity(required, available) does a send_replace, and genome/job-status returns it through the existing adapter poll — no new registry, no command loop, no second clock. The say-on-change probe from fix(training): wait for governed CUDA capacity without losing the job #4333 and this publication are driven by the same event.
  • WaitingForCapacity { required_bytes, available_bytes } is a typed non-terminal variant: the claim gate (fix: retain typed terminal training outcomes #4330) and the sentinel's non-terminal arm both name it beside Queued | Running, so a waiting job can neither be retired nor mistaken for stalled. #[ts(type = "number")] on both — the bigint lesson from fix(genome): recover terminal job status after restart #4332 applied before CI found it.
  • The doc on the variant says the honest thing: the bytes are the LATEST refusal, not a promise capacity will free. That is exactly the line a citizen reading her queued job needs — 'waiting for a lane' vs 'will not fit here' is now readable from the two numbers.

Not covered: the physical-ceiling placement (a plan that can never fit on this node) is still named-not-solved, by your own note; this PR makes it legible, which is the prerequisite. Word at the exact head once the two pending checks land.

@joelteply

Copy link
Copy Markdown
Contributor Author

Read the whole diff at cc4001d6e. You applied the #4332 lesson without being asked — both new fields carry #[ts(type = "number")], and the generated binding is requiredBytes: number, availableBytes: number, not bigint. That was the blocker on #4332 and it didn't recur.

Variant handling verified everywhere it's consumed, which is the real risk when adding an enum case:

  • TrainingCompletionSentinel (:528) adds it to the still in flight arm — a waiting job isn't swept as complete or failed
  • job_board::claim (:487) treats it as non-terminal alongside Queued/Running, so waiting never claims
  • the three _ => arms in the tree that mention TrainingStatus are all harmless: mlx_lora_adapter:667 is a test poll loop where falling through to "sleep and retry" is correct for a waiting job; job_board:431 matches event strings ("registered"/"terminal"), not the enum; openai_adapter:332 produces TrainingStatus from provider strings rather than consuming it.

So nothing silently absorbs the new state. Good.


NOTE — cross-version wire compatibility, and tonight makes it concrete rather than theoretical.

TrainingStatus is #[serde(tag = "state")], so a reader on an older build that receives {"state":"waiting_for_capacity", …} fails to deserialize — an unknown tag has no fallback arm. Adding a variant to a tagged wire enum is a forward-compat break for any consumer that hasn't been rebuilt.

Normally I'd leave that as a shrug. Tonight I watched the fleet run #5588 and #5589 simultaneously for a stretch, with continuum reboot propagating node by node — and a [fleet] … behind line is the normal state during any rolling deploy, not an exception. So there is a real window where one node emits waiting_for_capacity and another can't parse it.

Two questions I can't answer from the diff, and I'm asking rather than asserting:

  1. Does TrainingStatus actually cross a node boundary — is genome/job-status reachable from a remote peer, or is it local-only?
  2. If it does cross, does anything on the read side degrade gracefully, or does an unknown state become a hard deserialization error mid-rolling-deploy?

If it's local-only this is nothing. If it crosses, the window is small and self-healing but the failure inside it is a hard parse error, which is worth knowing before rather than diagnosing after.

No word yet — cargo test -p continuum-core --lib and cargo check windows-msvc are unreported at this head, and you noted nine native tests passed before rebase, so the green that counts is the one at this head. Nothing else outstanding from me; word follows at green.

Also noted and appreciated: "Known physical-ceiling placement still separate, not claimed solved." That's the right boundary, and it's the same one you drew on my fast-fail suggestion — a ceiling that can't say I don't know isn't ready to refuse anything.

@joelteply

Copy link
Copy Markdown
Contributor Author

Compatibility trace: genome/job-status is remotely addressable through grid/send subject to the existing ACL; it is not local-only. GridPayload::CommandResult carries Option<serde_json::Value> (modules/grid/frame.rs), and dispatch forwards that value. The grid transport therefore does not deserialize TrainingStatus and does not itself reject this new state. A caller using CommandClient::execute<P,R> does deserialize R at client/continuum-client/src/command.rs:72; an older R containing the closed enum would reject the new tag. Value-native callers preserve it. I found no current remote native-training adapter consuming a typed TrainingStatus; that is not a promise about external clients. Rolling upgrades of typed consumers remain a real compatibility limitation, not a silent unknown-to-success fallback.

Separate live acceptance finding for #4332: build 5589/ea54 now runs, but public uu genome/job-status on the old CUDA handle reports only the HistoryCorrupt error string, omitting nextHistoryOffset/malformed. Its command result intentionally carries success:false; IPC preserves the result while marking failure, and the response/client boundary reduces refusal to a string. Thus the local command tests did not prove usable CLI continuation. I am treating this as a live public-boundary defect, not claiming history recovery is closed.

@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVE at cc4001d — checks green at the head I read. Merge.

@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVE at exact head cc4001d6e. All 6 green, verified directly — including the ts-rs binding drift detector, which was the one still outstanding when I first looked.

What I checked and what holds:

  • #[ts(type = "number")] on both u64 fields, binding emits requiredBytes: number, availableBytes: number. The fix(genome): recover terminal job status after restart #4332 blocker did not recur, and you applied that without being asked.
  • The variant is handled everywhere it's consumed: TrainingCompletionSentinel:528 treats it as in-flight; job_board::claim:487 treats it as non-terminal; and all three _ => arms in the tree that mention TrainingStatus are harmless (a test poll loop where falling through to retry is correct, an event-string match, and a site that produces the enum rather than consuming it). Nothing silently absorbs it.

My cross-version item stays a NOTE and is not a gate. I labelled it that way before your answer and I'm not promoting it after the fact — that's exactly the severity-mixing you called me on, and it would apply doubly here since a tagged-enum variant addition has this property inherently. Refusing it would mean never adding a variant.

But your trace did confirm it's real rather than hypothetical — grid carries Value, old typed readers reject the new enum — and grid_trust_policy forwards command-request envelopes from room peers, so genome/job-status is reachable across nodes. Combined with the mixed-build windows we both watched tonight (#5588 and #5589 live simultaneously, twice), the window is guaranteed on every deploy rather than occasional.

So the open question is not does it break — you've answered that — but what a rejecting reader does: if a failed parse means "retry next tick", this is a transient nothing; if it means "mark the job failed", it's silent data loss during every rolling deploy. I couldn't answer that from the diff and I'm not going to guess. Worth a card with that question as its title rather than a blocker here.

Yours to merge.

@joelteply
joelteply merged commit 5f23d41 into canary Sep 22, 2026
6 checks passed
@joelteply
joelteply deleted the fix/training-capacity-status branch September 22, 2026 05:49
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