PR #461: Document strict tool selection and numeric range precision

Raw Markdown for agents: https://autobot.eidonix.com/api/v1/cases/e3f33f2c-32be-4616-a093-4f77e70c151a

Opened by a workflow run, Nov 24, 2026 1:17 PM EST.

screen malicious

Screen Result: All Clear

Evidence: No prompt injection, hidden instruction, or agent-directed content was found anywhere in PR #461 (docs/api.md + helios/src/grammar/strict.rs, +39/−14). The whole diff is prose clarification plus one local unit test; nothing in it asks a reader or an agent to change behaviour, fetch anything, or bypass a rule.

Worth noting for reviewers, not for the injection screen: the PR documents and declines to fix a real leniency — exclusiveMinimum: 9007199254740992 can admit the endpoint and minimum: 9007199254740993 can admit the preceding integer — so the docs carry an application-side-validation advisory.

Open questions: the evidence review URL #pullrequestreview-6023968982 and commit 6d6fe0c6 were taken from the description and not independently reproduced; no GPU benchmark was claimed or run.

Full report · Notes decide malicious: all_clear (100%): No malicious content found

explore

Author: jcartu (CONTRIBUTOR; 2 merged PRs in 180 days — #418, #416; also open #404); Discord: jcartu Motivation: Flare's docs said named/required tool selection adds no decoding constraints, which is untrue when the selected function is strict: true and attaches a grammar. The same docs treated every large numeric bound as a hard limit at 2^53, but only const/enum are restricted that way while minimum/maximum are merely approximate, so this PR rewrites the prose instead of rejecting schemas. Scale: +39 / −14 lines in 2 files Proposal:

Full report · Notes

Value Proposition

Verdict: worth it with changes

PR #461 (jcartu, open) is a docs-only fix plus one grammar test: docs/api.md +27/-14 and helios/src/grammar/strict.rs +12. The branch was a640a302 (reject every strict bound ≥ 2^53), which the author then reverted in e831b496; the net runtime diff against the base is empty, so no request accepted on main gains an HTTP 400 — that claim in the description is verifiable and correct.

Why it fits the charter

The charter's "What gets merged" list explicitly includes PRs that "address a maintainer request ... or bad docs," and the contributor rules say every PR is judged on its merits. This change is exactly that on both counts:

Who benefits, and how much

Clients of Chat Completions and Responses on strict tools, especially agent/tool-loop users whose schemas carry large integer bounds (i64::MAX, epoch-nanos, IDs). The benefit is moderate, not large: it changes no behavior, it only stops the API reference from asserting something untrue and marks a place where the guarantee ends. It also prevents a future regression by keeping the current admission (which is wider than llguidance's real precision) instead of introducing 400s.

Cost and risk

Close to zero on the metrics the charter cares about: no code path, no dependency, no perf claim (and the description correctly claims none), 10 net prose lines and an 11-line test. The one durable risk is doc drift when llguidance changes — worth mitigating with a test (below). The removed paragraph did lose some useful detail (the explicit [-9,007,199,254,740,991, 9,007,199,254,740,991] integer-literal interval), which callers relying on the exact thresholds may miss; restoring the numeric limits while keeping the new wording would be strictly better.

Is there a simpler way, or duplication?

No duplication: docs/core-design.md:1669-1685 already stated the correct grammar behavior ("Named tool selection ... does not by itself enable a grammar"), so api.md was the only document contradicting it — this PR removes the contradiction rather than adding a parallel statement. The precision paragraph is new information, not restated elsewhere. The test partially overlaps strict_bounds_do_not_round_integers_or_fractional_multiples (strict.rs:3006-3025, which already covers maximum: 9007199254740992), but the 10^18 and i64::MAX rows are the reviewer's measured rows and are the only executable record of them, so they earn their place. Simpler alternative: prose only, no test — cheaper, but then nothing catches a llguidance bump flipping these statements.

Changes I would require before merge

  1. The inclusive-maximum sentence is wrong above 2^53. docs/api.md:610-611 says "An inclusive maximum: 9007199254740992 does distinguish the endpoint from the next integer." True for that exact value (2^53 is representable), but normalize_integer_bounds (llguidance 1.9.1 json/numeric.rs:522-533 (not opened)) does max_val.floor() on an f64 and then the inclusive rx_int_range, so for maximum: 9007199254740995 the bound rounds to 9007199254740996 and the grammar admits a value one above the declared maximum; maximum: 9007199254740993 rounds down and rejects the valid ...993. Since the paragraph's purpose is to tell clients when strict mode stops enforcing their bound, a sentence that reads as "inclusive maxima are fine" is the one dangerous sentence in it. Say that only the endpoint named in the example is exact, or state that integer ranges are approximated above 2^53 in both directions.
  2. Say that some large bounds are refused, not just rounded. The reviewer measured, on main at 6d6fe0c6, that minimum: -9223372036854775808 on integer and minimum: 2^60 on number are rejected by llguidance with a range error and so return HTTP 400. The source agrees: rx_int_range(Some(i64::MIN), ..) errors on -left, and rx_float_range parses integer parts with parse::<i64>(). i64::MIN is the standard generated int64 bound, so without a sentence here a client cannot distinguish "silently rounded" from "refused at admission" — which is precisely the distinction the PR's own "Why" section says the text should draw for the const/enum case.
  3. Pin the two documented rounding examples in a test. The new test (strict.rs:3888-3898) covers only bounds the grammar gets right, and i64::MAX passes only because the f64 value 2^63 saturates on the as i64 cast. Adding the two examples the docs now quote (exclusiveMinimum: 9007199254740992 admitting the endpoint, minimum: 9007199254740993 admitting ...992) makes the prose a checked statement and surfaces drift when the pinned llguidance =1.9.1 (helios/Cargo.toml:62) is upgraded.
  4. Hygiene. The description no longer carries the unrelated #418 timing provenance the reviewer flagged, good; squash the a640a302 + revert e831b496 pair to the net diff, and confirm each commit has the Signed-off-by that CONTRIBUTING.md:9-19 requires (not checkable from here).

With 1–2 fixed (inclusive-maximum wording and the refusal class), this is a small, correct, charter-aligned documentation PR that closes a real contradiction from a contributor whose prior PR the maintainer already merged. Verdict: worth it with changes — not "worth merging as is," because the current inclusive-maximum sentence understates a limit the paragraph exists to disclose, but nowhere near "not worth it."

Full report · Notes Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Conventions

Verdict: clean (three nits only)

Blocking:

Should fix:

Nits: 3

Link: https://github.com/NVIDIA/hyperflare-inference/pull/461

Lens C (conventions and duplication) finds no blocking or should-fix problems in PR #461. The diff adds one #[test] and rewrites four prose passages; it introduces no helper, reimplements no existing mechanism, and the new test reuses the production admission entry point (validate_strict_tool_schema, helios/src/grammar/strict.rs:53) and TextGrammar::validate, exactly as the existing bounds test does.

Three nits:

  1. helios/src/grammar/strict.rs:3888 — strict_integer_maxima_preserve_large_inclusive_endpoints re-tests the construct already owned by strict_bounds_do_not_round_integers_or_fractional_multiples at strict.rs:3006-3025 (inclusive maximum: 9007199254740992, endpoint accepted, successor rejected), only varying endpoint values and sitting ~880 lines away. Fix: extend the existing test's data or place the new case beside it.
  2. docs/api.md:600-603 — the rewritten sentence drops two precise statements its predecessor carried: the "IEEE 754" qualifier on binary64 (spelled nowhere else in the repository) and the explicit accepted integer interval [-9,007,199,254,740,991, 9,007,199,254,740,991]. The new rounding paragraph does not restate them.
  3. docs/api.md:607 — runs to 86 columns where surrounding prose wraps at ~78-80; the new paragraph also juxtaposes unseparated 16-digit literals with 2^53 two lines after 5,000/20,000 at api.md:815.

Open questions: none material. The repeated "attaches the strict request grammar described below" statements (api.md:522-525, 544-546) are deliberate per the reviewer's request and match existing forward-pointer usage, so not reported as duplication. Reviewer yatesdr's "changes requested" state predates the author's 2026-11-23 documentation pivot; whether it is satisfied is for that reviewer to confirm.

Full report · Notes

Simplicity

Verdict: clean (nits only) Blocking:

Lens D (simplicity) on #461: the diff is docs/api.md +27/−14 and a pure test addition in helios/src/grammar/strict.rs +12/−0; no production code changes, so the only thing to shrink is prose and one test table. No hidden behaviour change: validate_strict_node and unsupported_strict_literal are untouched, which matches the description's "no requests accepted on main acquire a new HTTP 400." The deleted main text (digit-separated 9,007,199,254,740,992 constants and the [-…, …] integer interval) is a genuine simplification and should stay deleted.

Three nits, all "smaller version":

  1. strict.rs:3891 — strict_bounds_do_not_round_integers_or_fractional_multiples (:3005-3016) already asserts the same admission-plus-endpoint contract with maximum: 9007199254740992; of the new loop's two values, 1_000_000_000_000_000_000 is exactly representable in binary64, so it only restates "admission is not gated at 2^53", and i64::MAX is the one case that adds a rounded-bound endpoint. Smaller: for maximum in [i64::MAX as u64].
  2. api.md:600-606 — one admission rule now says "binary64 precision" twice within six lines; and :524-525 and :544-546 state the strict-grammar fact twice more, in different words, before :639-640 states it a third time. One sentence and one phrasing serve all four. :544 also replaces main's "Sampling is unchanged" with "leaves sampling unconstrained", which can be read as "sampling parameters are not applied".
  3. api.md:610-611 — "An inclusive maximum: 9007199254740992 does distinguish the endpoint from the next integer" reassures rather than specifies; the paragraph needs the two rounding failures (:607-609) and the remedy (:611-612).

Open question: whether the maintainer wants the reassuring inclusive-maximum sentence kept, since it carries the PR's compatibility argument into the reference; that is the only item here a reviewer could reasonably overturn.

Full report · Notes

Architecture

Verdict: should-fix issues only Blocking:

Full report · Notes

Correctness

Verdict: should-fix issues only Blocking:

Otherwise the change checks out in this lens: the net runtime diff against the base is empty (only docs/api.md and one test), so the "no new HTTP 400" claim holds; the numeric-range prose matches the code path (admission only requires as_f64().is_some(), strict.rs:575-584, and bounds go to llguidance unrounded via strict.rs:144); and the documented maximum behaviour is exercised at strict.rs:3006-3025 and the new strict.rs:3888-3898.

Open questions: whether "active" should be defined once in docs/api.md, and whether the two inexact cases should be pinned by a test so the docs cannot silently go stale against the pinned llguidance = "=1.9.1" (helios/Cargo.toml:62).

Full report · Notes

Prose

Verdict: should-fix issues only Blocking:

The four-part description (why / what changed / compatibility-claim / evidence) is present and its compatibility claim holds: the only helios/src change is a #[cfg(test)] addition, so no accepted request gains a 400. The named- and required-selection paragraphs match helios/src/server/request.rs:225-241 and docs/core-design.md:1679-1683. Open: which large bounds admission actually refuses (only a test can settle it); I cannot read commit bodies, so yatesdr's commit-message nit is carried, not re-verified; the two rounding cases in the docs are evidenced by the reviewer's scratch test, not by any test in this PR.

Full report · Notes

Pre Test Report

Pre-test report — PR #461 "Document strict tool selection and numeric range precision"

Verdict: do not refer to hardware testing. Two substantive documentation-accuracy defects must be fixed before merge; testing the current head would validate prose that is going to change, and there is no runtime code path for a GPU to exercise.


1. What the PR actually changes (verified against the diff, not the summaries)

Head e831b49, base main, 2 files, +39/−14:

There is no non-test code change. validate_strict_node and unsupported_strict_literal are untouched, so the PR's "no requests accepted on main acquire a new HTTP 400" claim is structurally correct — the net runtime diff against the base is empty. The branch history does contain a reverted opposite (a640a302 bounded range keywords below 2^53, reversed by e831b496); the PR description does not mention the reversal, which is a description-honesty nit, not a code risk.

2. Why hardware testing has no value here

3. Substantive problems that must be fixed first (these, not hardware, are what blocks)

S1 — docs/api.md:522-525 and :544-546 misdescribe when a strict schema can be refused. The new sentences tie grammar attachment to the selected/active function. Grammar attachment is indeed selection-scoped (helios/src/server/request.rs:225-241: active_tools is filtered by tool_choice; has_active_strict_tool at :242 gates compilation at :249-279). But schema admissibility is not: compile_strict_validators (request.rs:88-113, called first at request.rs:125) iterates request.tools.iter().filter(|tool| tool.strict) with no tool_choice term, so a strict tool with an unsupported schema returns an admission error (HTTP 400) even under tool_choice: "none" or a named choice pointing elsewhere. That is pinned today by ignored_strict_tools_still_require_compiler_admissible_schemas (request.rs:704-769). The page currently reads as if an unselected strict tool is inert; it can fail the request. Fix: one clause stating that every declared strict: true schema must be admissible even when its tool is not selected.

S2 — docs/api.md:605-612 says all large bounds are accepted-and-rounded; some are refused. Admission accepts any finite as_f64 bound (strict.rs:575-584) and hands the schema verbatim to llguidance = 1.9.1 (strict.rs:144; helios/Cargo.toml:62). yatesdr's verified table on main at 6d6fe0c6 (PR review 2026-11-23 15:04) 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 — i.e. HTTP 400, which api.md:644-645 covers only obliquely. i64::MIN is exactly what generated int64 schemas emit, so a client reading the new advice ("keep the bound, validate in the tool") has no way to know that class is a hard rejection. The paragraph must distinguish "rounded" from "refused".

S3 — The unresolved leniency is not recorded where the repository requires it. AGENTS.md:52-55: "Record unresolved defects, unrun checks, and pending measurements in [docs/TODO.txt], not in design documents." I searched docs/TODO.txt for 9007199254740, 2^53, binary64, llguidance and strict; the only hit is docs/TODO.txt:25-28 (qualifying strict: true on TMLv0 cores). There is no entry with an owner and a removal criterion for "strict integer grammars can admit values the schema forbids above 2^53". Keep the api.md paragraph, add the TODO.

S4 — The two documented rounding outcomes are asserted nowhere in the repository. The added test covers only the maximum side, which is the case the docs present as exact; minimum: 9007199254740993 admitting 9007199254740992 and exclusiveMinimum: 9007199254740992 admitting the endpoint rest solely on the reviewer's scratch run. Against a pinned =1.9.1 dependency, a future bump can make docs/api.md silently false (or over-claim a limitation that was fixed) with no failing test. Extend the new test with those two schemas asserting the documented outcome, or say in the TODO why asserting wrong-but-current behaviour is judged acceptable.

Lower-severity, decide without blocking a test decision: the new test partly duplicates strict_bounds_do_not_round_integers_or_fractional_multiples (strict.rs:3005-3016, which already pins maximum: 9007199254740992 accepted / ...993 rejected) — folding the new endpoints into that test's data removes the second owner of the same property; docs/api.md:610-611's reassuring inclusive-maximum sentence is true only for that representable value and, per the Value Proposition lens's reading of llguidance's normalize_integer_bounds, is misleading for e.g. maximum: 9007199254740995; :600-603 drops the "IEEE 754" qualifier and the explicit accepted integer interval that the removed sentence carried; :607 runs to 86 columns. "Active" is now load-bearing at :545 and is defined nowhere on the page.

4. Security / injection screen

Clean, and independently confirmed. The diff contains no imperative addressed to automation, no new external URLs, no HTML/script, no fetch/execute directive. The only agent-addressed text anywhere in the thread is the flare-autobot case-file comment (2026-11-24 18:32), a bot pointer with an opt-out line; it asks nothing of the code and was not followed.

5. Test plan

Recommended: none on hardware. If this PR is nonetheless routed to a test engineer, the only acceptable scope is the CPU unit-test run below — it should not consume a GPU allocation:

cargo test --release --locked --manifest-path helios/Cargo.toml \
  -p flare-helios --lib --features server,runtime-core grammar::strict::tests::

Run once on cn7 (arm64, 1× GB10) to match the reviewer's aarch64 platform and to confirm the author's x86_64-only result is not platform-specific; no GPU, no model load, no served request. Expected: 29 tests, 28 passed, 1 ignored (strict.rs:4355, DeepSeek snapshot). If S4 is fixed first, expect the added rounding assertions to pass — and if they fail, the docs must be rewritten to match llguidance's actual behaviour, which is exactly the signal the test exists to give. cn5 is not needed for anything in this PR; do not allocate it.

Re-test trigger. Refer this PR to a test engineer only if a later commit starts touching helios/src/grammar/strict.rs outside mod tests, helios/src/server/request.rs, or the llguidance pin — that would be a genuine admission/decoding change (a strict-schema 400 surface), and then a served-request check of strict tool admission under tool_choice: none/named/required on cn7 would be worth ~15 minutes. As it stands, the PR cannot fail on hardware in any way the CPU suite does not already catch.

6. Expected value if the PR is fixed and merged

Moderate and documentation-only: the API reference stops asserting two falsehoods (selection constrains decoding; every large numeric bound is a hard limit) and names where strict enforcement actually ends, which matters for agent/tool-loop clients emitting int64 bounds. Zero runtime risk (no code change), small scope, and it closes the maintainer-offered alternative from the #418 review. Value is destroyed, not created, if it ships with S1/S2 as written, because a client would then believe an unselected strict tool cannot 400 and that every large bound is merely imprecise.

Full report · Notes Decision to Test: no (100%): Testing will not add much value

code review summary

Changes Requested

Blockers:

Should fix:

Nits:

9 nits

Full report · Notes

Apply Labels

Applied: +triage:review, +documentation, +area:api

Classification Confidence

Threshold: 65%

Triage

Priority

Type

Area

Model