#1 [high] Change: what PR #692 actually changes (verified against diff)
PR #692 (jcartu), head 348c06c, base main (branched at c513e46), open, ready for review, 4 files +1068/-32, no reviews, no CI checks. Files: helios/src/server/runtime.rs (+443/-15), helios/src/server/runtime/phase_tests.rs (+585/0), helios/src/server/http.rs (+20/-9), helios/src/server/protocol/decisions/mod.rs (+20/-8).
Mechanics (verified in the diff and head files):
- New
RequestOutcomein helios/src/server/runtime.rs:109-296:Arc<AtomicU8>with states PENDING/GENERATED/READER_DROPPED/COMPLETED/CANCELLED/FAILED plus adefer_completionflag; each ofrecord_generated/record_completed/record_cancelled/record_failed/on_reader_dropCASes into an absorbing terminal state and does exactly onemetrics.{completed,cancelled,failed}.fetch_add. Generationgainsoutcomefield pluscomplete_output()(runtime.rs:348-350) andfail_output()(runtime.rs:352-357: record_failed THEN cancel());Drop for Generationcallsoutcome.on_reader_drop()then cancel (runtime.rs:378-383).Incominggainsoutcomeandrecord_cancelled()(runtime.rs:550-552); newIncoming::emit_finished()(runtime.rs:553-582) replaces the twometrics.completed.fetch_add+emit(Finished)sites in the worker (old lines at diff hunks ~2290 and ~2576): it returns early if a failure is already recorded, usesevents.try_reserve(); on Ok it callsrecord_generated()then sends Finished; on Closed it sets cancelled + record_generated(); on Full it callsself.fail(...)("generation exceeded its output event budget") + sets cancelled.Incoming::finish_error(runtime.rs:583-595) now callsoutcome.record_failed()BEFOREnotify_admission/first-token/event send (ordering is deliberate: HTTP may drop the receiver as soon as admission errors).- Worker cancellation sites now call
record_cancelled()instead ofmetrics.cancelled.fetch_add: runtime.rs:1647-1653 (pending retain), 1667-1671 (parked, before finish_cancelled), 1680-1690 (active slot), 1735-1740 (readmit). - New
ModelRuntime::generate_for_output(prompts, observation) -> Vec<Generation>(runtime.rs:1145-1151) sets defer_completion=true;generate/generate_manykeep false; removedgenerate_many_observed;generate_observedis now#[cfg(test)](runtime.rs:1131-1134); all funnel throughenqueue_many(..., defer_completion)` (runtime.rs:1153-1158). - http.rs: submission collapsed to
state.model.generate_for_output(prompts, observation)where observation =(continuous_usage || (token_ids && size==1)).then_some(observation.timestamps)(http.rs:328-334).fail_output()+decoders[i].abort(ExecutionError)added on every Delivery::Failed exit: first-token wait (http.rs:402-410), echo apply error (426-434), zero-token finish error (445-450 — note: this one only aborts the decoder, no fail_output call because those generations are None for zero-token choices), event-loop Err arm (582-590). OnGenerationEvent::Finishedthe taken generation is settledcomplete_output()on Ok /fail_output()on Err (http.rs:561-566). - decisions/mod.rs
score()now usesgenerate_for_output(vec![prompt], None)and settles complete/fail on every exit (decisions/mod.rs:838-886). - Tests: 2 unit tests in runtime.rs tests module (
outcome_terminal_budget_overflow_and_deferred_drop_orderings,outcome_concurrent_worker_and_consumer_transitions_record_exactly_one_metric— 2-thread Barrier, 128 iterations × 3×3 pairs × 2 defer modes, asserts exactly one counter increment) plus 4 new tokio integration tests appended to helios/src/server/runtime/phase_tests.rs:8437-9020 (tool-call parse failure streams on chat/messages/responses; output failure after worker completion streaming+non-streaming+incomplete-at-EOS; client disconnect counted cancelled on 4 routes; normal completion across 4 routes × stream on/off and multi-choice n=2 failure/cancel accounting).
#2 [high] Why: issue #679 (filed same day) is the filed report this fixes
Issue #679 "Output-layer stream failures (tool-call parse rejection) are counted as cancellations; requests_failed_total stays 0", opened by ktsaou 2026-12-02 11:31, labels area:api, bug, priority:P2, triage:investigate, no discussion yet. PR #692 opened the same day and declares "Fixes #679" (read_item 679 shows #692 in "Referred to by" as fixes).
Evidence in the issue: engine main at a3c80e19 + two unrelated local patches, Qwen3.8-Flash-Next gb202 TP2, streaming Chat Completions with ChatML tool calls. Two server_error journal lines ("tool parameter names must be nonempty and unique", stage=stream) at 09:00:39 and 09:43:50; counters over the same period: completed 9046, cancelled 2, failed 0, with each cancelled increment 1 s after a journal line. An earlier occurrence on 2bdc8472 was a Responses stream ending "tool function requires parameter or closing tag".
Issue's code trace at a3c80e19: chatml.rs:136 rejects empty/duplicate parameter name → server/output.rs:359-364 aborts with Termination::ExecutionError → http.rs stream arm yields Delivery::Failed and drops receiver → runtime emit() sees TrySendError::Closed and sets cancelled (runtime.rs:387-388 at that revision) → counted at metrics.cancelled.fetch_add (runtime.rs:1402/1423/1442/1493) → metrics.failed only incremented in finish_error (runtime.rs:357).
The issue explicitly says "Failing the request is the right behaviour, and this issue does not ask to change it. The bug is only the outcome accounting." It asks only that output-rejected failures not appear as cancellations.
Related cited in the issue: #133 (closed, GLM sibling symptom, report-only), #548 (open; its review notes the parallel-tool-limit path where runtime says cancelled but HTTP completes), and #549 (unrelated local patch).
docs/api.md:330 documents completed = "Requests whose generation completed successfully"; docs/api.md:332 documents failed = "Requests failed by admission, execution, grammar, or output processing"; helios/src/server/metrics.rs:1093 HELP string says the same for requests_failed_total, and metrics.rs:1078 says completed_total = "Requests whose model generation completed successfully, including explicit token stops"; metrics.rs:1088 cancelled = "Queued or active model requests cancelled before completion." So the code was already documented as intending failed for output-processing failures.
#3 [high] Research summary
Summary of the case file for PR #692
The change (verified against the diff). PR #692 (jcartu, head 348c06c, base main, branched at c513e46, "ready for review", 4 files +1068/−32, no reviews, no CI checks on the head commit) adds a shared RequestOutcome state machine to helios/src/server/runtime.rs:109-296 — an Arc<AtomicU8> shared by Incoming (worker) and Generation (consumer) with states PENDING/GENERATED/READER_DROPPED/COMPLETED/CANCELLED/FAILED, where every transition CASes into an absorbing terminal state so exactly one of metrics.{completed,cancelled,failed} increments once per request. Completion moves out of the worker's stop path: two metrics.completed.fetch_add + emit(Finished) sites become Incoming::emit_finished() (runtime.rs:553-582), which reserves a channel slot with try_reserve() first and fails the request (rather than completing it) on Full. All four worker cancellation sites now call record_cancelled() instead of touching the counter directly (runtime.rs:1647-1653, 1667-1671, 1680-1690, 1735-1740). finish_error records FAILED before notifying admission/first-token/event channels (runtime.rs:583-595). A new deferring entry point ModelRuntime::generate_for_output (runtime.rs:1145-1151) parks worker completion in GENERATED until the consumer calls Generation::complete_output() (:348) or fail_output() (:352, record-FAILED-then-cancel), or drops the Generation (Drop → on_reader_drop, :378-383). HTTP submission collapses to a single generate_for_output call (http.rs:328-334, removing the generate_many_observed/generate_observed branches; generate_observed is now #[cfg(test)]), and fail_output() + decoders[i].abort(ExecutionError) are added on every Delivery::Failed exit (http.rs:402-410, 426-434, 445-450, 582-590), with complete_output()/fail_output() settling the taken generation on Finished (http.rs:561-566). Decision scoring switches to the same entry point and settles on every exit (decisions/mod.rs:838-886). Tests: two unit tests in runtime.rs (terminal budget overflow / deferred drop orderings, and a 2-thread Barrier test asserting exactly one counter increment across all worker×consumer pairs and both defer modes) plus four HTTP-to-Worker integration tests appended at phase_tests.rs:8437-9020 (ChatML duplicate-parameter rejections on chat/messages/responses; mid-stream and at-EOS failures after worker completion, streaming and buffered; genuine client disconnects on four routes; normal completions across four routes × stream and a n=2 failure/sibling-cancel case).
What the description does not say, and vice versa. The description does not mention that generate_observed loses its non-test visibility, that the observation plumbing in http.rs is re-expressed via .then_some(...), or that the decisions score() path is also converted and its mid-loop ok_or_else replaced by explicit fail_output() branches. Conversely, the description's claim that worker fail-then-cancel double counting is fixed matches the code: emit_finished/emit's Full arms still set cancelled, but record_cancelled can no longer reach an absorbing FAILED. The description does not say that docs/api.md/metrics.rs HELP text is left unchanged — but that text already promised exactly this behaviour (docs/api.md:332, helios/src/server/metrics.rs:1079,1088,1093), which supports the "no doc change needed" choice.
Why. Issue #679 (ktsaou, 2026-12-02 11:31, labels area:api/bug/priority:P2/triage:investigate, zero comments) is the operator report: two server_error frames from the ChatML parser tracked by two 1-second-later cancelled increments with failed at 0, at main a3c80e19. It explicitly says failing is correct and only the accounting is wrong, and it points at the same call chain the PR edits. #679 also cites #133 (closed; GLM sibling parser rejections, which turned out to be prepared-graph corruption fixed by #129 — so #133 is not the same defect as #679, despite the issue linking it) and #548.
Related work. Overlapping files: #548 and #560 (open, WynnD) both rewrite the same completion/cancellation accounting in runtime.rs — #548's review by lukealonso already flagged the parallel-tool-limit path where "runtime metrics count the request as cancelled rather than completed, despite the successful API response" (documented at docs/api.md:700-702), which #692 changes behaviour around without editing that doc; #560 stacks on #548 and touches the same GenerationEvent::Finished sites. #691 (same author, same day) changes the first_token oneshot payload to Result<u64> on the same Incoming/Generation structs #692 just extended with outcome — a likely textual conflict. #689 (same author) also touches http.rs+phase_tests.rs. #562/#552 (closed) and #560 are earlier attempts at the same metrics area. The ResponseLifecycle conformance harness in response_lifecycle_tests.rs drives generate_many/emit/cancel directly, which is why the PR keeps direct completion semantics for generate_many.
Evidence. The PR reports 1,884 helios tests passing, 254 flare, 245 flare-cli, and a full verification/helios-lifecycle/check.py (not opened) --mutations run (365,508 transitions against ResponseLifecycle.tla, 26 Rust guard mutations detected). None of that is verifiable from here — CI reports no checks on 348c06c. The lifecycle conformance is significant because docs/design-review.md (Layer 3, per lukealonso's review on #548) makes it mandatory for changes to worker admission/completion/publish/park paths, which this PR rewrites; the description names the run, and the accounting change is not reflected in any new TLA+ or conformance action. Not run: GPU-gated tests and live serving.
Project fit and reach. Charter line 9 ("solve the right problem in the right place") and the "bring real evidence / root cause" rule fit: this is a metric-attribution defect with an operator repro. Reach: /metrics consumers only (no request/response wire change, no config, no defaults). Behaviour that does change: mid-stream output failures now log failed not cancelled; deferred (HTTP/decisions) requests whose reader drops after the worker finished but before validation now count cancelled where they previously counted completed; a parallel_tool_calls: false cancellation still counts cancelled while the API returns 200, contradicting docs/api.md:700-702's wording only if the drop lands in GENERATED. tests/server/test_protocols.py:676 (cancel-count assertion) and tests/server/test_decisions.py:230-261 (decision-disconnect cancels) are the Python integration checks whose expectations this shift most directly depends on; they were not run in the stated evidence.
Process/community. Opened today, ready for review, no reviews, no comments, no CI, no labels; a third of a same-day batch from jcartu (#687-#693). Nothing has engaged with it yet. All detailed findings are in the scratchpad (entries 1-2 are the verified change map and the #679/why/documented-contract note).
#4 [high] Related work: overlapping PRs on the same completion/cancellation accounting
Overlapping open/closed PRs (related_items on 692 returned these as same-file changes; all verified via read_item/search):
- #548 (open, WynnD) "Add per-request histograms and vLLM-parity request metrics", +1383/-124, same 3 files (http.rs, runtime.rs, phase_tests.rs). Its history matters: lukealonso's 2026-11-28 review and Autobot's 2026-11-26 review both flagged exactly the split #692 now fixes — "On the parallel-tool-limit path (http.rs:471-476, :526, :563-567) the terminal event still reaches Delivery::Complete (:598) while the runtime only bumps cancelled/finish_cancelled (runtime.rs:293-302, :1317/:1338/:1360/:1407)". So the "runtime says cancelled, HTTP says success" divergence was already known in #548's review thread; #692 changes the accounting machinery #548 builds on. #548 cannot merge before or after #692 without rebasing (both rewrite
metrics.completed/cancelledsites andGenerationEvent::Finishedemission). - #560 (open, WynnD) "Emit vLLM-compatible per-request metrics from runtime instants", +2185/-163, explicitly stacked on #548 ("Depends on #548", "the branch stacks all of #548"). It adds
RequestTimestoGenerationEvent::Finished— the same event #692'semit_finishedconstructs — and touches runtime.rs/http.rs/phase_tests.rs. Rebase conflict likely; no supersede either way. - #691 (open, jcartu, same author, opened same day) "helios/server: report reused prompt tokens in continuous_usage_stats chunks", fixes #448. Changes the
first_tokenoneshot channel fromResult<()>toResult<u64>on the veryIncoming/Generationstructs #692 extended with theoutcomefield, and addsIncoming::observe_token_with/Generation::has_pending_first_token. Direct textual conflict; #692 also touches the samewait_for_first_tokencall site in http.rs (402-410). Note #692 callsgeneration.fail_output()there beforelet frame = encoder.failure(&error). - #689 (open, jcartu) typed error codes on HTTP preparation failures — same http.rs/phase_tests.rs area, no accounting overlap.
- #562 and #552 (closed, WynnD) earlier per-request-timing attempts superseded by #560/#548.
- #111 (closed) older metrics PR touching the same 4 files.
- #541 (open, jere357) Prometheus/Grafana example; its Autobot review notes the dashboard plots only completed and failed, not
flare_requests_cancelled_total— relevant to why mis-attributed cancellations are invisible on the shipped dashboard.
Why #133 is not the same bug: #679 links #133 (GLM argument-tag rejections, report-only) as a sibling, but #133's close-out (eduffd, 2026-10-28/11-05, closed 2026-11-08) traced those rejections to prepared-graph storage lowering, fixed by merged #129 and by re-exporting the package; original-el8's close-out explicitly says "Malformed tool calls from otherwise valid model output remain a separate parser/API concern." So #679/#692 is the accounting defect for genuinely malformed output, not the #133 graph defect.
#5 [high] Claims and evidence: what #692 asserts and what actually backs it
Claimed: helios --release --features runtime-core,server 1,884 passed / 0 failed / 84 ignored (lib 1,822 passed/47 ignored; 14 integration binaries 62 passed/37 ignored); flare 254 passed/4 ignored; flare-cli 245 passed/3 ignored; verification/helios-lifecycle/check.py --mutations exit 0 with all 8 TLA+ models, 365,508 Rust transitions against ResponseLifecycle.tla (states=65989 edges=365508 depth=10), 13 TLA+ mutations, 26 Rust guard mutations and 1 observed-edge safety violation (DispatchRing SlotReuseSafe) detected. All run on Linux CPU with chat templates from tests/frontend/prepare_templates.py via FLARE_TEST_TEMPLATE_DIR and a 512 MiB locked-memory limit (they say parallel Engram staging tests exceed 64 MiB when all unit tests run concurrently).
What backs it: nothing verifiable from the repository — CI on head 348c06c reports no checks (orientation packet). The counts are self-reported; the test code they point at does exist and is substantial (2 unit tests incl. the 2-thread Barrier exactly-one-counter test; 4 tokio HTTP↔Worker integration tests at phase_tests.rs:8437-9020). No benchmark/performance claims are made, so the charter's benchmark rule does not bite.
Why the TLA+ run matters: lukealonso's #548 blocker #1 cites docs/design-review.md Layer 3 requiring verification/helios-lifecycle/check.py plus --release tests whenever Worker admission/completion/publish/park paths or RequestScheduler::admit_planned_with_checkpoint_accounting change; #692 rewrites completion/cancellation inside the worker, so that gate applies. The PR reports the run but adds no new TLA+ action or conformance transition for the outcome state machine — the ResponseLifecycle harness (helios/src/server/runtime/response_lifecycle_tests.rs:100-195) drives generate_many/emit/cancel/fail directly and therefore only exercises the non-deferred (defer_completion=false) half of the new state machine.
Not run, disclosed: 84 ignored helios / 4 flare / 3 flare-cli checkpoint- and GPU-gated tests, live GPU serving via flare run, Kani harnesses (description says no completion-vector/state-view validators were touched). Not disclosed as unrun: the Python tests/server/*.py integration suites (e.g. tests/server/test_protocols.py:676 asserting cancelled increases on n=4 disconnect; tests/server/test_decisions.py:230-261 asserting decision disconnects increment cancelled; tests/server/test_deepseek41.py:78-79 and tests/server/test_scheduler.py:176-177 asserting failed stays flat while completed rises), which are the closest existing coverage of the counters whose semantics this changes.
#7 [high] Amendments after 7f298698 + Autobot review round (2026-12-02 22:18)
AMENDMENTS to report #6 (case file PR #692). Everything else in #1-#6 stands.
-
Head/shape changed: head 348c06c -> 7f2986984e2898f39c97d9ce9ccac8c7db459027 (
7f298698, "helios: count output-layer stream failures under requests_failed_total"), now 7 files, +968/-46 (was 4 files +1068/-32). New files in the PR:helios/src/server/metrics.rs(+3/-3),docs/api.md(+9/-2),helios/src/server/runtime/response_lifecycle_tests.rs(+2/-2); runtime.rs +362/-22, phase_tests.rs +552/0, http.rs +20/-9, decisions/mod.rs +20/-8. Labels nowarea:api, bug, priority:P2, triage:review(was none in my report). PR body (read_item #34) now carries the four charter sections and documents the metrics/docs work. -
My "no doc change is required" finding is superseded. Docs + HELP text were changed in 7f298698:
- docs/api.md:330
completed= "Served HTTP and Decisions requests whose generation and output validation completed successfully; direct in-processModelRuntime::generate*callers count model-generation completion". - docs/api.md:332
failednow names "output-decoding rejections and terminal event-budget overflow". - docs/api.md:349-354 is a NEW paragraph that documents
flare_requests_cancelled_totalfor the first time, including "unread" served requests and the at-most-one-of-three invariant. This closes an operator-facing gap:cancelledhad no prose definition before. - metrics.rs HELP:
requests_completed_totalmetrics.rs:1077-1079,requests_cancelled_total:1087-1089;Snapshot::completeddoc metrics.rs:91. requests_failed_totalHELP (metrics.rs:1092-1094) was deliberately NOT expanded; only docs/api.md:332 carries the output-decoding/event-budget detail — an asymmetry a reviewer can drop.
- docs/api.md:330
-
docs/api.mdline drift: the parallel-tool-limit note I cited at :700-702 is now :706-709, and still reads "runtime metrics count the request as cancelled rather than completed, despite the successful API response". So my open question #4 is unchanged by the doc commit (not fixed, not made wrong). docs/api.md:697-700 (:703 now) still say the response "completes normally"/"This applies to buffered and streamed requests". -
ResponseLifecycle harness now exercises the production terminal entry point —
response_lifecycle_tests.rs:155(observed-edge harness action 3) and:372(terminal_stream_frames_retain_http_admission test) callemit_finished(...)instead of raw.emit(Finished{..}). This partially answers open question #1 and the review's "Should fix #2". BUT the harness still admits viagenerate_many(:122), i.e.defer_completion=false, so the deferred GENERATED->COMPLETED/CANCELLED half — the half the PR exists for — still has no TLA+/observed-edge coverage.docs/design-review.md:241-246("keep formal bounds aligned… additional lifecycle transitions") remains the gap. -
An Autobot review ran 2026-12-02 21:50 (PR comment): Changes Requested, 0 blockers, 2 should-fix, 2 subtract/simplify, 3 nits; it found the fix "technically sound… no correctness or concurrency blockers". Independently confirms:
RequestOutcome:109-296;emit_finished:553-582 (pre-refactor numbering; now runtime.rs:465-492);generate_for_output; decoder abort idempotent athelios/src/server/output.rs:384-396; four worker cancellation sites :1650/:1670/:1683/:1738 (now :1563/:1583/:1595/:1650-1652). Author's 22:18 reply claims all items fixed: singletransition()helper (runtime.rs:138-156), sharedevent_budget_exceeded(runtime.rs:493-501) used by bothemit_finished(:488-490) andemit(:545-547),record_cancelledfolded intoIncoming::finish_cancelled(runtime.rs:434-435), 7 polling loops collapsed intowait_for_admitted(phase_tests.rs:8632), and a comment on theClosedarm (runtime.rs:482-487). All verified in the head files I re-read. -
Test evidence still self-reported and unverified: same counts (helios 1,884/84 ignored; flare 254/4; flare-cli 245/3; check.py --mutations 40 mutations, 365,508 ResponseLifecycle transitions) re-stated for 7f298698, but the numbers are byte-identical to the pre-fix run, and no CI has run on the new head either (the review's "no CI on 348c06c" is now stale by one commit). Post-change test line numbers: new integration tests phase_tests.rs:8647, :8707, :8775, :8808 with helpers :8441-8645; unit tests runtime.rs:4383 (
outcome_terminal_budget_overflow_and_deferred_drop_orderings) and :4486 (outcome_concurrent_worker_and_consumer_transitions_record_exactly_one_metric). The lifecycle gate is real:.github/workflows/helios-lifecycle.yml:33-34runs check.py on every PR touching helios/**, so the claim will be CI-checked — but that workflow runs check.py WITHOUT--mutations(:34), so the 40-mutation claim is not covered by CI. Rust gating tests:.github/workflows/native-serving.yml:56-63(Linux, helios runtime-core,server, FLARE_TEST_TEMPLATE_DIR) and :64-68 (Windows) — the author's run used 512 MiB memlock where CI uses 64 MiB (prlimit … memlock=67108864), a divergence worth flagging. -
Python counter suites I flagged as unrun are GPU/service-gated, which softens (not removes) that gap:
tests/server/test_protocols.py:22-24andtests/server/test_decisions.py:16-18bothpytest.mark.skipif(not os.environ.get("FLARE_API_TEST_URL")), sopython-cpu.yml:33(pytest tests/ -q, CUDA_VISIBLE_DEVICES="") skips them. The assertions still encode old semantics: test_protocols.py:676 (n=4 disconnect -> cancelled rises) and test_decisions.py:230/257 (decision disconnect -> cancelled rises). The decisions one is the more at-risk:score()now always settles via fail_output on a droppedGeneration, so a cancelled child still lands incancelledonly throughon_reader_dropPENDING->READER_DROPPED -> record_cancelled; that path is preserved, so my concern is narrower than first stated: no test change is strictly needed, but nothing exercises it.
#8 [high] Research summary
Amendments are saved as scratchpad entry #7 and should be appended to report #6 ("Report of 2026-12-02, run 3064"); the rest of #1–#6 stands.
What changed: the PR moved to head 7f298698 and grew from 4 files (+1068/−32) to 7 files (+968/−46) — it now also touches helios/src/server/metrics.rs, docs/api.md and helios/src/server/runtime/response_lifecycle_tests.rs, and it acquired labels (area:api, bug, priority:P2, triage:review) plus a full four-section body. My earlier "no doc change is required" finding is superseded: docs/api.md:330/:332 were rewritten, and docs/api.md:349-354 is a new paragraph that documents flare_requests_cancelled_total, including unread served requests and the at-most-one-of-three-counter invariant; metric HELP strings at metrics.rs:1077-1089 were updated to match, though requests_failed_total HELP was left alone. The parallel-tool-limit note I cited at :700-702 has drifted to :706-709 and is unchanged in substance, so that open question stands.
Process: an Autobot review (21:50) returned Changes Requested with 0 blockers and found the state machine technically sound; the author replied at 22:18 claiming every item fixed, and I verified each fix in the head files (single transition() helper, shared event_budget_exceeded, record_cancelled folded into finish_cancelled, wait_for_admitted helper, Closed-arm comment). The ResponseLifecycle harness now routes terminal emission through emit_finished (response_lifecycle_tests.rs:155, :372), which closes half of my conformance gap — but it still admits via generate_many (:122), so the deferred GENERATED half remains unmodelled under docs/design-review.md:241-246.
Evidence: the re-verification numbers are byte-identical to the pre-fix run and no CI has run on the new head, so it is still self-reported. I also established that .github/workflows/helios-lifecycle.yml:34 (not opened) runs check.py without --mutations (so the 40-mutation claim is not CI-covered), that gating Rust tests run at 64 MiB memlock (native-serving.yml:56-68) while the author ran at 512 MiB, and that the Python suites I flagged as unrun are FLARE_API_TEST_URL-gated (test_protocols.py:22-24, test_decisions.py:16-18) and therefore skipped by python-cpu.yml — which narrows rather than removes that gap.
#9 [high] Verified head line numbers for 7f298698 (file map for the report)
Line numbers verified by reading files at PR head 7f298698 (supersede the pre-fix numbers in entries #1/#3/#6). Files are 7 total, +968/-46.
runtime.rs
- RequestOutcome struct: :116-127 (:116-118 doc comment "Each request increments at most one of completed, cancelled, or failed without decrementing counters"); states :109-114.
- Single CAS helper
transition:138-156 (post-refactor, replaces the five loops the review asked to collapse);record_generated:158-168;record_completed:170-177;record_cancelled:179-186;record_failed:188-195;on_reader_drop:197-206 (GENERATED -> CANCELLED, comment at :200-202). Generation.outcomefield :219;complete_output():259-261;fail_output():263-268 (record_failed then cancel, comment :264-265);wait_for_first_token:270-274;Drop for Generation:289-294.Incoming.outcome:306;finish_cancellednow doesrecord_cancelled()first :434-443;record_cancelled():462-464;emit_finished:465-492 (suppress-if-failure :466-473,try_reserve:474, Ok arm records then sends :475-481,Closedarm :482-487 with the new direct-vs-deferred comment,Full->event_budget_exceeded:488-490);event_budget_exceeded:493-501 (shared byemittoo, :545-547);finish_errorrecords FAILED at :508 before notifying admission/first-token/event (:509-513).- Entry points:
generate:1040-1042;generate_observed#[cfg(test)]:1044-1047;enqueue:1049-1052;generate_many:1054-1056;generate_for_output:1058-1064 (defer_completion=true);enqueue_many:1066-1170 withRequestOutcome::new(..., defer_completion):1119 and the counter-free group send :1160-1170. - Worker cancellation sites now: :1563 (pending retain), :1583 (parked -> finish_cancelled), :1595 (active), :1648-1654 (admit loop; direct
record_cancelled()at :1652 when not parked). - Terminal emissions through
emit_finished: :2209 and :2506 (weremetrics.completed.fetch_add+emit). - Unit tests:
outcome_terminal_budget_overflow_and_deferred_drop_orderings:4383-4484;outcome_concurrent_worker_and_consumer_transitions_record_exactly_one_metric:4486-4560 (2-thread Barrier, 3x3 ops x 2 defer modes x 128 iters, asserts sum==1 and specific tuples at :4535-4555); pre-existingdisconnected_output_cancels_without_reporting_an_execution_failure:4564.
http.rs
- Submission: :328-338 (
generate_for_output(prompts, observation)where observation =(continuous_usage || (observation.token_ids && size == 1)).then_some(observation.timestamps); admission rejection at :335-338).zerochoices are excluded from the enqueue set at :305-316 (max_new_tokens == 0 && !prompt_logprobs), so zero-token slots havegenerations[i] == Noneby construction. - Failure exits: first-token wait :402-410 (abort + fail_output + Delivery::Failed); echo apply :426-434 (abort + fail_output); zero-token finish :445-450 (only
decoders[i].abort, nofail_output— correct, because those i are inzeroand never held a Generation; worth stating explicitly so a reviewer does not read it as a missed settlement); Finished settlement :561-566 (take()then complete_output/fail_output byresult); tool-limit cancel :571-575; event-loopErrarm :582-590 (abort + fail_output). Stream vs buffered delivery: :612-635 (stream, log_failure "stream" :622) and :636-659 (buffered,rejection(... "generation" ...):650). - tool_limit_reached touches: encode.rs:145/205/526/574/666/672 (encoder side) — the only place the response still says "cancelled" while the API succeeds.
decisions/mod.rs
score():830-893;generate_for_output(vec![prompt], None):838-841; channel close -> fail_output :844-847; logprob/probabilities failure :850-856; Finished settlement: fail on token-count mismatch :864-870,complete_output():871; AdmissionRejected/Error :878-881; catch-all_-> fail_output :882-888.
metrics.rs
pub cancelled:230;Snapshot::completeddoc :91 (long one-liner, "Served HTTP and Decisions requests ... plus directModelRuntime::generate*..."); HELPrequests_completed_total:1076-1080,requests_cancelled_total:1086-1090,requests_failed_total:1091-1095 (unchanged text — no output-processing detail, unlike docs/api.md:332).
docs/api.md
completedrow :330;failedrow :332; new cancelled paragraph :349-354; parallel-tool-limit paragraph :695-712 with the "counted cancelled rather than completed" sentence at :706-709.
response_lifecycle_tests.rs
- Harness admits via
runtime.generate_many(...):120-141 (defer_completion=false); action 3 terminal emissionemit_finished:152-164; action 7 failureproducer.fail:176-184; observed-edge dump :321-328;terminal_stream_frames_retain_http_admission_after_native_retirementusesemit_finished:372-379.
phase_tests.rs
- Helpers:
text_http_fixture:8441-8453,chatml_tool_fixture:8455-8465,worker_for_http_state:8467-8500ish,emit_worker_tokens,tool_request_body,plain_request_body,send_http_generate,wait_for_admitted:8632-8645 (the collapsed 5s-timeout poller). - Tests:
output_stream_tool_call_parse_failure_counts_as_failed_not_cancelled:8647-8705;output_failure_after_worker_completion_counts_as_failed_without_double_counting:8707-8773;http_client_disconnect_without_output_error_still_counts_as_cancelled:8775-8806;http_normal_completion_and_multichoice_output_failure_accounting:8808-8988, whose last sub-case (:8956-8987) is the strongest claim in the PR: worker finished and retired the slot (GENERATED), HTTP drops the unread SSE body, and the request counts cancelled, not completed.
CI/gates (verified in workflow files)
.github/workflows/helios-lifecycle.yml:33-34:python3 verification/helios-lifecycle/check.py --tlc-jar "$RUNNER_TEMP/tla2tools.jar"— no--mutations, so the author's 40-mutation result is not reproducible by CI. Triggered on PRs touching helios/, selene/, eos/, verification/helios-lifecycle/..github/workflows/native-serving.yml:56-63Linux heliosruntime-core,serverwithFLARE_TEST_TEMPLATE_DIRandprlimit --memlock=67108864:67108864; :64-68 Windows; :69-73 flare-cli; :74-77 flare. Author ran at 512 MiB memlock..github/workflows/python-cpu.yml:30-33:pytest tests/ -qwith CUDA_VISIBLE_DEVICES="" — the FLARE_API_TEST_URL-gated server suites (test_protocols.py:22-24, test_decisions.py:16-18) are skipped, so no CI gates the counter expectations at test_protocols.py:676 and test_decisions.py:230/257.