Repository navigation
Conversation
Quest-Claim: a781906f5d83f380
Since #9530, a join's SUBSCRIBE_START left every run given up below its reach untold, on the subscription's record and on each of a front's copies. Every later update that widened the budget rescanned the cache and gave each up again, one poll step at a time ahead of every group: on a relay holding a minute of 20 ms timestamp-keyed audio, about 5,000 drops after each widening, which stalled the native player's startup. Final runs below the reach now stay told and are kept aside, named once owed: those reaching up to a group served below the start, and those an update lowering the start reaches. Stale runs are forgotten on the subscription's record alone, as before #9530, so a wider budget may still serve one while a front's copies give up none again, and a stale run given up below the start after it resolved goes unnamed too. The JS publisher mirrors it, and its lite-06 updates naming no start no longer lower delivery to group 0, as in Rust. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves the conflict with #9791: a stale run judged under lite-07's freshness bound, or an upstream's verdict under no bound at all, counts as final, so it stays told and is named once it reaches up to the start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bill unsent runs - A stale run untold below the start is forgotten on a front's copies where their fills gave it up, so a widened budget still asks upstream for it (`track::Subscriber::untell_stale`). Cached skips stay told on the copies, which re-offer those groups regardless. - A lowered start forgets everything the copies reported below the old start (`untell_copies`), so a front names what a plain track does. - The final runs held unsent below the start live in the reader's `Record`, billed and folded with the reports they shadow, instead of an unbilled map on the publisher. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A debt fold now drops every run the record holds unsent, with its report, before folding the rest. So the pool reclaims them however their holes split them, and a later lowered start still owes and names them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace Record::unsent and partial untell hooks (untell_stale, untell_misses, untell_copies) with an explicit owed-drop filter (Subscriber::set_drop_owed) and direct track/copy lookup for reaching drops (Subscriber::reaching_drops), mirrored in js/net. This keeps Record::reported truthful for every key the wire was told, eliminates O(history) per-subscriber unsent billing and drop-cursor rescans on budget widenings (for both plain and routed tracks), and fixes both Round 3 debt-fold findings by construction: - Record::fold on a drop-tracking reader (Standing::drops) now reopens unreported skips and Misses::given_up verdicts instead of settling them into floor/reported, and DropCursor::next falls back to non-adopted-stale Misses::given_up verdicts if TrackState::shed_drops evicted a queued received drop before it went out. - Serving a cached group below start queries reaching_drops directly from the track or serving copy against the logical wire record, so a debt fold on the logical record never drops the reaching verdict.
…ubscribe model - Stop reaching_drops at retryable route failures (Error::retryable / routeFailed) on fronts in both Rust and JS. - Close the popped group and clear streaming in JS Publisher if resolveStart or reaching-drop forwarding fails or throws. - Replace per-poll Record::fold reported/pending scan and immediate Misses::reopen with Beside::forget_untold and an O(1) forgotten_debt span on Misses, reopened only when drop_owed widens, set_range lowers the floor, or the budget widens past forgotten_budget. - Preserve Hole::Skip in Misses::adopt_drops so fold_given_up and final_below reconstruct Skip if state.drops sheds it. - Pass the current clamped budget when seeding record.pending on first DropCursor creation. - Mirror drop-reader PubFold eligibility (served or handed) in rs/moq-net/verify/subscribe/SubscribeAccounting.tla. - Name reaching drops for shed groups below start in Rust, and clip queued front pending drops in JS #setDropOwed.
This branch has not been deployed
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/nightly/audio-bursty-regression.md and deletes it.
Problem
Nightly's bursty audio rows regressed on 11-25: about 3 s after the join, arrivals stopped for 300 to 800 ms, then landed together. On the runner,
native-opus-48000-burstyfailedtarget_ms_p95andtrimmed_ms_per_minon every run, and the chromium rows failed on about half.Cause: since #9530, a join's SUBSCRIBE_START untells every run given up below its reach. It untells them on the subscription's record and on each of a front's copies. The native player then sends updates that widen its budget, and each one rescans the cache. The copies give every run up again, one poll step per run, and all of those steps run ahead of the next group. On a relay holding a minute of 20 ms timestamp-keyed audio, that came to about 5,000 drops after each widening. Most were stale groups; the rest were final timestamp gaps.
The runner bisect over
5d86f05321..main(3 runs per commit, bursty rows only) put the first bad commit at f031ffe (#9530). Reverting only #9530'spublisher.rschange restored the rows. Reverting only itsresume.rschange did not.#9561 then raised audio groups from 20 ms to 100 ms, which cut the history fivefold. That hid the stall: the scheduled Nightly 46038678705 on
mainpassed every bursty row.Approach
Instead of holding untold runs in a shadow
Record::unsentmap and partially untelling copies, keepRecord::reportedtruthful (only keys actually told to the wire) and bound drop scanning/reporting directly to the keys the wire owes:Subscriber::set_drop_owedin Rust,hooks.setDropOwedin JS): OnceSUBSCRIBE_STARTresolves,TrackRun::sync_drop_owed(Rust) andsyncDropOwed(JS) restrictDropCursor(and every copy of a front, including copies promoted fromPendingtoReadyand queued front drops in JS) toowed(start)(start..plus any lite-07 explicit history ranges below it).start, whileDropCursor::nextandCursor::write_off_staleonly scan/emit drops withinowed, eliminating the O(history) rescan and per-run drop flood on both plain and routed tracks.TrackRun::resolvekeeps the truthfuluntellof everything below reach, andlower_start/updatesimply widendrop_owed(which bumpsdrop_owed_revand triggers a rescan over the newly owed span).Subscriber::reaching_dropsin Rust,hooks.reachingDropsin JS): When a budget widening serves (or sheds) a cached group belowstart,name_reachingqueries the contiguous final drops immediately belowkeydirectly from the track or serving copy (clipped above any still-feeding replaced copies, and stopping at retryable route failures such asUNROUTABLEon a front, even afterstate.dropsreclaims them) against the logical wire record. No shadowunsentruns are kept or billed, and a debt fold on the logical record cannot erase the reaching verdict. In JS, a failed or throwing reaching-drop write closes the popped group and clearsstreaming.Record::fold,Beside::forget_untold,DropCursor::next):Standing::drops),Record::foldclears non-emptyskipped/written_offand callsBeside::forget_untold(floor, &reported, &pending, self.rescan)before removingreceived: trueentries frompending, without scanningreportedorpendingas a whole.Misses::forget_untoldremoves untoldgiven_upverdicts without touchingjudged,at, orrescan(avoiding per-poll fill churn under sustained debt), keeps queued upstream skips across rescans, and records an O(1) bounding spanforgotten_debtwithforgotten_narrowest(the minimum budget across all forgotten verdicts) reopened whenset_drop_owedwidens,set_rangelowers the floor, or any range inforgotten_debtwidens pastforgotten_narrowest.final_endunderFold::Debtfor drop readers settles onlyreportedanddelivered(guarded byreader.handed), mirrored inrs/moq-net/verify/subscribe/SubscribeAccounting.tla(PubFold).Misses::adopt_dropspreserves upstreamHole::Skipinmisses.skippedand non-NotFoundupstream errors (such asUNROUTABLEorEVICTED) inmisses.adopted_errors, so bothfold_given_upandfinal_belowreconstruct the exactHoleifTrackState::shed_dropsevicts a drop before reporting or reaching-drop lookup, while skipping adopted stale verdicts (whichDropCursor::nextreads directly fromstate.drops, preservingsupersede_stale).DropCursoris first created after an ordered read already advancednext_key, it seedsrecord.pendingfrommisses.fold_given_upclipped todrop_owedand judged per span viabudget.runs(part)against the current clamped budget beforeprobeclipsmisses.js/netmirrors the exact same owed-drop filter (setDropOwed), direct reaching-drop lookup (reachingDropsstopping atrouteFailed), truthfulWireRecord.untell, and lite-06 update floor alignment (lowering delivery to group 0 only when an update drops an explicit floor).reversible(Rust and JS) andfinal_boundtreat stale verdicts judged under the track's own freshness bound (or an upstream's unbounded verdict) as final.Impact
Alternatives
Record::unsentwith partial untell hooks (untell_stale,untell_misses,untell_copies): earlier rounds tried this, which billed O(history) runs per live subscriber, leftDropCursorscanning0..u64::MAX, and broke under cache pool debt folds (Codex Round 3 findings). Replaced by the owed-drop filter + direct reaching-drop lookup above.Caused by
Validation
GitHub-hosted
ubuntu-24.04-arm(Nightly's runner class),just test audio-quality --profiles bursty --codecs opus --capture, 3 runs each. Budgets:target_ms_p95at most 350,trimmed_ms_per_minat most 110.mainwith 20 ms groups still has a separate stall from a later change (see Follow-ups).Audio qualitysteps on 5b02475 and 0565d2e: all 14 chromium rows and all 14 native rows within budget (--enforce).074a8e0abe:a_join_names_no_gap_past_a_skipped_group(Rust and JS): asserts a budget widening takessteps == reaching.len()on both plain and routed tracks, names only the reaching drops, and a lowered start on a front matches a plain track.a_debt_reopens_unreported_verdicts_for_a_drop_reader(rs/moq-net/src/model/record.rs): verifiesRecord::foldon a drop reader forgets unreported skips/misses without settling them or settingrescan.a_lowered_start_still_names_gaps_after_debt_fold(rs/moq-net/src/lite/publisher.rs): verifies sustained debt causes zero fill churn belowstart, and a later lowered start still names every gap belowstart, even whenTrackState::shed_dropssheds drops mid-drain.a_widened_budget_still_names_reaching_drop_after_debt_fold(rs/moq-net/src/lite/publisher.rs): verifies widening the budget on a front after logical-record debt still names every reaching drop from the serving copy.a_widened_budget_stops_reaching_drops_at_retryable_route_error(rs/moq-net/src/lite/publisher.rs): verifiesUNROUTABLEbelow a served group is not forwarded as final and stops the contiguous reaching-drop walk, both cached and afterstate.dropsreclaims it.a_shed_adopted_skip_is_reconstructed_as_skip(rs/moq-net/src/model/track.rs): verifies an adopted upstreamHole::Skipshed fromstate.dropsbefore reporting is reconstructed asHole::Skip, with and without repeated reader debt folds while queued.a_widening_before_first_drop_poll_does_not_seed_narrow_stale(rs/moq-net/src/model/track.rs): verifies widening before the firstpoll_dropdoes not seed an obsolete narrow stale verdict.a_widening_past_a_narrower_forgotten_debt_verdict_rejudges_it(rs/moq-net/src/model/track.rs): verifies forgetting a wider miss then a narrower miss tracks the narrower budget so a later widening past it re-judges the span.a_multi_range_seed_judges_each_span_against_its_own_budget(rs/moq-net/src/model/track.rs): verifies firstpoll_dropseeding on a multi-range subscription judges each stale segment against its own range budget.a_stale_run_untold_below_the_start_asks_a_fill_once_widened(rs/moq-net/src/model/track.rs): verifies both plain and routed tracks re-ask fills for stale runs untold belowstartonce widened.verify-subscribe) on0fd0f8d60f/2b95d9bd50(invariant unchanged on074a8e0abe):CutGroupEnd.cfg: 97,737 states, 28,943 distinct states, 0 errors.PlainReset.cfg: 149,959,121 states, 32,168,466 distinct states, 0 errors.SubscribeAccounting.cfg: 550,396,373 states, 78,579,506 distinct states, 0 errors.074a8e0abe:cargo fmt --check: passed.just check: all checks passed (check rs,test rs11,836 passed / 0 failed,check rs_cross,check biome,check jsacross all 26 packages,test jsincluding 4,012js/nettests,check dead_code,check audio_quality,check carla_bridge,check coverage_tables, doc/script/quest checks).just test interop --all: all checks passed.Decisions
mainwith 20 ms audio groups plus this fix still fails native-opus-bursty in 2 of 3 runs. f031 plus this fix passes, so the residual comes from a later change, which the 100 ms groups from feat(audio): audio groups span 100 ms by default #9561 hide.Record::unsentwithset_drop_owed+reaching_dropsinstead of accepting Round 3's debt-fold findings. KeepingRecord::reportedtruthful and filtering drops to the owed set removes the shadow map, fixes both Round 3 findings by construction, and eliminates the O(history) widening work on plain tracks as well as fronts.Record::unsentwith the owed-drop filter and direct reaching-drop lookup.Follow-ups
finish python -> cinterop failure on an earlier run: the C reader drained 0 of 10 frames, and the cell did not reproduce in 8 reruns (passed onddda2710ba,2b95d9bd50, and074a8e0abe).Models
Size: M
Implementer: Claude Code, claude-opus-5-5, unknown (arm A)
Implementer: Claude Code, claude-opus-5-5, unknown (review fixes, arm A)
Implementer: Antigravity, gemini-4-neon, high effort
(Written by Gemini 4 Neon with high)