Code review summary report · NVIDIA/hyperflare-inference #461

Raw Markdown for agents: https://autobot.eidonix.com/p/bce457a7-16fc-4c16-a336-f1c0faf6297b.md

PR #461 — "Document strict tool selection and numeric range precision" (jcartu, head e831b49, base main)

Reviewed: docs/api.md (+27/−14) and helios/src/grammar/strict.rs (+12/−0). The only helios hunk is a #[cfg(test)] function (strict.rs:3888-3898); the runtime diff against the base is empty, so the description's "no requests accepted on main acquire a new HTTP 400" holds structurally.

Key findings

Blockers

None.

Should Fix

1. Say that every declared strict schema must be admissible, not only selected ones

Finding. The new docs/api.md:522-525 ("Selection by itself adds no decoding constraint; when the selected function sets strict: true, it attaches the strict request grammar described below") and :544-546 ("any active strict: true function still attaches the strict request grammar") are right about grammar attachment: active_tools is built only when tool_choice != ToolChoice::None, and Named keeps only matching names (helios/src/server/request.rs:225-241), with has_active_strict_tool gating compilation (:242-279). Schema admissibility is different: compile_strict_validators filters request.tools.iter().filter(|tool| tool.strict) with no tool_choice term (request.rs:94) and is the first call in prepare_inference_cached (request.rs:125). A strict tool with an unsupported or ambiguous schema therefore fails with HTTP 400 even under tool_choice: "none" or a named choice of a different tool. The rule is already pinned by ignored_strict_tools_still_require_compiler_admissible_schemas (request.rs:704-769, which loops over ToolChoice::None and ToolChoice::Named("selected") and asserts the error). Request. Add one clause to the named/required paragraphs: "Every declared strict: true schema must be admissible even when its tool is not selected; an unsupported or ambiguous strict schema returns HTTP 400 before generation." Why. A client reading the two new sentences will conclude an unselected strict tool cannot fail the request. The only nearby cover is api.md:644-645 ("invalid strict schemas return HTTP 400"), which is scoped to active tools and sits a paragraph later.

2. Give the documented rounding deviation a docs/TODO.txt entry

Finding. docs/api.md:605-612 documents a real gap between the delivered grammar and the declared schema: for an integer property, minimum: 9007199254740993 can admit 9007199254740992, and exclusiveMinimum: 9007199254740992 can admit the endpoint. helios does not compensate — range keywords pass admission if they are finite (strict.rs:575-584) and go verbatim to the pinned llguidance = "=1.9.1" (helios/Cargo.toml:62) — and the description says "This does not fix llguidance's rounding". docs/TODO.txt has no entry: searching it for the bound literals, binary64, llguidance, 2^53 and "round" returns only unrelated items (docs/TODO.txt:12, :172, :211, :293, :337, :403); its only strict-tool item is :25-28 (TMLv0 strict: true). Request. Keep the api.md paragraph and add a TODO naming the missing condition and its removal criterion, e.g. "Reject or exactly enforce strict-tool minimum/maximum/exclusiveMinimum/exclusiveMaximum above 2^53; llguidance 1.9.1 rounds them, so an integer grammar admits a value its bound forbids. Close when a test shows the 9007199254740992 cases are refused, or when the api.md guidance is no longer needed." Why. AGENTS.md:47-55: "Record unresolved defects, unrun checks, and pending measurements in docs/TODO.txt, not in design documents." The repo-prose skill (.agents/skills/repo-prose/SKILL.md:38-39 (not opened)) requires a TODO to name the missing condition and the criterion for removal. Documenting the limit in the API reference and tracking it are not mutually exclusive; as written it has no owner and no follow-up.

3. Pin the two documented rounding outcomes with a test

Finding. The added test (strict.rs:3888-3898) loops maximum over 1_000_000_000_000_000_000u64 and i64::MAX as u64, admits the endpoint and rejects its successor. That covers only the exact rows. The two inexact behaviours api.md:607-609 asserts — minimum: 9007199254740993 admitting 9007199254740992, and exclusiveMinimum: 9007199254740992 admitting the endpoint — are asserted nowhere: searching helios for those literals returns only the const/enum rows (strict.rs:3906-3917, 3950-3978) and the unchanged inclusive-maximum test (strict.rs:3006-3016). The sole evidence is the reviewer's aarch64 scratch run on main at 6d6fe0c6. Request. Extend the added test, or add a sibling, asserting the two documented outcomes and naming them as the current limitation. If you judge that asserting wrong-but-current behaviour blesses it, say so in the TODO entry and in the PR's stated limitations. Why. llguidance is pinned at =1.9.1 (helios/Cargo.toml:62) and this paragraph is now the only record of that contract. A bump that fixes rounding would leave the API reference over-claiming a limitation with nothing to say so. AGENTS.md:189-194 (tests exercise the affected behaviour or contract); docs/design-review.md:94-102 (evidence attached to the claim).

4. Describe bounds that admission refuses outright

