Repository navigation
A leased adapter comes back: the origin pulls it by verified ranges into its own job directory, and both ends advertise training_lease_return (card 92cd2251, S3-2) - #5419
Merged
Conversation
…nto its own job directory, and both ends advertise training_lease_return (card 92cd2251, S3-2)
After S3-1 a peer reported a completed lease by its recorded manifest, but nothing could fetch
the bytes and the origin's poll held a finished job as pending forever.
Receiver: genome/lease/artifact {attempt, file, offset, len} serves one range of a recorded
artifact file, resolved through the caller's own lease key and the manifest recorded when the
job was first reported, by file NAME only (never a caller path). A file whose size no longer
matches the record is refused. A range is at most MAX_ARTIFACT_CHUNK (8 KiB): the narrowest
airc route caps a whole frame at 16 KiB (WebRTC, airc 0763991ac per Codex), base64 brings 8 KiB
to ~10.9 KiB, and the 4 KiB reserve is >5x the largest envelope measured on this mesh (706
bytes over 32 events, 13:46Z). A test pins a full chunk's encoded answer under the budget.
Origin (LeasePull, behind an ArtifactSource seam so a stream transport is an adapter swap):
- create_bound records the request durably in default_job_dir(persona, trait, attempt) BEFORE
the lease is sent (job_dir::write_job_request: written, synced, placed whole); a failed
record sends nothing (TrainerUnavailable).
- On a peer's Completed it starts one pull per attempt, off the poll: the base's content
digest must equal this node's served base's (by verified handle); each range is appended to
a private partial file beside the request; the whole file is hashed against the manifest;
then it is placed with continuum_host::durable::replace. Poll reads Running with progress
until then, and a local Completed{GgufLora} afterwards, so the completion sentinel, the
adoption and the examiner (trained_from = that directory, request.json present) run
unchanged. A refused range, wrong digest or wrong base is final Failed; a transient error
ends the pull and the next poll resumes from the partial file; a placed, verified file is
found again after a restart without pulling.
- job_dir::find_job_dir_under finds a job's directory by id (a lease handle names only the
attempt).
training_lease_return is now emitted: both the receiver's return and the origin's import and
acceptance consumers are wired (Codex's condition).
Fixtures: the return end to end over the real receiver (three ranges, a lost range reply
resumed not restarted, a restart that does not re-pull, a base whose content is not this
node's refused); the range verb's bounds, forged origin, caller path, changed file and frame
budget; the request written whole and found by id.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…me, and it keeps the manifest it pinned (Codex on #5419) 1. create_bound wrote request.json unconditionally: a retry of the same attempt with another payload rewrote the accepted request, and another persona opened a second directory that the lookup picked by enumeration order. The lease is now recorded once: a binding (peer, attempt, request digest) and the request, each published write-once (job_dir:: publish_job_file over durable::publish_new); a retry is compared before anything is written or sent and refused when its payload, base, peer, persona or trait differs. find_job_dir_under takes its anchor file and refuses two directories of one id. 2. The peer's file name was joined into local paths: the adapter now lands at the fixed returned/adapter.gguf (partial .adapter.gguf.partial); a peer's name only names the range it is asked for. 3. status read then inserted: two polls could start two writers. The start is decided under the map's entry lock. The manifest is pinned once per attempt (manifest.json, write-once); a later report or a restarted origin offered another manifest is final, and the local artifact is built from the pinned manifest the bytes were verified against. Fixtures: changed dataset/base/peer/persona refused and the original kept across a restart; a manifest naming ../../evil lands only at the fixed name; two barrier-released polls start one pull; a restarted origin refuses a changed manifest; a changed retry sends nothing. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…ts request digest checked, and a pull checks its binding before pinning (Codex on #5419) (a) The life test's changed-persona retry now asserts the origin's refusal ('nothing sent'). (b) An existing request.json is compared against the binding's digest on a retry; one that is not the bound request fails closed. (c) Pull::run reads the directory's lease binding before pinning or pulling: bound to this peer and attempt, its request.json the one the binding names, and the request's base the base the manifest names. Anything else is final. (d) record_request's scan for an existing directory and its publishes run under one lock per attempt (one core per node), so two first records under different personas cannot both win. Fixtures: two thread-raced changed-persona records, exactly one wins; a manifest naming another base than the request, a pull for another peer than the binding, and a tampered request.json are each final; the tampered request also fails the retry. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…documents its one-writer-per-root invariant (Codex on #5419) CI at f4babf3 compiled and failed only the two inventory assertions (10 -> 11 command objects, 13 -> 14 module commands): both now count the artifact verb and assert it by name. LeasePull's doc states the lifecycle invariant Codex named: one instance writes a genome root (built once at boot), so its per-attempt lock and single-flight map cover every writer. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this serves
This is path step 3 (Learning) across the grid: a resident on a weak node gets an adapter trained on a stronger peer, and it comes back into her own genome, where the examiner sits it on held-out work. It completes the cross-grid training lease's return (S3 of card 6f05b89d) after #5418, and is the change that turns leasing on.
Change
Receiver:
genome/lease/artifact {attempt, file, offset, len}.MAX_ARTIFACT_CHUNKis 8 KiB. The narrowest airc route caps a whole frame at 16 KiB (WebRTC, airc 0763991acwebrtc_datachannel/adapter.rs:15, per Codex). Base64 brings 8 KiB to about 10.9 KiB, and the 4 KiB reserve is more than 5× the largest airc envelope measured here (706 B over 32 events, 2026-10-25T13:46Z, airc 0.1.0). A test pins the encoded size of a full chunk.Origin:
LeasePull, behind anArtifactSourceseam. A stream transport later is an adapter swap.create_boundwritesrequest.jsondurably intodefault_job_dir(persona, trait, attempt)before the lease is sent (newjob_dir::write_job_request). If that write fails, nothing is sent (TrainerUnavailable).WeightsStamp::read_verified). Ranges append to a private partial file beside the request, the whole file is hashed against the manifest, and then it's placed withcontinuum_host::durable::replace.Runningwith progress, then a localCompleted{GgufLora}. From there the completion sentinel, the adoption, and the examiner (trained_from= that directory, which holdsrequest.json) run unchanged.Failed.job_dir::find_job_dir_underfinds a job's directory from its id, because a lease handle names only the attempt.Capability.
training_lease_returnis now emitted: the receiver's return and the origin's import and acceptance consumers are both wired, which was Codex's condition.Tests (
what this catcheson each)a_leased_adapter_comes_back_verified_into_the_origins_own_job_dir: the return end to end over the real receiver commands. It covers:an_artifact_range_is_served_only_from_the_record_and_fits_the_narrowest_route: nothing is served before the artifact is reported. It also covers bounds, a forged origin, a local caller, a../name, a changed file, the encoded size under the budget, and a short tail.a_leased_jobs_request_is_written_whole_and_found_by_its_id(genome).create_boundrecords the request first.Measured
Nothing live yet. Live acceptance, owner Cormac, after deploy: one real lease from enrico (the weak node) to a peer that serves the same base. Receipts:
genome.trial.openedwithprovenance=true;GeneExamReceipt(held-out, gene off versus on), and the restart re-run.Until that receipt, this is source plus unit tests. CI is the compile, since no cargo runs on enrico while it serves.
🤖 Generated with Claude Code
https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE