Skip to content

A leased job's adapter is reported by its files' digests and its base's fingerprint, never the trainer's path (card 3fd98325, S3-1) - #5418

Merged
joelteply merged 4 commits into
canaryfrom
3fd98325/lease-artifact-by-digest
Oct 25, 2026
Merged

joelteply merged 4 commits into
canaryfrom
3fd98325/lease-artifact-by-digest

Conversation

@joelteply

@joelteply joelteply commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

What this serves

This is the receiver half of returning an adapter trained across the grid: path step 3 (Learning) and line 16's drivers. A resident's adapter trained on a peer has to come back to her node, be verified there, and enter the examiner's held-out, gene-off comparison. This PR makes the peer report the trained artifact in a form the origin can verify. Design: #continuum-dev 2026-10-25; transport agreed with Codex as a chunked range read behind ArtifactSource, which lands in S3-2.

The defect

genome/lease/poll passed the trainer's Completed{artifact} through unchanged (lease.rs:274 on a59c2bf). The origin received a local_path that exists only on the peer, and no digest.

Change

  • The format owns which files an artifact IS (TrainingArtifact::payload, a new artifact_payload.rs).
    • GGUF LoRA: its one file.
    • MLX: adapters.safetensors + adapter_config.json, never the 0000300_adapters.safetensors checkpoints in the same directory.
    • PEFT: adapter_model.safetensors + adapter_config.json.
    • Provider-hosted or Candle skeleton: there is no gene to return, and that answer is final.
  • One record per completed lease (lease_artifact.rs). On the first completed poll, each file's name, size and SHA-256 are hashed in spawn_blocking and recorded once on the lease row (AttemptLedger::record_return, first write wins). Later polls answer from the record even if the file changes, so S3-2's byte reads can refuse a mismatch.
  • The base it was trained on, as its trainer read it (Codex). The base is never resolved from the registry when the job is polled.
    • Serving stamps the weights file a lane is launched on before spawn (LaneRecord.weights: path, size, mtime, file identity). There is no hashing at launch.
    • The engine trainer carries its lane's stamp through the persisted run spec to JobMetrics.trained_on. It's ts-skipped and never sent on the wire.
    • The receiver hashes the base only through one handle proved to be the stamped file before and after the read (WeightsStamp::content_sha256). A replaced or missing path is final Unreturnable, and so is an unstamped job.
    • The manifest's LeaseArtifactBase carries sourceSha256 (identity, matched exactly by the origin) and fingerprint (lora_base_fingerprint, header-only, compatibility only: a same-header sibling has the same fingerprint). The registry modelId is the one the lease named.
    • The bound, stated in weights_stamp.rs: a stat cannot see a same-file, same-size, same-mtime rewrite in place, nor a replacement in the instant between the stamp and the engine opening the file.
    • File identity moves down to continuum-host::file_identity (logic in mod.rs, calls in unix.rs/windows.rs). expert_placement::preparation's cfg-branched copy migrates onto it.
  • Only a GGUF LoRA returns. Its trainer read the served base GGUF. MLX and PEFT trainers resolve an HF snapshot at start and record no revision, so their adapters read Unreturnable rather than carrying a guessed revision. Follow-up: card d3889a9e.
  • New poll outcomes: LeasePollOutcome::{Completed{artifact}, Unreturnable{reason}}. The origin maps Unreturnable to a final Failed and keeps Completed pending (Transient) until its import lands in S3-2. training_lease_return is still not emitted, so no origin leases yet.
  • RecordingFineTuningAdapter::with_local_artifact extends the existing fixture, with no new mock.

Tests (what this catches on each)

  • an_artifact_returns_only_the_files_its_format_names (genome): directory and path leakage, and unreturnable artifacts treated as retryable.
  • a_completed_artifact_is_described_by_its_bytes_and_the_base_its_trainer_read:
    • the chronology fixture: trained on A, then the path is replaced by a same-header sibling B before the first poll; the result is refused, never reported as B;
    • an unstamped job, MLX, and provider-hosted all read unreturnable;
    • no path crosses the wire.
  • only_the_stamped_file_is_vouched_for (engine) and a_replaced_path_is_another_file (host).
  • the_base_digest_is_its_tokenizer_and_shapes_not_its_quantization (engine): F32 and F16 copies give the same digest; a different tokenizer, or no architecture, does not.
  • a_completed_lease_is_reported_by_its_recorded_manifest: the command path end to end. The report stays the first record after the file is replaced.
  • Updated: the stub trainers' provider-hosted completions now read Unreturnable at the receiver and a final Failed at the origin.

Measured

