#1 [high] Finding: requests_completed_total scope silently changes (docs/HELP mismatch)
VERIFIED in head pr/692.
helios/src/server/metrics.rs:1077-1080(unchanged by the PR) still promises model-generation semantics:
"requests_completed_total",
"Requests whose model generation completed successfully, including explicit token stops.",
&self.completed,
and docs/api.md:330 says | completed | Requests whose generation completed successfully | flare_requests_completed_total |. docs/api.md:332 is the failed line the PR cites.
- Under the new deferred machine, the same counter means two different things depending on the entry point:
runtime.rs:1145-1151generate_for_output→enqueue_many(..., defer_completion = true)(HTTP + decisions) parks inOUTCOME_GENERATED(runtime.rs:143-147), andGeneration::dropmoves GENERATED→CANCELLED (runtime.rs:275-291), so a request whose model generation did complete incrementscancelled, nevercompleted.runtime.rs:1136-1143generate/generate_many→defer_completion = false, so PENDING/READER_DROPPED→COMPLETED (runtime.rs:146,:163-181): model-generation completion.
So flare_requests_completed_total becomes "model generation finished and the HTTP consumer validated output" for HTTP/decisions traffic and "model generation finished" for in-process SDK callers, with neither HELP string nor docs/api.md:330 updated. Impact: operator dashboards/alerts built on completed/cancelled/failed ratios (and the #541 Grafana example) silently change definition; the PR's premise is that the metric HELP already described the fixed behaviour, which is true only of failed, not of completed/cancelled. Fix: update metrics.rs:1077-1089 HELP text and docs/api.md:328-332 to the end-to-end definition, or state that the deferral applies only where the reader is an HTTP/decisions output layer.
#2 [high] Finding: new outcome state machine unmodelled; conformance harness only covers defer_completion=false
VERIFIED in head pr/692.
docs/design-review.md:234-240: "Modifying the Helios scheduler, admission, speculation, cancellation, cache ownership, completion validation, readiness, or rank coordination without running—and updating when behavior, transitions, or supported bounds change—the applicable TLA+ models, Rust conformance fixtures, Kani harnesses, and scheduling simulator is a blocking design failure". And :241-246: "When a change adds protocol states ... update the model, conformance fixture, or Kani harness to cover the added domain rather than leaving it unverified."
The PR adds six protocol states OUTCOME_PENDING/GENERATED/READER_DROPPED/COMPLETED/CANCELLED/FAILED (helios/src/server/runtime.rs:109-114) and changes cancellation/completion transitions, but:
helios/src/server/runtime/response_lifecycle_tests.rs:122drives the harness throughself.runtime.generate_many(...)— thedefer_completion = falsepath only (compareruntime.rs:1141-1151).- The harness's terminal action calls
row.producer.emit(GenerationEvent::Finished {...})directly (response_lifecycle_tests.rs:146-165), i.e.Incoming::emit, not the newIncoming::emit_finished(runtime.rs:553-582) whosetry_reserve/Full→failordering is the one place the budget can now convert a completion into a failure. So the harness cannot observe that transition at all. - No TLA+ action/fixture for
GENERATED -> COMPLETED|CANCELLED|FAILEDexists; the PR reports only the existingcheck.pyrun, which asserts nothing about the new states.
Impact: the deferred (HTTP/decisions) half of the new machine — the half the PR exists for — is outside the formal/conformance gate, which the doc calls "a blocking design failure, regardless of whether CPU unit tests pass". Fix: extend ResponseLifecycle.tla + the conformance harness to model the deferred terminal transitions (ideal: have the harness call emit_finished and a &mut Generation consumer op), and add mutation guards so the absorbing-state ordering is actually tested.
#3 [high] Research summary
Reviewed PR #692 against head pr/692 (base main; note pr_diff failed for every path — "Could not read c513e46" — so all verification was done by reading head files and main files side by side, not the diff itself).
The mechanism is sound in the areas I could verify: RequestOutcome's six states are genuinely absorbing (each of record_generated/record_completed/record_cancelled/record_failed/on_reader_drop CASes out of a restricted source set into a terminal state, and only the successful CAS increments a counter: helios/src/server/runtime.rs:138-296); fail_output() records FAILED before setting cancelled (runtime.rs:352-357), so the worker cannot re-classify it; emit_finished's reserve→record→send ordering (runtime.rs:553-582) closes the "completed despite overflow" hole; and all four worker cancellation sites now go through record_cancelled() (runtime.rs:1650, 1670, 1683, 1738). No unlocked head-of-line bottleneck, unbounded buffering, or extra copy is introduced — the new state is one Arc<AtomicU8> per request on a path that already allocates a channel, two oneshots and a semaphore permit (runtime.rs:1198-1245). The concurrency test (runtime.rs:4573-4649, 3×3 worker/consumer ops × both defer modes × 128 barrier-synchronised iterations asserting exactly one increment) and the terminal-overflow test (:4470-4571) are real and do cover the interleavings that matter. I found no double-count or decrement path.
Two high-severity issues, both saved to the scratchpad with citations, verbatim quotes, impact and fix: (1) flare_requests_completed_total / _cancelled_total silently change scope for HTTP and Decisions traffic (deferred completion means an un-validated reader drop now counts cancelled where the model generation completed) while metrics.rs:1077-1089 and docs/api.md:328-332 still document model-generation semantics — and the same counter now means two different things for generate_for_output vs generate/generate_many; (2) the PR adds six new protocol states and changes cancellation/completion transitions but extends no TLA+ model or conformance fixture for the deferred half, which docs/design-review.md:234-246 calls a blocking design failure — the existing response_lifecycle_tests.rs harness drives generate_many (defer=false) and emits the terminal event through Incoming::emit rather than the new emit_finished, so it structurally cannot observe the transition the PR adds.
Two further leads I could not fully confirm before the turn limit, recorded here for the next reader: (a) two pre-existing in-repo Python counter assertions now have ambiguous expected outcomes — tests/server/test_protocols.py:676 asserts flare_requests_cancelled_total rises on an n=4 streaming disconnect (that path may now land in GENERATED→completed if Finished was already consumed before the drop) and tests/server/test_decisions.py:257-261 requires cancelled to rise for a decision child whose reader is aborted mid-score() (that still lands in PENDING→cancelled, so it likely holds); the PR does not report running either suite. (b) emit_finished's Closed arm calls record_generated() unconditionally (runtime.rs:570-573), which for defer_completion = false increments completed even though no consumer ever received Finished — deliberately matching pre-PR behaviour for direct callers, but worth a maintainer's eye since it is the one place the "completion means someone saw it" invariant is not held.
#4 [high] Verified-sound areas and tool caveat (pr_diff unavailable)
VERIFIED in head pr/692. Record so the report does not over-claim defects in areas that are sound.
RequestOutcome(helios/src/server/runtime.rs:109-296) is genuinely absorbing:record_generatedPENDING→GENERATED|COMPLETED (:142-162) and READER_DROPPED→CANCELLED|COMPLETED (:163-185);record_completedPENDING|GENERATED→COMPLETED (:191-212);record_cancelledPENDING|READER_DROPPED→CANCELLED (:214-235);record_failedPENDING|GENERATED|READER_DROPPED→FAILED (:237-258);on_reader_dropPENDING→READER_DROPPED and GENERATED→CANCELLED (:260-295). Only the successful CAS increments (eachmetrics.*.fetch_addsits insideOk(_)), so no decrement and no double count.fail_output()records FAILED beforecancel()(runtime.rs:352-357), matching its own comment, so the worker cannot re-classify an output rejection as cancelled.emit_finished(runtime.rs:553-582) reserves the channel slot beforerecord_generated(), soFullbecomesfailviaself.fail(...)(→finish_error→record_failed,:583-595) rather thancompleted;finish_erroralso records FAILED before notifying admission/first-token so an immediate receiver drop cannot race it.- All four worker cancellation sites call
record_cancelled(), not the counter:runtime.rs:1650(pending),:1670(parked),:1683(active),:1738(admission candidate). Nometrics.completed.fetch_addoutsideRequestOutcomeremains (grep ofmetrics.(completed|cancelled|failed)returns only:156,177,179,203,226,249,286plus test assertions). - Cost: one
Arc<AtomicU8>per request alongside the channel/oneshots/permit already allocated atruntime.rs:1198-1245; no lock added to the hot path, no buffering growth, no extra copy. Not a contention or memory-amplification concern. - Evidence quality:
runtime.rs:4570-4649(3 worker ops × 3 consumer ops × both defer modes × 128 barrier iterations asserting exactly one increment) andruntime.rs:4470-4571(terminal budget overflow, both defer modes, plus drop-orderings) are real tests of the new interleavings.
Environment caveat for the record: pr_diff failed on every path with git: error: Could not read c513e46a79f3b6ac510235aaf09bcf055b841958, so this review compared head files (ref: pr/692) against main files (ref: main) directly rather than reading the diff. Line numbers cited from head are from read_file output, not reconstructed.
#5 [medium] Leads: Python counter assertions unrun; emit_finished Closed arm records completed
Leads partially verified before turn limit; state them as leads, not confirmed defects.
(a) Two pre-existing in-repo Python counter assertions have ambiguous expected outcomes under deferred completion, and the PR does not report running either suite (its evidence lists only cargo tests and check.py):
tests/server/test_protocols.py:663-676: opens ann=4streamingignore_eoscompletions request, reads one SSE line, then closes; assertsafter["flare_requests_cancelled_total"] > before["flare_requests_cancelled_total"]. Undergenerate_for_output+defer_completion = true, the fourGenerations drop while the worker is still decoding →on_reader_dropPENDING→READER_DROPPED andrecord_generatedREADER_DROPPED→CANCELLED (runtime.rs:163-185), socancelledshould still rise — unless a choice'sFinishedwas consumed first, which cannot happen here (the client read only one line and cancelled). Likely still passes, but unverified at runtime.tests/server/test_decisions.py:221-263(test_decision_disconnect_cancels_child_and_drains_native_ownership): cancels the client task whileflare_active_requests > 0and requiresflare_requests_cancelled_totalto rise.score()(helios/src/server/protocol/decisions/mod.rs:838-890) holds oneGenerationat a time inPENDING, so the drop lands in READER_DROPPED and the worker'srecord_cancelled(runtime.rs:1650/1670/1683/1738) incrementscancelled. Likely still passes. Impact if wrong: a counter assertion flips and the suite fails on a later CI run, not on this PR's self-reported evidence. Fix: run the two Python suites (or state them as unrun) and adjust expectations to the end-to-end definition.
(b) emit_finished's Closed arm calls record_generated() unconditionally (helios/src/server/runtime.rs:570-573):
Err(async_mpsc::error::TrySendError::Closed(())) => {
self.cancelled.store(true, Ordering::Release);
self.outcome.record_generated();
}
For defer_completion = false this transitions PENDING→COMPLETED and increments completed even though no consumer ever received Finished (the receiver is gone). That preserves pre-PR behaviour for direct generate/generate_many/test callers, so it is not a regression, but it is the one place the PR's "completion means the consumer settled it" invariant is deliberately not held, and it is not called out in the description. Fix: comment it as an intentional direct-caller compatibility path, or route it through READER_DROPPED so the state machine stays uniform.