Repository navigation
refactor(kio)!: move kio back into rs/kio, and pace a group no subscriber picked up yet - #9770
Merged
Merged
Conversation
Quest-Claim: a27910f86db107be
…MOQ_EPOCH Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he start Ingest read past its window while a received group had no consumer yet, since pacing treated a group nobody holds as unwatched. A group is now owed to its track's subscribers until a reader picks it up, so its writer keeps to one window; it reads on once its readers leave or its track's last subscriber does. The credit model's late readers now pause from the start, and its allowance rules hold for them too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WIP checkpoint: reverts #9675 and imports kixel-ai/kio main (ce495aa). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s one frame A group nobody reads yet is ingested unpaced by design, so the test's bound held only while its reader attached before hop 2 ingested a window. kio's new scheduler runs the relays first, so moq-transport (and moq-lite under random schedules) overshot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…emand The publisher's demand at the third narrowing follows the absolute start the widening before it sent, so it settles on group 1. The live join the test waited for was only the state before that update landed, which kio's old FIFO schedule happened to show first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under kio's new fifo schedule the publisher applies the step-1 widening (Absolute group 1) before step 2 narrows. The old expectation of a live join only held because that update had not landed yet; once it does, the narrowing to group 3 resolves to the newest group, group 1, and the aggregate never becomes a live join. Expect the state every interleaving converges to. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps that branch's owed-group pacing (and its TLA+), which fixes two_relays_bound_their_cache at the root, and drops this branch's test-only reordering of that test. kio itself comes from rs/kio rather than the pinned git rev. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A reader marks a group held only once it counts, and the gate reads the mark before the count, so it never opens between the two. - `just rs sweep` fails when either schedule fails. - The fan-out bench resolves each checkout's own kio source again, so a base from the git-pinned period still builds. - verify-credit's drift command covers group.rs; kio's verify package knows the `model` feature; kio's AGENTS.md defers to rs/AGENTS.md on host time. - The release cut checks kio and kio-macros against crates.io. - quest/m1/owed-group-pass-over.md plans the accepted pass-over gap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Handoff note from a parallel session that worked this quest before the kio move landed here. I will not push to this branch.
(Written by Claude Opus 5.5) |
kixelated
marked this pull request as ready for review
November 27, 2026 20:18
This was referenced Nov 27, 2026
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.
Finishes quest/m0/kio-main.md, absorbs quest/m0/kio-crates-io.md, and moves kio back from kixel-ai/kio.
Problem
kio was split into kixel-ai/kio (moq-dev/moq#9675) mostly to prototype model checking. Its only consumer is moq, and little kio-only work is planned, so the split cost every kio change a two-repo dance: bump the rev, hakari, both lockfiles,
nix/Cargo.nix, and the bench and demo crates. moq also pinned an old kio rev (866ef06). On kiomain, the simulated scheduler (kixel-ai/kio#10) reorders polls and fails two moq-net tests.Approach
Move. Revert #9675's removal and three-way merge kio
main(ce495aa) intors/kio,rs/kio/macros, andrs/kio/verify. Workspace path deps replace the git rev everywhere: hakari, bench crates, lockfiles,nix/Cargo.nix, anddeny.toml.lab/(the pure-machine prototype) stays in the archived repo, and quests link it at a pinned commit. kio's tooling comes along:rs/kio/AGENTS.md, covering kio's rules and the Verus proof ofsrc/log.rs.nix develop .#verusandjust rs verify, for the proof.just rs sweep(random and pct schedules withKIO_SIM_PROBE),just rs miri-seeds, andjust rs tsan.sh/rs/nightly.shis the nightly sysroot helper thatmiri.shnow shares.kio-verifyjob. The merge gate does not change.quest/, and stale links to kixel-ai/kio are updated.Pacing (from the earlier session on this branch). Ingest's pace gate treated a group no reader had picked up yet as unwatched, so it read on past the pace window. A subscriber that picked the group up a moment later found it already a stream window ahead. Real readers always pick a group up after ingest starts, so the one-window bound held only when the reader won the race. A group not yet picked up is now owed to its track's subscribers. Its gate closes from the start and opens once its readers leave, or, before anyone picks it up, once the track's last subscriber leaves (
Handle::owed,Handle::poll_unowed,Pace::hold).ReceiveCredit.tlamakes a late reader's arrival fair and lets nobody drop a group they still owe.EveryPauseFitsandChargedAllowancenow hold with late readers too. With this, hop 2 oftwo_relays_bound_their_cache_and_resume_without_a_holeholds about 986 KB on every version.Test.
draft22_cold_widening_finishes_the_largest_groupexpected a transientLiveaggregate at start=2. The step-1 widening goes out asAbsolute{group 1}. On main that update hadn't reached the publisher when step 2 checked, so the check passed against step 1's staleLive. When it lands first, the narrowing to group 3 resolves the publisher copy's time start to the newest group, group 1, so the aggregate settles atkeys(1..)under every schedule. Both sessions on this branch reached this independently.Other.
moq_net::time::EPOCH.DialersPhase::Openis boxed for kio's new size lint.kio-macros'not_sendUI snapshot is re-blessed on moq's toolchain. It matches the pre-split file.sh/migrate.shlets a newly added package bring its ownMIGRATE.md, with tests. Otherwise the gate would reject kio's guides as edits outside the release cut.Impact
rs/kio/MIGRATE.md, Unreleased):Wall::MOQ_EPOCHis removed; usemoq_net::time::EPOCHinstead.MOQ_SIM_SEEDis nowKIO_SIM_SEED, with no fallback.Wall::from_unix_secsisconst.moq_net::time::EPOCH(2020-01-01T00:00:00Z) and kio'smodelfeature (BFS checker).kioandkio-macrosfrom moq again. That needs the crates.io trusted publisher moved back (see Follow-ups).Alternatives
kio::clock::sim::idle(). It never settles in this fixture, because a periodic timer keeps re-arming.Follow-ups
kioandkio-macrosfrom kixel-ai/kio tomoq-dev/moqrelease-rs.yml(environmentpublish). Tracked inquest/m3/crates-trusted-publisher.md.[build-dependencies]regain about 60 host crates now that kio is a workspace member again, the same as before the split; movingkio-macrosto hakari'straversal-excludeschanges nothing, so the source is elsewhere.Absolutefilter past the newest group to a time start, which a copy resolves back to the newest group, so the origin is asked for one group more than the subscriber wants. This is harmless, since the serve trims it, but worth a look alongside the subscriber narrowing above.--all-featuresstack overflows inimplementation::cluster_dials_advertise_the_relayand inbursts_cross_a_*::loopback, which also fail onmain.KIO_SIM_PROBE=1ondraft22_cold_wideningreports a possible lost wakeup in RunSubscribe's Serve step.quest/m4/sim-adversarial-sweep.mdowns probe sweeps.Validation
quest gate just ci origin/mainon the head: clean, 13,990 tests passed.bench/fanout.test.pypasses.just rs sweep: 251 kio tests pass under random and under pct.nix develop .#verus --command just rs verify: 21 verified, 0 errors.two_relays_bound_their_cache…anddraft22_cold_widening…underKIO_SIM_SCHEDULErandom and pct, seeds 1–10 each: 40/40 passed. The draft22 fix alone also passes on main's old kio pin, and 40/40 under random and pct with seeds 1–20.just test interop --all, and everyrs/moq-net/verify/creditTLA+ config (ReceiveCredit404k states,ReceiveCreditSegments462k,ReceiveCreditGuards12.1k, plus Wide, Three, and Send).Decisions
kio-crates-io.md.quest/m1/owed-group-pass-over.mdrather than growing this PR.MIGRATE.mdedits for the release cut, and left the verify-credit sync commit unchanged.Caused by
draft22_cold_wideningasserted a transient narrowing instead of the settled demand. Found by check: the kio scheduler.Models
🤖 Generated with Claude Code
(Written by Claude Opus 5.5 with high)
Review
Rewritten by
quest reviewafter each round.Head: 802e8f1
Base: origin/main at fcfa5b1
Risk: high,
it changes .github/workflows/nightly.yml, which is always high, as are 3 more of its paths: workflows run with the repository's secretsClassified: high by the always-high paths
Risk file: bb7b1c0de60b
Accepted by the maintainer:
Maintainer accepted 2026-11-27: the owed-group pass-over stall is bounded by group expiry and needs a narrowing while another subscriber stays attached, while the pacing fix closes the cache bound for every late reader; the per-key owed check and its TLA+ pass-over action are planned in quest/m1/owed-group-pass-over.md.Reviewer: Codex, gpt-6.2-sol, high effort
Session:
01a21e3e-00a8-78a3-8b90-921df496a4a4, round 2Score: 10/10,
All three earlier findings are fixed, and the changes since the last review introduce no new findings.Rounds: 2; first round 3 (high 1, medium 2); findings 3 (high 1, medium 2): fixed 3, refuted 0, open 0
Findings: none
The last round's findings, at a532c8a:
rs/kio/Cargo.toml:8:Release kio before publishing its MoQ dependents;The release checklist now requires checking the independent registry versions, bumping `kio` to 0.7.0, and raising the workspace dependency requirements before publication (`quest/m3/release/cut.md:25`).rs/moq-net/src/model/group.rs:3583:Publish first-reader arrival atomically with group demand;Both attachment paths count the reader before marking the group held, and ingest reads the held marker before the count, closing the window where it could see the first reader as held but uncounted (`rs/moq-net/src/model/group.rs:3583`, `rs/moq-net/src/model/group.rs:3710`, `rs/moq-net/src/model/group.rs:3748`).bench/run.sh:1275:Resolve the fanout harness against each baseline’s kio source;The runner rewrites each copied harness from the selected checkout’s workspace dependency, preserving Git pins and resolving local paths for their respective baselines (`bench/run.sh:1276`, `bench/fanout.py:177`).Reviewer: Claude Code, claude-opus-5-5, high effort, second
Session:
4d896c8b-6ff0-430d-9b29-cbb20eb664a1, round 2Score: 8/10,
The sweep exit status, the fan-out rewrite, the drift paths, and the held/count race are all fixed; only the owed-group pass-over stall remains, and the maintainer decision deferring it can't yet be checked outside this PR's own quest file.Rounds: 2; first round 5 (medium 5); findings 5 (medium 5): fixed 3, refuted 1, open 1
Findings, accepted by the maintainer:
rs/moq-net/src/model/group.rs:3711:A group every cursor skips still counts as owed and parks its ingest streamThe last round's findings, at a532c8a:
rs/justfile:414:`rs sweep` loop hides a failure on the random schedule;rs/justfile:414 now ends the loop body with `|| exit 1`, so a failing `random` schedule fails the recipe.rs/moq-net/src/model/group.rs:3705:A group every cursor skips counts as owed and parks its ingest stream;owed()/poll_unowed() are unchanged on this point, and the maintainer acceptance appears only in quest/m1/owed-group-pass-over.md, which this PR adds, so it can't be verified from the base or a GitHub review..claude/skills/verify-credit/SKILL.md:79:verify-credit sync commit and drift path list are stale;The drift path list now includes group.rs, and rs/moq-net/verify/README.md:11 says to move the sync commit only once the model describes the code, which pre-existing unmirrored commits rule out at the base.bench/run.sh:1276:Fan-out bench of a git-pinned-kio base points at a missing rs/kio;bench/run.sh:1276 again calls `fanout.py rewrite`, whose `kio_dependency_line` takes each checkout's own path/git/version kio entry before falling back to rs/kio.rs/moq-net/src/model/pace.rs:62:Group reader lifecycle split between a `Pace::held` atomic and the channel's consumer count;consume/try_consume now count the reader before `hold()`, and owed/poll_unowed read `held` (SeqCst) before the count, so a writer can no longer see held with no reader while one is arriving.