Nothing live. This is source plus unit tests, and the receiver isn't reachable until S3-2 emits training_lease_return. CI is the compile: no cargo runs on enrico while it serves.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

…'s fingerprint, never the trainer's path (card 3fd98325, S3-1)

genome/lease/poll passed the trainer's Completed{artifact} through unchanged, so the origin
received a local_path that exists only on the peer and no digest to verify anything against.

- The format owns which files an artifact IS (TrainingArtifact::payload): a GGUF LoRA is its
  file; an MLX or PEFT adapter is its final weights and config, never the intermediate
  checkpoints MLX leaves in the same directory. Provider-hosted and Candle skeletons have no
  local gene to return, which is final.
- On the first completed poll the receiver describes the artifact (each file's name, size,
  SHA-256, hashed off the runtime) and records it once on the lease row. Every later poll
  answers from that record, even if the file on disk changes, so serving the bytes (S3-2) can
  refuse what no longer matches.
- The manifest carries the base it fits: the registry id the lease named (now recorded at
  admission) and lora_base_fingerprint of this node's GGUF of it: architecture, {arch}.*
  hyperparameters, tokenizer.ggml.* and tensor names and shapes, with quantization, naming
  and the chat template left out. A GGUF LoRA may omit tokenizer metadata (Codex), so the
  origin checks this against its own base rather than trusting a model id.
- lease/poll answers Completed{artifact} or Unreturnable{reason}; the origin maps
  Unreturnable to a final Failed and keeps Completed pending until its import lands (S3-2).
  training_lease_return is still not emitted, so no origin leases yet.

RecordingFineTuningAdapter gains with_local_artifact, so a test moves real files.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply and others added 3 commits October 25, 2026 07:49
…r digest is compatibility only (Codex on #5418)

The header fingerprint cannot tell a base from a fine-tuned sibling with the same
architecture, tokenizer and shapes. The manifest's base now carries sourceSha256, the whole
base GGUF's content digest, which the origin must match exactly; the header digest stays as
compatibility evidence. Only a GGUF LoRA is returned: an MLX or PEFT trainer resolves an HF
snapshot at start and records no revision, so a revision read afterwards would be a guess;
those read Unreturnable until their trainers record it. The negative fixture describes one
adapter on a base and on a same-header sibling: same compatibility digest, different source.
The two GGUF test writers are one fixture with a weight parameter.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…at lane launch; never what the registry resolves at poll time (Codex on #5418)

The receiver resolved the base GGUF from the registry when it first saw the job completed and
hashed that file: proof of the bytes at poll time, not of what the trainer read. A path or
registry replacement between training and the poll could label an adapter trained on A as B.

- Serving stamps the weights file a lane is launched on (path, size, mtime, file identity on
  its volume) before spawn, on LaneRecord.weights; no hashing at launch.
- The engine trainer copies its lane's stamp onto the persisted run spec and the finished
  artifact (JobMetrics.trained_on, ts-skipped), so a re-attached run names the same base.
- describe drops the registry resolver: it hashes stamp.path only through one handle proved
  to be the stamped file before and after the read (WeightsStamp::content_sha256). A path
  that now names another file, or none, is final Unreturnable; a job with no stamp is
  Unreturnable, never stamped from the registry. The stamp never crosses the wire.
- The bound, stated in weights_stamp.rs: a stat cannot see a same-file, same-size, same-mtime
  rewrite in place, nor a replacement in the instant between the stamp and the engine's open.
- File identity moves down to continuum-host::file_identity (mod.rs logic, unix/windows calls),
  and expert_placement::preparation's cfg-branched copy migrates onto it.

Fixtures: trained on A, the path replaced by a same-header sibling B before the first poll is
refused (never reported as B); an unstamped job is Unreturnable; a replaced path is another
file (host); the stamped file alone hashes (engine). Also fixes the life test's assertion text.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…the stamped file; a deleted or invalid replacement is final (Codex on #5418)

describe parsed the base header from the path before checking the stamp, so a base deleted
or replaced by something that is not a GGUF failed as a retryable header error before the
final 'gone' could be decided. WeightsStamp::read_verified now opens one handle, proves it is
the stamped file, runs the reader (header fingerprint, then the whole-file hash, on that same
handle), proves it again, and only then reports the reader's own failure: a replacement
outranks any read error. lora_base_fingerprint takes a reader, not a path; the test-only path
variant and content_sha256 are gone. Fixtures: replacement by a non-GGUF and deletion both
read final Unreturnable through describe; read_verified ranks Changed above the reader's error.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply
joelteply merged commit 28bf81f into canary Oct 25, 2026
25 checks passed
@joelteply
joelteply deleted the 3fd98325/lease-artifact-by-digest branch October 25, 2026 13:21
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