Opened by a workflow run, Dec 2, 2026 4:06 PM EST. decide malicious: all_clear (100%): No malicious content found
explore
Author: jcartu (Joshua Cartu, GitHub association CONTRIBUTOR; 3 merged / 3 closed / 10 open PRs in 180 days, merged helios/src work includes #418, #416, FP32 parameter binding; Discord: jcartu)
Motivation: Requests rejected during preparation (over-long context, unsupported feature, bad grammar, bad image) returned the generic code: "invalid_request_error" even though the server already knows a specific code for each, because preparation errors were flattened to (status, message) and re-rendered through Protocol::error. This PR keeps the typed error across the spawn_blocking boundary and renders it through the same Protocol::failure path already used after admission, fixing issue #446.
Scale: +442 / −23 lines in 2 files (helios/src/server/http.rs, helios/src/server/runtime/phase_tests.rs)
Proposal:
- New private
PreparationError { Http(StatusCode, String), Failure(Error) }andpreparation_error(Error)at http.rs:119-132: Admission errors pass through,FrontendError::ImageDecodebecomesAdmissionError::Image, everything else becomes HTTP 400. failure_responseextracted fromrejection(http.rs:26-41) so typed preparation failures getProtocol::failure+rejection_detailshints but nox-request-idand no stderr failure log.http::generateroutesprotocol::decode,compile_text,generation_count,compile_strict_validators,prepare_validated_inferencethroughpreparation_error(http.rs:209-291);decode_body, oversized groups and 429 admission stay untyped.- Unit test at http.rs:739-786 and a 355-line wire test at phase_tests.rs:8438-8792 covering five routes, streamed and buffered, with
param: nulland zero model-queue admissions asserted. Touches: - helios/src/server/http.rs (request path and error rendering for every generation route)
- helios/src/server/runtime/phase_tests.rs (new end-to-end HTTP wire test) Related items:
- #446 Request-preparation failures render the generic
invalid_request_errorcode (open): the bug this fixes, confirmed by yatesdr - #692 helios: count output-layer stream failures under requests_failed_total (open): same author/day/files, disjoint failure-accounting concern
- #691 helios/server: report reused prompt tokens in continuous_usage_stats chunks (open): same author/day/files, disjoint concern
- #638 Echo Responses tools and text.format and decode tool output is_error (merged): added the neighbouring http.rs test and docs text for a wire change
- #418 Add strict function-tool schemas for DSML, Qwen, GLM and TML parsers (merged): origin of the now-typed
compile_strict_validatorspath Link: https://github.com/NVIDIA/hyperflare-inference/pull/689 Autobot comments: No CI run exists on head 2f72e1b and no review has happened, so all reported test totals are unverified, and the same author's same-day PRs report slightly different helios totals. Two behaviours are not in the description: explicitAdmissionError::Invalidnow returns"code": "invalid_request"(a client-visible string change beyond #446's four codes), andFrontendErrorvariants other thanImageDecode(Asset/Template/Tokenizer/Input) still flatten toinvalid_request_error, diverging fromrequest::prepare(request.rs:35) which types theminvalid_request. No docs are touched, so docs/api.md:250-251 still presents 400s asinvalid_request_error; status codes do not change anywhere (all reachable preparation admission variants map to 400).
Value Proposition
Value Proposition — PR #689, "helios/server: preserve typed error codes on HTTP request preparation failures"
Charter alignment — strong. #689 makes the ingress preparation path obey an already-documented contract: docs/core-design.md:1115-1119 states pre-header failures use the corresponding HTTP status and that "Chat and completion errors include type, message, param, and a typed code". It does so at the shared rendering layer — private helpers in a single file (failure_response, PreparationError, preparation_error), no per-model branches, no new flags, aliases, defaults, config or dependencies, so none of the charter's "keep the runtime small / no magic defaults" rules are brushed. It also closes the last straggler: the decisions endpoints already rendered Protocol::failure from inside spawn_blocking. The description carries the charter's four required parts plus disclosed limitations, and the fix targets the root cause (rendering through the untyped http::error path) rather than swallowing the error.
Novelty & status — additive. Not obsolete: no commit on main since the branch point (c513e46) touches http.rs or phase_tests.rs. Not superseded: related_items yields only issue #446, and no other open or closed PR modifies the error-rendering helpers. Neighbours #691/#692 touch the same generate preamble but are complementary in intent (textual conflicts only). The problem is independently confirmed by yatesdr, an area owner with 49 commits in helios/src — the strongest external signal in the dossier, though the issue is only ~11 days old with one comment and no reactions.
Value vs maintenance cost. Cost is low: +442/−23 across two files, no public Rust API change, and because every reachable preparation admission variant already maps to HTTP 400 (server.rs:733-741), no status code or client retry behaviour moves. Only error.code changes on OpenAI-shaped routes; /v1/messages and /v1/messages/count_tokens envelopes are unchanged. The new tests are CPU/axum-level, and .github/workflows/native-serving.yml runs exactly that helios test invocation, so the branch-local-only totals become reproducible on merge. Benefit is narrow but legitimate: SDK clients that branch on code get the documented strings. No prompt-injection or instruction-directing content was found in the reviewed material.
What must change before merge:
- Scope creep, undeclared wire change.
AdmissionError::Invalidnow renders"invalid_request"instead of"invalid_request_error"— a fifth, broader class of 400s (badstop, bad sampling params) that #446 does not request. Drop it or justify it explicitly; it is the one edit that changes behaviour for ordinary client mistakes. - Undeclared asymmetry. Only
FrontendError::ImageDecodeis typed;Asset/Template/Tokenizer/Inputstill flatten toinvalid_request_error, whilerequest::preparetypes themInvalid. State which contract is intended. - Docs parity. docs/api.md:248-259 lists only
invalid_request_error; sibling PR #638 set the precedent of documenting its own wire change.
Verdict: Worth it with changes.
Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.
Classify intake
Selected: triage:review, bug, area:api
Threshold: 65%
Triage
- [✓]
triage:review: 99.9% -
triage:design-review: 0.1% -
none: 0.0% -
triage:investigate: 0.0% -
triage:validation: 0.0% -
triage:integration: 0.0% -
triage:partial: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
-
none: 58.8% -
priority:P2: 35.7% -
priority:P1: 5.5%
Type
- [✓]
bug: 95.3% -
community: 24.5% -
enhancement: 11.9% -
duplicate: 9.5% -
documentation: 0.1% -
performance: 0.0%
Area
- [✓]
area:api: 98.4% -
area:preparation: 16.5% -
area:memory: 0.5% -
area:selene: 0.2% -
area:engram: 0.1% -
area:rocenante: 0.1% -
area:caching: 0.1% -
area:kernels: 0.1% -
area:scheduling: 0.0% -
area:orbit: 0.0% -
area:packaging: 0.0%
Model
-
model:deepseek-v4.1: 1.4% -
model:deepseek-v4: 0.4% -
model:glm-5.3: 0.1% -
model:inkling-small: 0.1% -
model:nemotron-3.5-bolt: 0.1% -
model:qwen3.8-flash-next: 0.1% -
model:gemma4: 0.0% -
model:mimo-v2.6: 0.0% -
model:qwen3.8-27b: 0.0% -
model:kimi-k3.1: 0.0% -
model:muse-glimmer: 0.0%
Apply Labels (Intake)
Applied: +triage:review, +bug, +area:api
Subtraction and simplicity
Subtraction/Simplicity/Conventions review of PR #689.
Verdict: the production change in helios/src/server/http.rs is already lean — failure_response (http.rs:26-31) is an extraction that removes duplication, rejection (http.rs:32-41) collapses to three delegating lines, PreparationError replaces the old rejection_details(…AdmissionError::Invalid) hack, and there are no flags, config knobs, new deps, or dead public API.
Findings:
- phase_tests.rs:8452-8480 hand-rebuilds a full
HttpStateliteral field-for-field instead of mutating the sharedhttp_state_forhelper (defined :4273-4295); the repo pattern is one line, :5086-5087Arc::get_mut(&mut state).unwrap().thinking_token_budget = Some(2);. ThreeArc::get_mutassignments (images,context_hint,max_body_bytes = 4096) remove ~28 lines and stop a copy of every field from rotting as sibling PRs #691/#692 add fields. - Three sections of the new wire test share an identical six-line loop body (phase_tests.rs:8632-8638, 8689-8695, 8711-8717), differing only in the expected code string and one boolean. Folding into one
for (expected_code, with_images, path, payload)table removes ~100 lines and keeps coverage. - http.rs:127-129's
FrontendError::ImageDecodearm cannot fire from the only call path: every image site is already re-typed toAdmissionError::Imageat request.rs:1141, 1194, 1196, 1208, 1230. It is a narrower duplicate of request.rs:30-36 and the exact place to delete theAsset/Template/Tokenizer/Inputasymmetry; drop it plus the unit-test row at http.rs:758-761. - Optional: http.rs:212-213's
.map_err(|(status, message)| PreparationError::Http(status, message))is a hand-writtenFrom; an impl makes itdecode_body(...)?.
Not findings: the failure_response/rejection split correctly keeps log_failure + x-request-id post-submission only; rejection_details is reused, not duplicated; the unit test is good. No structural AGENTS.md violations (no helios/AGENTS.md exists).
Open: whether maintainers prefer deleting the ImageDecode arm or typing all FrontendError variants during preparation; whether the AdmissionError::Invalid → invalid_request delta is in scope; whether docs/api.md:248-259 (not opened) should list the typed 400 codes. No CI on head 2f72e1b, so test totals are unverified.
Correctness and contracts
Reviewed PR #689 (helios/server: preserve typed error codes on HTTP request preparation failures, head 2f72e1b) through the Correctness, Contracts & System-Level Consequences lens. Read the full diff, all of helios/src/server/http.rs at head, the error/status/code plumbing, every preparation callee, both test sites, docs/api.md/docs/core-design.md, issue #446, and the in-repo consumers of error.code.
Verdict: no Blocker. The main path is correct, small, and genuinely tested. Three findings:
A (Major) — code now encodes internal validation layering, and the change exceeds #446's scope. preparation_error (http.rs:124-132) sends every Error::Admission(_) through Protocol::failure, and AdmissionError::Invalid → "invalid_request" (server.rs:751). #446 asks only for the four codes context_length_exceeded/unsupported_feature/invalid_grammar/invalid_image. Result: two adjacent client-input 400s get different codes — "max_tokens": 0 → invalid_request_error (request.rs:615-616, a &str error = ExecutionError::State, pinned by the PR's own test phase_tests.rs:8737-8759) while "stop": [5 strings] → invalid_request (stops.rs:63-72, pinned at phase_tests.rs:8719-8736). Sampling, top_k/seed, token stops and >uint32 output limits are affected the same way. Fix: keep AdmissionError::Invalid on the untyped arm, or type the rest too.
B (Minor) — other => PreparationError::Http(StatusCode::BAD_REQUEST, …) (http.rs:130) hardcodes 400 where status() (server.rs:733-741) says 500 for Error::Execution/Frontend(Asset|Template|Tokenizer|Input); tokenizer failures via frontend.encode (request.rs:178) are blamed on the client. Pre-existing, but makes the description's "status from status(&error)" untrue of this arm.
C (Minor) — docs/api.md:248-259 still documents all these 400s as invalid_request_error; the typed strings appear nowhere under docs/. One sentence needed (#638 precedent); core-design.md:1115-1119 already promised typed codes.
Verified sound: no HTTP status can change (Capacity/Unavailable never arise in preparation); no concurrency, lock, memory, buffering or latency change; x-request-id and failure-log contract preserved; Anthropic envelope untouched; untyped bodies byte-identical. Description's "hints preserved" is a no-op; test totals unverifiable (no CI on head, GPU/Python suites unrun).
Final review
Recommendation: Changes Requested
PR #689 cleanly fixes the core #446 defect by carrying typed Error values across http::generate's spawn_blocking boundary and rendering them through the shared Protocol::failure + rejection_details path without altering x-request-id, failure logging, HTTP status codes, or concurrency/permit lifetimes. Before merging, resolve the wire-level error.code split introduced by routing AdmissionError::Invalid to "invalid_request" while adjacent validation checks on the exact same fields still emit "invalid_request_error", and trim the unreachable FrontendError::ImageDecode branch and duplicated HttpState struct literal in the new test.
Merge Risk
Level: Low
- Changes are strictly confined to
helios/src/server/http.rs(+86/−23) andhelios/src/server/runtime/phase_tests.rs(+356/−0); no model-core, Protobuf, scheduler, prefix-cache, or CUDA-graph code is touched, and no HTTP status codes change (all reachable preparationAdmissionErrorvariants map to HTTP 400 athelios/src/server.rs:733-741). - No concurrency, lock, permit-lifetime, or hot-path overhead regression:
frontend_slots(_permit),ingress_slots(_ingress), andextragroup-permit lifetimes insidespawn_blocking(helios/src/server/http.rs:209-284) are unchanged, andfailure_responseruns post-join on the error path only. - On OpenAI-shaped routes (
/v1/chat/completions,/v1/completions,/v1/responses),error.codechanges from"invalid_request_error"to typed codes (context_length_exceeded,unsupported_feature,invalid_grammar,invalid_image, and currentlyinvalid_request), whileerror.typestays"invalid_request_error",error.paramstaysnull, and Anthropic/v1/messagesenvelopes are unchanged.
Walkthrough
- Shared failure renderer (
helios/src/server/http.rs:26-41): extractsfailure_response(&HttpState, Protocol, Error) -> Responseusingprotocol.failure(&failure)andrejection_details(state, failure)for hint-suffixed messages;rejectiondelegates tofailure_responsewhile keepinglog_failureandwith_request_idpost-submission only (matchingdocs/core-design.md:1119-1121anddocs/api.md:258-259). - Preparation error classifier (
helios/src/server/http.rs:119-132): introduces privatePreparationError::{Http, Failure}andpreparation_error(Error)soError::Admission(_)(andFrontendError::ImageDecode(_)) preserve typed failures while non-admission errors map toPreparationError::Http(StatusCode::BAD_REQUEST, ...). - Generation preparation dispatch (
helios/src/server/http.rs:209-293): routesprotocol::decode,GrammarCompiler::compile_text,Request::generation_count,request::compile_strict_validators, andrequest::prepare_validated_inferencethroughpreparation_error, dispatchingPreparationError::Failuretofailure_responseandPreparationError::Httptohttp::error(keepingdecode_body400/413/415, oversized-group 400, and admission-full 429 onhttp::error). - Tests (
helios/src/server/http.rs:739-786,helios/src/server/runtime/phase_tests.rs:8438-8792): adds a unit test forpreparation_errorand an end-to-endhttp::generatetest covering/v1/chat/completions,/v1/completions,/v1/responses,/v1/messages, and/v1/messages/count_tokens(buffered andstream: true), asserting typederror.code,context_hint, explicitparam: null, Anthropic envelope shape, absentx-request-id, and zero model-queue admissions (receiver.try_recv().is_err()).
Pre-merge Checks
- [PASS] Security / malicious screen: No unsafe code, external I/O, or prompt-injection/instruction-directing content found in the PR description, comments, or diff.
- [PASS] Charter & value fit: Directly addresses maintainer-confirmed bug #446 in Helios's shared HTTP layer with no per-model branches, flags, defaults, or dependencies, and includes the four required PR description sections plus Discord contact.
- [PASS] Related / duplicate / conflict check: No competing or superseding PR; cleanly based after #638 (
cd1daa3e) with no conflicts againstmain(open same-file PRs #691, #692, #548, #560 are disjoint in intent). - [WARN] Tests & verification evidence: Added Rust CPU tests are isolated (per-test
Fixture::with_templatePID/serial temp dirs cleaned up immediately, no global state) and exercise realhttp::generate; scheduler/TLA+/Kani gates do not apply. However, no CI check results are visible on head2f72e1b(only local test counts reported), and live GPU /tests/server/test_protocols.py(not opened) runs were not executed (disclosed) — confirm greenNative servingCI before merge.
Blockers
None.
Should Fix
- Unintended
error.codesplit across ordinary 400 validation errors (helios/src/server/http.rs:124-132,helios/src/server.rs:751,helios/src/server/runtime/phase_tests.rs:8719-8759):- Routing all
Error::Admission(_)variants throughPreparationError::FailurecausesAdmissionError::Invalidto emit"code": "invalid_request"(helios/src/server.rs:751), while sibling validation errors raised viaError::from(&str)(mapped toExecutionError::Stateathelios/src/error.rs:174-183) hit the catch-all arm and emit"code": "invalid_request_error". - This splits adjacent checks on the exact same request fields across two different wire
error.codevalues based solely on internal Rust error construction:max_tokens > u32::MAX(helios/src/server/request.rs:609-614,AdmissionError::Invalid) emits"invalid_request", whilemax_tokens == 0ormax_tokens > i32::MAX(helios/src/server/request.rs:615-617,&str) emits"invalid_request_error".- Bad
temperature/top_p/seed(helios/src/server/request.rs:709-727,helios/src/model.rs:229-256) emit"invalid_request", while non-integertop_k(helios/src/server/request.rs:684,&str) emits"invalid_request_error". stopcombined with structured output (helios/src/server/stops.rs:79-84) emits"invalid_request", whilestop_token_idscombined with structured output (helios/src/server/request.rs:340-342) emits"invalid_request_error".
- Issue #446 and its maintainer confirmation specifically target the four typed preparation codes (
context_length_exceeded,unsupported_feature,invalid_grammar,invalid_image), not splitting general 400 validation errors, andphase_tests.rs:8719-8759currently pins both sides of that accidental split. - Fix (choose one):
- Preferred (minimal, matches #446 scope): Keep
Error::Admission(AdmissionError::Invalid(_))on thePreparationError::Http(StatusCode::BAD_REQUEST, ...)arm inpreparation_error(helios/src/server/http.rs:124-132), so general invalid-request 400s stay uniformly"invalid_request_error"and only specific typed admission errors (Context,Feature,Grammar,Image, plusCapacity/Unavailable) emit distinct codes; updatehttp.rs:762-765andphase_tests.rs:8719-8736accordingly. - Alternative (if
"invalid_request"is desired for preparation 400s): Convert the remainingprepare_validated_inferenceclient-input&strerrors (at minimum the siblingoutput_limit,top_k, and structured-output stop checks) toAdmissionError::Invalidso one error class does not emit two codes.
- Preferred (minimal, matches #446 scope): Keep
- Routing all
Subtract / Simplify
- Delete the unreachable
FrontendError::ImageDecodearm inpreparation_error(helios/src/server/http.rs:127-129,758-761):FrontendError::ImageDecodeis only constructed insideImageProcessordecoding (helios/src/frontend/images/mod.rsandorientation.rs(not opened)). Onhttp::generate's preparation path, the only image-decoding caller isdescribe_images(helios/src/server/request.rs:1120-1233), which already wrapscheck_batch,decode_encoded,describe_image,geometry, andcheck_budgetwith.map_err(|error| error.admission_context(AdmissionError::Image))(request.rs:1141, 1194, 1196, 1208, 1230), andcrate::model::prepare_image_inputs(helios/src/model/prompt.rs:37-141) never decodes image bytes.- Remove the dead
Error::Frontend(crate::FrontendError::ImageDecode(_))match arm athelios/src/server/http.rs:127-129and its synthetic unit-test row athelios/src/server/http.rs:758-761.
- Replace the 21-field hand-rebuilt
HttpStateliteral inphase_tests.rs:8452-8480withArc::get_mutonhttp_state_for:make_statebuildsbase = http_state_for(fixture, sender, None, &[])and then copies all 21 fields ofHttpStatesolely to overrideimages,max_body_bytes, andcontext_hint, duplicatinghttp_state_for(phase_tests.rs:4273-4295) and inviting merge conflicts with any PR adding anHttpStatefield.- Follow the existing pattern at
helios/src/server/runtime/phase_tests.rs:5086-5087: mutatelet mut state = http_state_for(fixture, sender, None, &[]);vialet s = Arc::get_mut(&mut state).unwrap();to set onlymax_body_bytes,context_hint, andimages.
Nits
- Document typed 400
error.codevalues indocs/api.md:248-259:docs/api.md:250-251currently mentions only theerror.typecategory (invalid_request_error) for HTTP 400s and none of the typedcodestrings appear anywhere underdocs/. Adding one short sentence noting the typederror.codevalues returned on Chat Completions, Completions, and Responses (context_length_exceeded,unsupported_feature,invalid_grammar,invalid_image, andinvalid_requestif retained) would aligndocs/api.mdwithdocs/core-design.md:1117-1118.
Dropped on verification
- Upstream claim that
seed(request.rs:724),sampling_number(request.rs:710), andTokenStops::new(stops.rs:22) remain untyped: Dropped those inaccurate citations — verified at2f72e1bthat all three already constructError::admission(AdmissionError::Invalid, ...)and emit"invalid_request". Replaced with the actual verified untyped siblings (request.rs:615-617max_tokens == 0 || > i32::MAX,request.rs:684top_k, andrequest.rs:340-342stop_token_ids+ structured output). - Upstream finding that the catch-all arm (
http.rs:130) hardcodes HTTP 400 wherestatus(&error)says 500 and contradicts the PR description: Dropped — this is pre-existing behavior (changing it tostatus(&error)would turn every&str-based validation 400 into a 500 becauseFrom<&str>producesExecutionError::Stateathelios/src/error.rs:174-183), and the PR description accurately scopesstatus(&error)to typed preparation failures while explicitly stating untyped errors map toPreparationError::Http(StatusCode::BAD_REQUEST, message). - Upstream claim of an undeclared asymmetry with
request::prepareforFrontendError::{Asset,Template,Tokenizer,Input}: Dropped as a separate defect —request::prepare(request.rs:23-37) is an in-process helper unused byhttp::generate, keeping non-admission HTTP preparation errors oninvalid_request_errorpreserves pre-PR behavior, and deleting the unreachableImageDecodearm inpreparation_errorremoves the partial copy cleanly. - Upstream suggestion to collapse three test loops in
phase_tests.rs:8603-8717for "~100 lines" saved: Dropped — the three loop bodies are 6 lines each (8632-8638,8689-8695,8711-8717), saving only ~14 lines while merging three readable per-code sections; the "~100 lines" estimate was inflated. - Upstream suggestion to add
impl From<(StatusCode, String)> for PreparationErrorfordecode_body(http.rs:212-213): Dropped — net positive LOC for a single call site.
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 98.3% -
triage:design-review: 1.0% -
triage:validation: 0.4% -
none: 0.3% -
triage:investigate: 0.0% -
triage:partial: 0.0% -
triage:integration: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Apply labels
No label changes Decision to Test: no (99%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with. decide malicious: all_clear (100%): No malicious content found
explore
Author: jcartu (Joshua Cartu, GitHub association CONTRIBUTOR; not one of the charter's named priority contributors); Discord: jcartu
Motivation: Request-preparation failures (bad grammar, oversized prompt, unsupported feature, bad image) were rendered through a generic error path, so clients always saw code: invalid_request_error even when the engine knew exactly what kind of failure it was. This PR makes those failures render through the same typed error path post-admission failures already use, fixing open bug #446.
Scale: +440 / −26 in 3 files (head 4695d846: http.rs +107/−23, phase_tests.rs +327/−0, docs/api.md +6/−3)
Proposal:
- Extract
failure_response(&HttpState, Protocol, Error)and have the post-submissionrejectiondelegate to it, keepingx-request-idand stderr failure logs post-submission only. - Add private
PreparationError::{Http, Failure}+preparation_errorsoError::Admissionkeeps its typed code while everything else becomes a plain 400. - Route
protocol::decode, grammar compilation,generation_count,compile_strict_validatorsandprepare_validated_inferencethrough it;AdmissionError::Invaliddeliberately staysinvalid_request_error. - New unit test plus a wire test driving all five routes, buffered and streaming, asserting typed
code,param: null, unchanged Messages envelope, absentx-request-id, zero model-queue admissions. - New
docs/api.mdsentence documenting typed 400 codes — which contradicts the sentence above it (amendment finding). Touches: helios/src/server/http.rs(shared error rendering and the wholegeneratepreparation closure)helios/src/server/runtime/phase_tests.rs(large new wire test)docs/api.md(error-shape paragraph) Related items:- #446 Request-preparation failures render the generic
invalid_request_errorcode (open): sole driver, confirmed by yatesdr. - #692 count output-stream failures under requests_failed_total (open): same author/day/file, disjoint concern, textual-conflict risk.
- #691 report cached prompt tokens in usage stats (open): same author/day, also rewrites
http::generate. - #638 Echo Responses tools and text.format (merged): precedent of editing docs/api.md in-PR; added the neighbouring bad-request test.
- #418 strict function-tool schemas (merged, jcartu): source of
compile_strict_validatorsnow routed throughpreparation_error. Link: https://github.com/NVIDIA/hyperflare-inference/pull/689 Autobot comments: Amendments to my earlier report: head4695d846. Two prior findings are fixed, not open —AdmissionError::Invalidnow rendersinvalid_request_erroragain (http.rs:126-128), and the deadFrontendError::ImageDecodearm is deleted (only request.rs:32 references it; decode failures wrapAdmissionError::Image). Scale is now 3 files including docs. The surviving real defect is that the newdocs/api.md:257-261sentence contradictsapi.md:250-251("over-context requests return HTTP 400 (invalid_request_error)") in the same paragraph and never says which 400s keep the generic code. One Autobot Changes-Requested review exists and the author answered all four points at 21:53Z, but there is still no CI and no human review, and the reported test totals are unchanged (1,880/84) despite a commit that adds assertions. Unchanged: no HTTP status codes change, nox-request-idor failure log on preparation failures (matches docs), and preparation rejections still are not counted inflare_requests_failed_total(#692 territory).
Classify intake
Selected: triage:review, bug, area:api
Threshold: 65%
Triage
- [✓]
triage:review: 99.6% -
triage:design-review: 0.2% -
triage:validation: 0.1% -
none: 0.0% -
triage:investigate: 0.0% -
triage:partial: 0.0% -
triage:integration: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
-
none: 58.3% -
priority:P2: 40.1% -
priority:P1: 1.6%
Type
- [✓]
bug: 83.5% -
community: 29.4% -
enhancement: 22.3% -
duplicate: 8.5% -
performance: 0.5% -
documentation: 0.1%
Area
- [✓]
area:api: 99.8% -
area:preparation: 7.6% -
area:scheduling: 0.7% -
area:memory: 0.3% -
area:caching: 0.3% -
area:selene: 0.2% -
area:kernels: 0.1% -
area:engram: 0.1% -
area:orbit: 0.0% -
area:packaging: 0.0% -
area:rocenante: 0.0%
Model
-
model:glm-5.3: 0.5% -
model:qwen3.8-flash-next: 0.5% -
model:kimi-k3.1: 0.2% -
model:gemma4: 0.1% -
model:inkling-small: 0.1% -
model:muse-glimmer: 0.1% -
model:qwen3.8-27b: 0.1% -
model:deepseek-v4.1: 0.0% -
model:nemotron-3.5-bolt: 0.0% -
model:deepseek-v4: 0.0% -
model:mimo-v2.6: 0.0%
Apply Labels (Intake)
No label changes
Subtraction and simplicity
Reviewed PR #689 at head 4695d846 (+440/−26, 3 files) through the Subtraction, Simplicity & Conventions lens. The diff is largely lean and I would not block on it: the failure_response/rejection split is a genuine extraction, PreparationError is load-bearing for the two dispatch modes, the spawn_blocking closure keeps straight ? flow with only five map_err(preparation_error) sites, and no flags, config, fallbacks or dead code are added (the previously flagged FrontendError::ImageDecode arm is gone).
Findings ranked:
- Should-simplify —
preparation_error(helios/src/server/http.rs:124-132) has two arms with byte-identical bodies; collapse to two arms keyed on the typed variants. - Trim — the new unit test (http.rs:739-807) re-asserts the four codes the wire test covers end-to-end, includes
Capacity/Unavailablecases preparation cannot reach (:762-771), and its untyped half (:785-806) only re-testsProtocol::error's existing mapping. - Trim —
send_raw(helios/src/server/runtime/phase_tests.rs:8467-8501) re-implements the build/generate/read helper that already exists ashttp_generation_request_observed(phase_tests.rs:4461-4490). - Docs — the sentence added at docs/api.md:257-261 duplicates and contradicts the "over-context requests return HTTP 400 (
invalid_request_error)" clause at :250-251; fold into one clause. - Nit —
assert_envelope'sexpected_typeparam (phase_tests.rs:8503) is"invalid_request_error"at all 17 call sites.
Caution: server.rs:751's "invalid_request" is still reachable via protocol/decisions/mod.rs:282-292; it is not dead code and must not be proposed for deletion. No AGENTS.md structural violation found (:188-193, :194-199).
Open questions: whether the trim of the unit test is wanted given no CI exists to back the counts; why the reported helios totals did not move after a commit that adds assertions.
Correctness and contracts
PR #689 mechanically fixes #446 correctly, but its new documentation sentence contradicts the paragraph it was added to.
Findings:
- Blocker —
docs/api.md:257-261says typed 400s seterror.codetocontext_length_exceeded, whiledocs/api.md:250-251says "over-context requests return HTTP 400 (invalid_request_error)" — the same class (server.rs:747→protocol/mod.rs:56). The paragraph never names the 400/415 cases that keepinvalid_request_error, so clients cannot derive the rule from the only doc that lists these codes. Fix: split the sentence and enumerate both halves. - Minor — typed preparation failures are now on the wire but absent from the failure metric and stderr log:
failure_response(http.rs:26-31) omitslog_failure/with_request_id(kept inrejection,http.rs:32-41), and onlyhttp_requests[metric]increments (http.rs:160). Not a regression; should be stated or deferred explicitly to same-author #692. - Minor —
preparation_error'sotherarm (http.rs:130) foldsError::FrontendandError::Execution(ExecutionError::State)into a client 400 (error.rs:174-177), matchingmain, but the PR now names this as the intended "untyped bad requests" contract, so internal preparation faults would surface asinvalid_request_errorforever. Fix: comment, or narrow the arm so they render 500. - Minor — the unit test exercises
Capacity/Unavailable(http.rs:762-771) that preparation cannot produce, andcapacity_hintis never asserted (phase_tests.rs:8461-8462,:8548-8554). - Minor — reported totals (helios 1,880/84, flare 254/4, flare-cli 245/3) are identical to the pre-
4695d84run despite a +327-line test, and no CI exists at this head.
Verified sound: the mapping matches status/error_code exactly, only error.code changes on the wire, the x-request-id/logging contract boundary holds (phase_tests.rs:8492-8495), Messages envelope scoping is correct, and no lock/allocation/lifetime/ordering change touches the hot path or the metric span.
Open: whether the docs contradiction is fixed in-PR; why the helios count did not move; whether the internal-error 400 is acceptable.
Re-review
Recommendation: Ready To Merge
Commit 4695d84 resolves all four items from the prior review cleanly and introduces no regressions: AdmissionError::Invalid now stays on invalid_request_error alongside untyped HTTP 400 checks, the dead FrontendError::ImageDecode branch is gone, make_state reuses http_state_for, and docs/api.md documents the four typed HTTP 400 error.code values on OpenAI-shaped endpoints. The implementation fixes #446 at the right layer with exact parity on HTTP status codes, x-request-id/logging boundaries, Anthropic envelopes, and spawn_blocking permit lifetimes; confirm green CI on 4695d84 before merging.
Merge Risk
Level: Low
- Changes are confined to
helios/src/server/http.rs(+107/−23),helios/src/server/runtime/phase_tests.rs(+327/−0), anddocs/api.md(+6/−3); no model-core, scheduler, prefix-cache, worker, or CUDA-graph code is touched, and no HTTP status codes change (all reachable preparationAdmissionErrorvariants map to HTTP 400 athelios/src/server.rs:733-741). - No concurrency, contention, permit-lifetime, or common-path overhead regression:
frontend_slots(_permit),ingress_slots(_ingress), andextragroup permits insidespawn_blocking(helios/src/server/http.rs:209-284) retain identical acquisition and drop scopes,first_responseobservation is unchanged, andfailure_responseruns post-join on error paths only. - On OpenAI-shaped endpoints (
/v1/chat/completions,/v1/completions,/v1/responses), onlyerror.codechanges on the four typed 400 classes (context_length_exceeded,unsupported_feature,invalid_grammar,invalid_image), whileerror.type(invalid_request_error),error.param(null), general 400s (invalid_request_error), and Anthropic/v1/messagesenvelopes remain unchanged.
Walkthrough
- Shared failure renderer (
helios/src/server/http.rs:26-41): extractsfailure_response(&HttpState, Protocol, Error) -> Responseusingprotocol.failure(&failure)andrejection_details(state, failure)for hint-suffixed messages;rejectiondelegates tofailure_responsewhile keepinglog_failureandwith_request_idpost-submission only (matchingdocs/core-design.md:1119-1121anddocs/api.md:261-262). - Preparation error classifier (
helios/src/server/http.rs:119-132): adds privatePreparationError::{Http, Failure}andpreparation_error(Error)soError::Admission(AdmissionError::Invalid(_))and non-admission errors map toPreparationError::Http(StatusCode::BAD_REQUEST, ...), while all otherError::Admission(_)variants stay typed asPreparationError::Failure. - Generation preparation dispatch (
helios/src/server/http.rs:209-293): routesprotocol::decode,GrammarCompiler::compile_text,Request::generation_count,request::compile_strict_validators, andrequest::prepare_validated_inferencethroughpreparation_error, dispatchingPreparationError::Failuretofailure_responseandPreparationError::Httptohttp::errorwhile leavingdecode_body(400/413/415), oversized groups (400), and ingress exhaustion (429) onhttp::error. - Documentation (
docs/api.md:257-261): documents that on Chat Completions, Completions, and Responses, typed HTTP 400 rejections seterror.codetocontext_length_exceeded,unsupported_feature,invalid_grammar, orinvalid_imagewhile keepingerror.typeasinvalid_request_error. - Tests (
helios/src/server/http.rs:739-807,helios/src/server/runtime/phase_tests.rs:8438-8763): unit-testspreparation_erroracross allAdmissionErrorvariants plus untyped strings, and driveshttp::generateend-to-end across/v1/chat/completions,/v1/completions,/v1/responses,/v1/messages, and/v1/messages/count_tokens(buffered andstream: true) asserting typed codes,context_hint,invalid_request_errorfor bothAdmissionError::Invalid(stop> 4) and untyped validation (max_tokens: 0), 400/413/415 handling, absentx-request-id, and zero queue admissions (receiver.try_recv().is_err()).
Pre-merge Checks
- [PASS] Security / malicious screen: No unsafe code, external I/O, or prompt-injection/instruction-directing content in the PR description, comments, or diff.
- [PASS] Charter & value fit: Fixes maintainer-confirmed bug #446 in Helios's shared HTTP layer with no per-model branches, flags, magic defaults, or new dependencies, and includes all four required PR description sections.
- [PASS] Related / duplicate / conflict check: No competing PR; cleanly aligned with
main(open same-author PRs #691 and #692 touchhttp.rs/phase_tests.rswith disjoint intent and may only need a textual rebase depending on merge order). - [WARN] Tests & verification evidence: Added CPU tests are isolated (per-test PID/serial temp dirs cleaned up immediately in
Fixture::with_template, no global state) and exercise realhttp::generatewithout mocks; scheduler/formal lifecycle gates do not apply. Only author-local release test runs are reported on4695d84(no CI check runs visible yet, and live GPU /tests/server/test_protocols.py(not opened) were not run, as disclosed) — confirm green CI before merging.
Blockers
None.
Should Fix
None.
Subtract / Simplify
- Collapse duplicate
PreparationError::Httparms (helios/src/server/http.rs:124-132, optional): Arms 1 and 3 ofpreparation_errorconstruct the identicalPreparationError::Http(StatusCode::BAD_REQUEST, ...)expression. They can be combined into two arms so the "allAdmissionErrorexceptInvalid" rule appears once:fn preparation_error(error: Error) -> PreparationError { match error { Error::Admission(kind) if !matches!(kind, AdmissionError::Invalid(_)) => { PreparationError::Failure(Error::Admission(kind)) } other => PreparationError::Http(StatusCode::BAD_REQUEST, other.to_string()), } }
Nits
None.
Dropped on verification
docs/api.md:257-261"contradictsdocs/api.md:250-251" (flagged as Blocker by Correctness lens, and raised in Discovery/Subtraction): Dropped as false/over-flagged. Throughoutdocs/api.md:250-257, the parenthetical values (invalid_request_error,authentication_error,request_too_large,rate_limit_error, andserver_error/api_erroron Messages) documenterror.typeacross all protocols (including Messages, which carries noerror.code), and lines 257-261 explicitly reconcile the distinction ("while keepingerror.typeasinvalid_request_error").- Reported test totals unchanged between
2f72e1band4695d84(flagged in Discovery, Correctness #5, Subtraction open Q2): Dropped as false. Commit4695d84edited assertions inside the two existing test functions (helios/src/server/http.rs:739-807andhelios/src/server/runtime/phase_tests.rs:8438-8763) without adding new#[test]functions, socargo test's per-test-function count (1,880 passed / 84 ignored) is expected to remain identical. expected_typeparameter inassert_envelopeis constant"invalid_request_error"(Subtraction #5): Dropped as factually false.helios/src/server/runtime/phase_tests.rs:8760passes"request_too_large"for HTTP 413; inlining"invalid_request_error"at line 8504 would break the test.send_rawduplicateshttp_generation_request_observed(Subtraction #3): Dropped as false/low-signal.http_generation_request_observed(phase_tests.rs:4461-4490) hardcodesFixture::new(), accepts only validserde_json::Value, and blocks expectingreceiver.recv_timeout(...)to succeed (which panics on preparation rejections);send_rawsends raw strings (including malformed JSON and oversized bodies), setsanthropic-version/content-encoding, assertsx-request-idabsence, and expects zero queue admissions.- Typed preparation failures are not logged or counted in
requests_failed_total(Correctness #2): Dropped as pre-existing by-design behavior.docs/api.md:261-262anddocs/core-design.md:1119-1121scopex-request-idand failure logs to post-preparation/model-submission failures, andrequests_failed_total(helios/src/server/metrics.rs:1092-1094) counts model requests rather than HTTP pre-submission rejections (which incrementhttp_requests[metric]). preparation_error's catch-all arm maps non-admission errors to HTTP 400 (Correctness #3): Dropped as parity withmainandrequest::prepare. Bare string validation errors acrossrequest.rs(Error::from(&str)->ExecutionError::Stateathelios/src/error.rs:174-183) and client-inducedFrontendErrors are intentionally HTTP 400 (request.rs:35); the lens's suggested narrowing toExecutionError::Statewould regress client-inducedFrontendErrors to HTTP 500.- Unit test covers unreachable
Capacity/Unavailablevariants and omitscapacity_hint(Correctness #4 / Subtraction #2): Dropped as low-signal. Exhaustively unit-testingpreparation_erroracross allAdmissionErrorvariants in ~68 lines of fast pure-Rust assertions is sound, andrejection_details(http.rs:60-72) was not modified by this PR.
Full report Decision to Test: no (56%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 92.3% -
triage:validation: 5.9% -
triage:design-review: 1.2% -
none: 0.5% -
triage:investigate: 0.1% -
triage:verify-for-closure: 0.1% -
triage:integration: 0.0% -
triage:partial: 0.0% -
triage:superseded: 0.0%
Apply labels
No label changes