Recommendation: Ready To Merge
Commit 000a6ac cleanly resolves all four Should Fix findings, the Subtract / Simplify wrapper/loop collapse, and the Nits from the previous review on a9f7dd7: @shieldstar (#547) is properly credited, the unreproducible pre-rebase CPU speedup table is removed in favor of an honest behavior-preserving framing with #547's profile caveat and explicit scope note, mixed_candidates now constructs CurveCache::new(optimistic) and routes optimistic decoders through cached_expected_tokens(..., true, curves), and next_progress / lane-value helpers now take &mut CurveCache directly with no local stack fallback or duplicated mixed_catalog loop. Every substitution (tokens <= 1, width <= 1, limit <= 1, adaptive_verification_alpha == 1.0, prefill_lane_value, and resize_prefill) is a verified bit-exact identity with no concurrency, memory, or hot-path regressions; ensure CI passes on 000a6ac before merging since all reported Layer 1/2/3 runs are currently self-reported.
Merge Risk
Level: Low
- Pure
&selfarithmetic deduplication confined tohelios/src/scheduler/{policy,rounds,learning,policy_tests}.rs; introduces no locks, channels, I/O,unsafe, wire/protobuf changes, captured-graph op contracts, exported-core format changes, or config default changes (adaptive_verification_alpharemains1.0athelios/src/scheduler/policy.rs:41). CurveCache(helios/src/scheduler/policy.rs:100-130,[Option<Vec<f64>>; REQUEST_LANES]withREQUEST_LANES == 64athelios/src/execution/manifest.rs:18, ~1,544 bytes) is stack-scoped per pricing pass (matching the stack array previously allocated inpacked_round_candidates), cannot retain stale state across passes, and strictly reduces per-passVec<f64>allocations andpowfcalls while preservingscore.to_bits()parity.- Main operational caveats are that zero CI checks have run on head
000a6acyet, andpolicy.rs/policy_tests.rsoverlap textually with open PRs#571,#621,#334, and#306.
Walkthrough
helios/src/scheduler/policy.rs: Adds pass-scopedCurveCache(:100-130) with anoptimistic: booldebug_assert_eq!guard; allocates one ordinary cache incandidates(:1633) shared acrossmixed_candidates_with_curves,packed_round_candidates_with_curves,add_candidate,continuation_candidate,prerequisite_value, andnext_progress(and a per-call cache inmixed_candidatesat:1705and#[cfg(test)] phase_planat:2126). Extractsprefill_lane_value(:1407-1434), addscached_expected_tokens(:1389-1405, short-circuitingtokens <= 1) andcached_lane_value*(:1436-1515), updatesmixed_candidates_with_curves(:1760-1775) to reuse the mode-matched cache for both ordinary and optimistic decoders, and keepsresize_prefill(:1997-2008) equivalent viaprefill_lane_valueandexpected_speculative_tokens(LaneValue::decodedelegates todecode_within(..., 0.0, ...)athelios/src/scheduler/utility.rs:108-110).helios/src/scheduler/rounds.rs: Adds#[cfg(test)]thread-localCURVE_EVALUATIONS(:10-14,:646-647, followingcost::ENTRY_LOOKUPSathelios/src/scheduler/cost.rs:15-19); addswidth <= 1short-circuit toproposal_forecast_tokens(:637-642) andadaptive_verification_alpha == 1.0fast paths topowered_curve(:645-656),prefix_lengths_with_values(:571-576), andhost_prefix_ranking(:599-605); threads&mut CurveCacheintopacked_round_candidates_with_curves(:860-906) and skipslimit <= 1lanes (:903-905).helios/src/scheduler/learning.rs: Marksoptimistic_tokens#[cfg(test)]and routes it throughproposal_forecast_tokens(request, width, true)(:11-14).helios/src/scheduler/policy_tests.rs: Adds three thread-isolated call-count tests (:9489-9566) and one bit-exactness parity test (cached_lane_pricing_matches_uncached_for_unit_and_fractional_alpha,:9569-9803) exercisingscore.to_bits()parity acrossalpha = 1.0and0.6, widths0..=8, 1-remaining-token lanes, waitingInit, ordinary and optimisticMixed, packedSpeculative, tie-breaking, andplan()selection.
Pre-merge Checks
- [PASS] Security / malicious screen: Pure arithmetic memoization with no
unsafe, external input handling, or prompt-injection content in the PR description or comments. - [PASS] Charter & value fit: Right model-agnostic Helios scheduling layer, credits
@shieldstar(#547), withdraws the unsupported speedup claim, and discloses profile caveats and out-of-scope call sites perdocs/design-review.md:106-115, 147-162(maintainers can optionally remove theperformancelabel if desired). - [WARN] Related / duplicate / conflict check: Additive over
#188and#540and fixes#547with credit, but touches high-churn files shared by open PRs#571,#621,#334, and#306. - [WARN] Tests & verification evidence: All four new tests exercise real
RequestSchedulerpaths and reset thread-localCURVE_EVALUATIONSper call (thread-isolated, order-independent), and the PR reports full Layer 1 (--release+ debug), Layer 2 (837 simulatorpytestcases), and Layer 3 (TLC2 lifecycle conformance) runs; however, zero CI checks have run on head000a6acyet.
Blockers
None.
Should Fix
None.
Subtract / Simplify
- Optional — inline one-line
cached_lane_valueforwarder (helios/src/scheduler/policy.rs:1436-1446): It has only two production call sites (policy.rs:1578,:1767) and one test caller (policy_tests.rs:9653), and exists only to passpreceding_ns = 0tocached_lane_value_within. Inlining0at those callers removes ~11 lines and one wrapper hop (fine to keep if preserving symmetry withmain's formerlane_value/lane_value_withinpair).
Nits
- Scope-note precision: Inside
packed_round_candidates_with_curves, two pre-existing subpaths still evaluaterequest.acceptance.curveper distinct(shape.drafts, shape.width)pair rather than sharingCurveCache:fixed_prefixeswhenspeculative_fixed_width.is_some()(helios/src/scheduler/rounds.rs:874-888) andhost_prefix_rankingunder host prefix allocation (!gpu_alloc,helios/src/scheduler/rounds.rs:933-934,:592-618, which now benefits from thealpha == 1.0fast path). Mentioning these alongsidelane_values()andresize_prefillwould make the description's scope note completely exhaustive. - Optional optimistic cache sharing in
acceptance_probe(helios/src/scheduler/learning.rs:18-20):acceptance_probecallspacked_round_candidates(..., true)andmixed_candidates(..., true)back-to-back, building two separate optimisticCurveCaches; they could share oneCurveCache::new(true)ifmixed_candidates_with_curvesis madepub(super).
Dropped on verification
- Correctness & Contracts Finding 1 (Major — Charter #210 / Rule 12 violation for
performancelabel and#547powsample): Dropped — at000a6ac, the PR withdrew its CPU speedup table, explicitly claims no standalone GPU serving improvement, and reproduces#547's stripped-binary / no-call-graph caveat on the5.48%sample, satisfyingdocs/design-review.md:106-115, 147-162. Re-blocking on a maintainer-appliedperformancelabel after Round 1's reframing guidance was followed would move the goalposts. - Correctness & Contracts Finding 2 (Major — missing
scripts/scheduling_sim/learning.py(not opened) 64-seed catalog): Dropped —docs/design-review.md:201-206requires thelearning.py(not opened) screening + 64-seed catalog specifically for "Changes to timing estimation or funded refresh" or divergences from the simulator's qualified policy. This PR changes neither timing estimation nor funded refresh norscripts/scheduling_sim/, and preserves bit-identical candidate pricing; the author already ran all 8 scheduling simulatorpytestsuites (837 tests) and Layer 3 TLC2 lifecycle conformance. - Correctness & Contracts Finding 3 (Major — GPU prefix allocation &
materializebypassing cache / unobservable bound): Partially false / over-scoped, dropped —round_lengths_optimistic(helios/src/scheduler/rounds.rs:541-549, called bymaterializeatpolicy.rs:2025) returnsceilingsearly whengpu_prefix_allocationorspeculative_fixed_width.is_some()is true (never reachingprefix_lengths_with_values), and insidepacked_round_candidates_with_curves(rounds.rs:896-935), GPU prefix allocation does useCurveCacheand skipshost_prefix_ranking. The verified pre-existingrequest.acceptance.curvesubpaths (fixed_prefixesand host-allocatedhost_prefix_ranking) are noted above as a minor scope-note nit. - Correctness & Contracts Finding 4 (Minor —
debug_assert_eq!mode guard / two-arrayCurveCache): Dropped — all callers ofcached_lane_value*(policy.rs:1276, 1480, 1578, 1767) are verified non-optimistic (false), debug-mode tests exercise the assertion, and doublingCurveCachefrom ~1.5 KiB to ~3 KiB for a hypothetical future caller violatesAGENTS.md:188-193. - Correctness & Contracts Finding 5 & Subtraction F4 (
CURVE_EVALUATIONSthread-local counter): Dropped —#[cfg(test)] thread_local!matches the existing repo convention inhelios/src/scheduler/cost.rs:15-19(ENTRY_LOOKUPS, tested incheckpoints.rs:1403 (not opened), 1541, 2634), compiles to zero instructions in release builds, is reset before each measurement (thread-isolated), and cannot be replaced byCurveCache::is_cached(which is local to internal passes and cannot distinguish 1 vs 256 evaluations). The#540review dropped a side-patch counter from an unrelated idle-refresh PR, not as a ban on planning-work bound counters. - Subtraction F1 (
powered(&self, probability: f64)scalar helper across 4rounds.rssites): Dropped — replacingif alpha == 1.0 { return curve; }/if alpha == 1.0 { curve }inpowered_curve(rounds.rs:649-655) andhost_prefix_ranking(rounds.rs:601-605) withcurve.into_iter().map(|p| self.powered(p)).collect()would regress an O(1) zero-copyVecreturn into an O(depth) per-element loop + branch. - Subtraction F2 (using
CurveCacheinservice.rs:322/352andpolicy.rs:1999-2007): Dropped —service_rates(helios/src/scheduler/service.rs:321-395) prices a single request, so replacing 24–48 B ofOption<Vec<f64>>with a 1,544 BCurveCacheper request regresses stack initialization overhead, and removingif tokens > 0(service.rs:336, 382) would corruptdelivery_ratewhentokens == 0. Inresize_prefill(policy.rs:1999-2007),bits(candidate.mask & !(1 << slot))visits each slot at most once, so a localCurveCachewould have a 0% hit rate while adding 1,544 B of stack initialization. - Subtraction F3 (removing one of the
width <= 1short-circuit guards): Dropped — both 3-line guards (rounds.rs:638-640inproposal_forecast_tokensandpolicy.rs:1396-1398incached_expected_tokens) are load-bearing on distinct call graphs (scheduler.rs:2483/policy.rs:2004vs cached pricing) to avoid building curves for 0/1-token lanes. - Dossier claim that
Fixes #547will not auto-close#547: Dropped —#547is an issue, soFixes #547in the PR description will auto-close it upon merge to the default branch.