#1 [high] Change: what #689 does (verified from diff)
PR #689 (jcartu, opened 2026-12-02, head 2f72e1b, base main, 2 files +442/-23). Files: helios/src/server/http.rs (+86/-23), helios/src/server/runtime/phase_tests.rs (+356/-0).
Verified in code at PR head:
- helios/src/server/http.rs:26-31 new
failure_response(&HttpState, Protocol, Error) -> Response:protocol.failure(&failure)then overridesbody["error"]["message"]withrejection_detailsmessage, status fromrejection_details(i.e.status(&failure)). - helios/src/server/http.rs:32-41
rejectionnow =log_failure(only if state.log_to_stderr) +with_request_id(failure_response(...), id). So x-request-id and failure log remain post-submission only. - helios/src/server/http.rs:119-132 new
enum PreparationError { Http(StatusCode, String), Failure(Error) }andpreparation_error(Error) -> PreparationError:Error::Admission(_)-> Failure unchanged;Error::Frontend(FrontendError::ImageDecode(_))-> Failure(error.admission_context(AdmissionError::Image)); everything else -> Http(400, error.to_string()). - helios/src/server/http.rs:209-290 generate(): decode_body maps to Http; protocol::decode, GrammarCompiler::compile_text, Request::generation_count, request::compile_strict_validators, request::prepare_validated_inference all
map_err(preparation_error). Oversized generation group (400) and TOO_MANY_REQUESTS native generation admission stay Http. - helios/src/server/http.rs:285-291 dispatch: Http ->
error(protocol, status, msg); Failure ->failure_response(&state, protocol, failure); join error -> 500. - Tests: unit test http.rs:739-786
preparation_error_preserves_typed_admission_errors_and_keeps_untyped_bad_requests; wire test phase_tests.rs:8438-8792http_preparation_failures_preserve_typed_error_codes_and_protocol_envelopescovering all 5 routes.
Key behavioral deltas beyond description wording: untyped errors previously wrapped into AdmissionError::Invalid before rejection_details, and are now mapped straight to HTTP 400 with to_string(); explicit AdmissionError::Invalid now yields code invalid_request (was invalid_request_error). No docs file changed.
#2 [high] Why: issue #446 is the sole driver, confirmed by yatesdr
#446 "Request-preparation failures render the generic invalid_request_error code instead of the typed error codes admissions failures use" (shieldstar, opened 2026-11-21 18:26, open, labels area:api, bug; updated 2026-11-21 18:38).
- Repro: pure protocol-renderer unit tests at upstream 25b49519 showing
Protocol::failuregives typed codes butProtocol::error(400, ..)gives type=code="invalid_request_error". "The tests pass because they assert the present behaviour; the two invalid_request_error bodies are the defect." - Expected: "A request that fails during preparation with an admission error should carry the same typed
codethatProtocol::failuregives the same error". - Source pointers it gives: protocol/mod.rs:33-46 (error kind table,
_ => "invalid_request_error"at :42), mod.rs:53-58 (failure overwrites code via error_code), server.rs:655 error_code, http.rs:259-267 (map_err returning rejection_details), http.rs:275 (error(protocol, status, message)), http.rs:12-17 (http::error calls Protocol::error). - One comment, yatesdr (2026-11-21 18:38): "Confirmed by reading at main 21a40f05 ... No test covers the preparation path." — independent confirmation by a frequent helios/src committer (49 commits/180d).
- Suggested fix matches what #689 implements (return protocol.failure + status(&error)).
- referred to by #689 only.
#3 [high] Change: verified producers of typed errors on the preparation path
Verified at PR head vs main:
- Code paths that produce typed AdmissionError during preparation (all now hit failure_response):
protocol::decode— helios/src/server/protocol/decisions/mod.rs:219,285 patterns wrap untyped errors asadmission_context(AdmissionError::Invalid); feature errors via helios/src/server/inference.rs:214 (Error::admission(AdmissionError::Feature, ...)).GrammarCompiler::compile_text— helios/src/grammar.rs:543, errorsAdmissionError::Grammar(grammar.rs:554-586).request::compile_strict_validators— helios/src/server/request.rs:88-113; strict schema failures via helios/src/grammar/strict.rs:40 (AdmissionError::Grammar).request::prepare_validated_inference— helios/src/server/request.rs:129-...; explicit Context error at request.rs:352-359 for count_only; image errors wrapped asAdmissionError::Imageat request.rs:1135-1230; other validation errors are plain strings ->Error::Execution(ExecutionError::State)via error.rs:174-178 (hence PreparationError::Http 400).
- Context errors from
model::admission::validate_prompt(helios/src/model/admission.rs:135-169) happen after preparation in runtime.rs:954-955 wrapped asAdmissionError::Invalid— not touched by this PR; they remain a post-preparationrejectionpath (so context codes there derive from wrapping, see note on Invalid). status()(helios/src/server.rs:733-741): Capacity/Unavailable -> 503, other Admission -> 400, everything else -> 500. So preserving typed Admission unchanged keeps 400 except Capacity/Unavailable (which preparation cannot produce).error_code()(helios/src/server.rs:743-755): Context=context_length_exceeded, Feature=unsupported_feature, Grammar=invalid_grammar, Image=invalid_image, Invalid=invalid_request, Capacity=capacity_exhausted, Unavailable=server_unavailable, Execution::Capacity=execution_capacity_exceeded,_ => "server_error".
#5 [high] Related work: no competing PR; same-file neighbours #692, #691, #638, #418
- No competing or overlapping PR:
related_items(689)shows only #446 as referred item and no other PR changing the same error-rendering code. Same-file neighbours: #692 (jcartu, open, output-stream failure accounting in http.rs/runtime.rs), #691 (jcartu, open, continuous_usage_stats cached tokens in http.rs/encode.rs/runtime.rs), #638 (merged 2026-12-01, Responses tools/text.format echo, touches http.rs + phase_tests.rs; its diff added theget_responses_returns_bad_request...test at http.rs:720-737 that #689's new test sits next to), #418 (merged, jcartu, strict function-tool schemas — origin ofcompile_strict_validatorsnow routed through preparation_error), #333, #317, #176 (merged, yatesdr, x-request-id + failure logs), #167. - #692 and #691 are same-author, same-day, same files but disjoint concerns (metrics accounting, cached-token reporting); they touch the same regions of
http::generate(the event loop and preamble) so textual conflicts with #689 are plausible though #689's hunks are the preparation closure and top-of-file helpers. - Existing sibling test
http_admission_rejections_use_json_or_terminal_stream_errors(phase_tests.rs:5132-5210) covers post-admission Capacity/Unavailable/Context rejections incl. x-request-id prefix and codes; #689's new test extends the same style to the preparation path.stream_errors_preserve_typed_codes_and_protocol_envelopes(protocol/tests.rs:1485-1545) is the streaming analogue. - Home of the typed-code table:
error_code(server.rs:743-755) andstatus(server.rs:733-741); the sibling decision-serving code already rendersProtocol::failurefrom insidespawn_blocking(protocol/decisions/mod.rs:216-226 and 282-292), i.e. /v1/systemone and /v1/decisions already had typed codes — so #446/#689 covers the last straggler path.
#6 [high] Project fit: docs/core-design.md already promises typed codes; api.md lists no codes
- docs/core-design.md:1117-1119 already states "Chat and completion errors include
type,message,param, and a typedcode", and :1115-1116 "Failures observed before response headers use the corresponding HTTP error status" — i.e. the documented contract already promised typed codes on pre-header failures; #689 makes the preparation path match the doc rather than changing the doc. This is the strongest textual support that #446 is a bug, not a design change. - docs/core-design.md:1119-1121 "After frontend preparation, generation responses carry an
x-request-idheader matching failure logs" — preparation failures occur during frontend preparation, so omitting x-request-id (which #689 preserves) is consistent. - docs/api.md:248-259 (error shapes section): "Chat Completions, Completions, and Responses errors are
{"error": {"type","message","param":null,"code"}}; Messages errors are{"type":"error","error":{"type","message"}}. Malformed, unsupported, and over-context requests return HTTP 400 (invalid_request_error)..." and "Responses for requests that reach model submission carry anx-request-idheader." No specific code strings (context_length_exceeded,unsupported_feature,invalid_grammar,invalid_image,invalid_request,capacity_exhausted) appear anywhere in docs/ (grep: no matches). So after #689 thetyperemains invalid_request_error for these 400s (docs stay literally true) whilecodebecomes typed — docs need no edit, but they also give clients no warning that code differs from type. - helios/README.md:92-99 documents status mapping and that "Context and capacity rejections append the configured
context_hintorcapacity_hint" — consistent with failure_response applying hints; still true after the change and now also applies to context errors raised byprotocol::decode/grammar paths, which previously rendered without the hint. - Python API tests: tests/server/test_protocols.py:616-624
test_unsupported_features_and_error_shapesasserts status 400 anderror["type"] == "invalid_request_error"only — unaffected by the code change. No Python test asserts specificerror.codevalues exceptmodel_not_found(test_protocols.py:85). tests/server/test_decisions.py:203-218 likewise asserts onlyerror["type"]. - In-repo Rust test that pins the old flat code for a preparation-ish path: phase_tests.rs:4806-4821 asserts only
error["type"] == "invalid_request_error"for invalidtext.format(would still pass; hmm — invalid text.format is a decode-time error that may now be Grammar-typed, still type invalid_request_error). - Charter (read_charter): "Bring real evidence ... Bug fixes need to address the root cause"; "Solve the right problem in the right place ... smallest footprint in shared code"; "Keep the runtime small and model-agnostic"; "Support the documented Chat Completions, Completions, Responses, and Messages APIs"; docs stand: "We target the documented subset of the OpenAI API, the Anthropic Messages API". #689 fixes the root cause (renders through the typed path) in the shared HTTP layer with no per-model branches — lines up. Tension: none found; no new config/default/flag, so it does not brush the "no magic defaults / no extra switches" rules. Charter also wants PRs with why/what/result/evidence — the description has all four.
#8 [high] Claims and evidence: verified vs asserted; CI absent
Claims in the description vs what backs them:
- "preserve typed error codes ... on preparation failures" — backed by code (http.rs:119-132, 209-291) and two tests. Verified by reading: the mapping is correct for
Error::Admission(_)andFrontendError::ImageDecode. - "keeps untyped preparation validation errors on invalid_request_error" — supported: untyped errors are
Error::Execution(ExecutionError::State)(error.rs:174-178) -> PreparationError::Http(400) ->Protocol::error-> code = kind = invalid_request_error. Test case at phase_tests.rs:8738-8759 usesmax_tokens: 0. - "explicit AdmissionError::Invalid now preserves invalid_request instead of flattening" — a behaviour change not present in issue #446's list of codes; verified in code and covered by test phase_tests.rs:8718-8735 (uses 5 stop sequences, stops.rs:23 etc.). Note this makes
codediverge further fromtypefor a common client mistake class. - "no x-request-id and no failure_log for preparation failures" — verified by construction:
failure_responsedoes not callwith_request_id, andlog_failurestays inrejection(http.rs:32-41). Consequence not stated in the description: a preparation failure is also not logged to stderr, so operators lose thestage=admission code=...line for these rejections (previously they were also unlogged viaerror(), so no regression — it preserves the status quo). - Claimed test totals: helios 1,880 passed / 84 ignored (lib 1,818 + 47 ignored; integration 62 + 37), flare 254, flare-cli 245. Cannot verify from here; note that #692 (same author, same day) reports 1,884 passed / 84 ignored for helios, and #691 reports 1,821 lib passed (47 ignored) + 62 integration (36 ignored) — i.e. the sibling PRs' counts differ from each other by 1-9 tests, consistent with each PR adding different numbers of tests on slightly different bases, but it means these totals are per-branch local runs without a shared commit.
- Limitations disclosed: no live GPU serving, no
tests/server/test_protocols.pyrun. Consistent with the fact that every added test is a CPU/axum-level test throughhttp::generatewith aFixturemodel and a stubmpscchannel, assertingreceiver.try_recv().is_err()for zero model-queue admission (phase_tests.rs:8500-8792). Not claimed but true: no CI run exists on head 2f72e1b (orientation packet: "no checks"), so no external verification of the reported numbers..github/workflows/native-serving.yml:63,68runs exactlycargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server, so CI would cover the new tests once it runs.
#9 [high] Reach: clients, operators, metrics, docs, compatibility
- Reach — clients: OpenAI-SDK clients on /v1/chat/completions, /v1/completions, /v1/responses now see
error.code=context_length_exceeded,unsupported_feature,invalid_grammar,invalid_image,invalid_requestinstead of alwaysinvalid_request_error.error.typestaysinvalid_request_errorandparamstays explicit null (protocol/mod.rs:44-50). Anthropic /v1/messages and /v1/messages/count_tokens are unchanged in shape (no code/param field; protocol/mod.rs:45-47,55-57), asserted in the new test at phase_tests.rs:8524-8536. - Status codes unchanged:
status()maps every Admission variant except Capacity/Unavailable to 400 (server.rs:733-741); preparation produces no Capacity/Unavailable, so all typed preparation failures stay HTTP 400. - Hints:
rejection_details(http.rs:60-72) appendscontext_hintfor Context andcapacity_hintfor Capacity. Since preparationContexterrors (e.g. request.rs:352-359 count_only path, request.rs:618-628 output_limit) now render through failure_response, the context_hint now applies where the old path producedAdmissionError::Invalidwrapping (hint read from&failure's variant before wrapping in the old code — the old map_err wrapped non-Admission errors as Invalid so the hint was lost; Context-typed errors kept it).capacity_hintcan never apply on the preparation path. - No
x-request-idheader and no stderrfailure_logfor preparation rejections (failure_response vs rejection, http.rs:26-41) — consistent with docs/api.md:258 and docs/core-design.md:1119-1121, so no doc drift; also no regression, since the olderror()path also had neither. - Observability gap a reviewer may flag: preparation rejections increment nothing except
http_requests[metric](http.rs:160); they are not counted inflare_requests_failed_total. Same author's #692 reworks failure accounting in the same file, so the two are worth reading together. - Compatibility: no envelope/status break, but
codestrings change for a class of 400s. In-repo clients/tests only asserttype(tests/server/test_protocols.py:620, tests/server/test_decisions.py:218) orcode == "model_not_found"(test_protocols.py:85), so no in-repo test breaks; the Python integration suite was not run by the author (disclosed). A client branching oncode == "invalid_request_error"would see different strings. - Docs: the PR touches no docs. docs/api.md:248-251 mentions only
invalid_request_errorfor malformed/unsupported/over-context 400s, so the documentedcodestory becomes incomplete (not contradicted, becausetypestays invalid_request_error). Sibling PR #638 did add docs/api.md text for its contract change, so a reviewer may ask for the same here. - Rust API surface:
PreparationError,preparation_errorandfailure_responseare private to helios/src/server/http.rs; no public API, config, default or dependency change.
#4 [medium] Process: #689 state — no CI, no reviews, no labels
PR #689 state as of analysis (2026-12-02): open, "ready for review" per orientation packet, no labels, 0 reviews, 0 comments/discussion, no CI checks on head 2f72e1b ("CI on the head commit: no checks"), authored and last updated same day it was opened (fresh; ~0 hours old). Files changed: helios/src/server/http.rs (+86/-23), helios/src/server/runtime/phase_tests.rs (+356/-0). No docs changed. Single commit on branch fix/preparation-typed-error-codes: 2f72e1bb "helios/server: preserve typed error codes on HTTP request preparation failures" (author Joshua Cartu). Description includes "Discord: jcartu".
#7 [medium] People: author history and area ownership
jcartu (Joshua Cartu), GitHub association CONTRIBUTOR, not among the charter's named priority contributors (@voipmonitor, @original-el8, @lukealonso). Activity: 3 merged / 3 closed / 10 open PRs in 180 days; merged work touching docs (3), helios/src (3), heliopause/src, helios, helios/proto. Merged helios/src commits on main: 0b09434d "Constrain strict function-tool arguments in native tool syntax (#418)" (2026-11-22), 85de9eae "Bind core-declared FP32 parameters into text forward graphs" (2026-11-28), 425ab2d4 "Refresh host prefix-cache recency on request completion (#416)" (2026-11-23). Open same-day cluster (all opened 2026-12-02, all with "Discord: jcartu"): #689 (this, 20:48), #691 (20:54), #692 (20:54), #693 (perf scheduler survival-curve caching), plus #687, #688, #690, #686 also 2026-12-02 and #642, #621. This is a broad batch submission; three of them (#689, #691, #692) touch helios/src/server/http.rs simultaneously. Review history for this author: #621 received Autobot reviews (Changes Requested then Ready To Merge after rebase), #638 was an autobot-authored PR. jcartu engages with Autobot review threads (case files opened on their PRs). Who normally works in this area: Luke Alonso (237 commits in helios/src/180d), Martin Vit (52), yatesdr (49). Recent http.rs/server.rs committers: flare-autobot (#638), jedi95 (#317), yatesdr (#176, #167, #333), Luke Alonso (dc0d40e0 hardening of HTTP ingress 2026-11-19). yatesdr confirmed #446 by reading — a signal a maintainer has already endorsed the problem. Notably absent so far on #689: any human review, and no Autobot case-file comment yet (unlike #621/#638 which got one within minutes) — possibly because it is still under 90 minutes old.