Finding. yatesdr's table on this PR records that minimum: -9223372036854775808 on an integer property and minimum: 2^60 on a number property are already refused by llguidance with a range error — an HTTP 400 per api.md:644-645. docs/api.md:605-612 instead frames all large bounds as accepted-and-rounded and tells the reader to "validate the tool arguments with exact arithmetic before executing the tool". For a refused bound there is no generation and no tool call to validate, so the advice is wrong for them. helios cannot bound the set: the four keywords only require as_f64().is_some() (strict.rs:575-584), so the refusal lives in llguidance. Request. Add one sentence to the same paragraph: bounds whose magnitude the schema compiler cannot represent are rejected at admission with HTTP 400, so such a bound must be removed rather than validated afterwards. Pair it with the test from item 3 (assert each bound keyword at 2^60 and −2^63 through validate_strict_tool_schema) and quote that test. Also confirm on x86_64 with the shipped llguidance — the observation was aarch64. Why. The paragraph exists so a client knows which failures to expect; as written it sends the reader down a path that 400s, which is the class of defect this PR set out to remove.

Nits

  1. Fold the new test into the existing one, or place it beside it. strict.rs:3888-3898 vs strict.rs:3005-3025: strict_bounds_do_not_round_integers_or_fractional_multiples already asserts that inclusive maximum: 9007199254740992 accepts the endpoint and rejects 9007199254740993 (:3008-3016). Of the new loop values, 10^18 = 5^18·2^18 is exactly representable in binary64 and adds no rounding case; only i64::MAX (2^63−1, rounds to 2^63) is new. Request: add the values to the existing test or move the new test immediately after :3025. Why: one property should have one owner; today it has two, ~880 lines apart (AGENTS.md:189-194).
  2. Restore "IEEE 754" and settle the interval. Main said "parsed at IEEE 754 binary64 precision … (9,007,199,254,740,992, so integer literals lie in [-9,007,199,254,740,991, 9,007,199,254,740,991])". The replacement at api.md:600-603 says only "parsed at binary64 precision … magnitude strictly below 2^53", and IEEE now appears nowhere under docs/ (searched: no matches). Request: restore "IEEE 754"; keep the interval deleted as redundant with the magnitude rule, or if omitted add "so integer literals lie in ±(2^53 − 1)" so a client need not convert. Why: the change's own argument is that precision loss must be distinguishable from an unsupported schema, so naming the standard exactly helps.
  3. Rewrap api.md:607 (86 columns where neighbours wrap at ~78-80) and pick one separator convention — the new literals are unseparated while api.md:815 uses 5,000/20,000. Unseparated is defensible inside copyable code spans; the wrap needs fixing either way.
  4. Drop or support the causal clause at api.md:608-609 — "can admit the endpoint itself because adding one rounds back to the same number" asserts that exclusive bounds are implemented as bound + 1, which nothing in this repository shows. Remove it or cite where exclusive-bound handling lives (docs/design-review.md:134-149 rejects unsupported claims in changed prose).
  5. Define "active" once. api.md:545, :614, :639 and :644 all lean on "active strict: true function"/"active strict tool" and the page never defines it; in code it means post-tool_choice filtering (request.rs:225-241) plus tools being enabled. Define it at first use near :545, which the change newly makes load-bearing.
  6. Prefer "adds no decoding constraint" at api.md:544. "leaves sampling unconstrained" replaces main's "Sampling is unchanged" and can be read as "the request's sampling parameters are ignored", which is not the behaviour — the parameters still apply and only a grammar may be added. Use the phrasing already chosen at :524.
  7. Reduce repeated prose. "binary64 precision" appears twice within six lines (api.md:601, :606), and the grammar-attachment fact appears in three wordings (:525, :546, :639-640). Keep both by-mode sentences (the #418 review asked for them) but reuse one phrasing, e.g. "adds no decoding constraint of its own; an active strict: true function still attaches the strict request grammar described below".
  8. Add an explicit claimed-result statement to the description. The benefit appears inside Why ("Documenting the limitation preserves those requests") and Compatibility ("No requests accepted on main acquire a new HTTP 400"), and the third section slot is occupied by Compatibility. Request: one sentence at the head of a Result section, e.g. "Result: the API reference now states both rounding behaviours and the exact-endpoint cases; no decoding or admission behaviour changes." Why: AGENTS.md:90-97 wants the claimed result precise, distinguishable from measurement, and stated before the evidence.
  9. Commit subjects. Head commit e831b496 "Preserve admission for large strict numeric bounds" describes the branch against its own parent a640a302, not against merge base 6b586398 — against the base, admission never changed. Squash to a subject stating the net change (the PR title already does). Also confirm yatesdr's earlier nit on a640a302 is answered: their review says that commit body carries #418 timing provenance, and the reply only says the PR description no longer cites it; commit bodies are not readable with the review tools, so this rests on the reviewer's quotation (AGENTS.md:124-127, repo-prose SKILL.md:40-43).
  10. Low / maintainer preference: api.md:610-611 ("An inclusive maximum: 9007199254740992 does distinguish the endpoint from the next integer") reassures rather than specifies a limit, and is the only reassuring sentence in the reference. It does carry the compatibility argument — rejecting every bound at or above 2^53 would refuse exact maxima — so keeping it is defensible.

Checked and cleared (not findings)

Open questions / could not be found