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
- The new selection/required sentences understate admission. Grammar attachment is selection-scoped, but schema admissibility is not:
compile_strict_validators(helios/src/server/request.rs:94) filters everytool.strictwith notool_choiceterm and runs unconditionally (request.rs:125), so an unselected strict tool with a bad schema still returns HTTP 400. The new text never says so (should fix 1). - The paragraph's advice is wrong for some bounds. Per yatesdr's table on this PR,
minimum: -9223372036854775808onintegerandminimum: 2^60onnumberare already refused with a range error — an HTTP 400 perapi.md:644-645— so "validate the tool arguments with exact arithmetic before executing the tool" cannot apply to them (should fix 4). - A known defect is documented without the required TODO record.
api.md:605-612states a live deviation anddocs/TODO.txthas no entry (AGENTS.md:47-55) (should fix 2). - The documented rounding examples are asserted nowhere. The added test covers only the exact inclusive-
maximumcase; llguidance is pinned at=1.9.1, so the prose can silently go stale (should fix 3). - No blockers: the change is authorized by the reviewer's own documentation alternative, sits in the delegated document, adds no flag or per-model branch, and its numeric prose matches the code.
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
- Fold the new test into the existing one, or place it beside it.
strict.rs:3888-3898vsstrict.rs:3005-3025:strict_bounds_do_not_round_integers_or_fractional_multiplesalready asserts that inclusivemaximum: 9007199254740992accepts the endpoint and rejects9007199254740993(:3008-3016). Of the new loop values,10^18 = 5^18·2^18is exactly representable in binary64 and adds no rounding case; onlyi64::MAX(2^63−1, rounds to2^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). - 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 atapi.md:600-603says only "parsed at binary64 precision … magnitude strictly below2^53", andIEEEnow appears nowhere underdocs/(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. - Rewrap
api.md:607(86 columns where neighbours wrap at ~78-80) and pick one separator convention — the new literals are unseparated whileapi.md:815uses5,000/20,000. Unseparated is defensible inside copyable code spans; the wrap needs fixing either way. - 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 asbound + 1, which nothing in this repository shows. Remove it or cite where exclusive-bound handling lives (docs/design-review.md:134-149rejects unsupported claims in changed prose). - Define "active" once.
api.md:545,:614,:639and:644all lean on "activestrict: truefunction"/"active strict tool" and the page never defines it; in code it means post-tool_choicefiltering (request.rs:225-241) plus tools being enabled. Define it at first use near:545, which the change newly makes load-bearing. - 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. - 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 activestrict: truefunction still attaches the strict request grammar described below". - 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
mainacquire 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-97wants the claimed result precise, distinguishable from measurement, and stated before the evidence. - Commit subjects. Head commit
e831b496"Preserve admission for large strict numeric bounds" describes the branch against its own parenta640a302, not against merge base6b586398— 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 ona640a302is 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-proseSKILL.md:40-43). - Low / maintainer preference:
api.md:610-611("An inclusivemaximum: 9007199254740992does 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 above2^53would refuse exact maxima — so keeping it is defensible.
Checked and cleared (not findings)
- Scope and authorization. yatesdr offered two routes (refuse only the rounded bounds, or document the limit) and the author took the documentation route (
PR #461review 2026-11-23 15:04 and reply 15:29).AGENTS.md:160-164accepts inaccurate documentation; the charter's "What gets merged" includes "bad docs". No new API surface, flag, configuration switch or per-model branch (AGENTS.md:166-176,:183-188). - Right document.
docs/core-design.md:1684delegates the accepted strict schema subset and protocol mappings todocs/api.md. - Numeric prose matches the code. The
2^53magnitude gate applies only to numericconst/enum(strict.rs:176-192); the four range keywords only need a finiteas_f64(strict.rs:575-584) and are handed to llguidance verbatim. - Dropping the digit separators and the spelled-out interval was a genuine simplification; do not revert it wholesale (only restore the standard's name, nit 2).
- Client-side validation advice (
api.md:611-612) is a client obligation in the API reference, not a runtime policy change (docs/design-review.md:122-133). - No GPU validation needed. Documentation changes do not require GPU tests (
design-review.md:161-163), and the description declines any performance claim, satisfyingdesign-review.md:94-102. The Discord line is present ("Discord: jcartu"), and the description follows the four-part scheme ofdesign-review.md:134-147. endpoint + 1fori64::MAXis2^63, insideu64, and serializes as a JSON integer — no overflow in the fixture.- Test boilerplate (
GrammarCompiler::new(&byte_tokenizer(), 320, &[256,257], &[])) matches ~25 tests in this module; no new helper needed. - Bot noise. The one
flare-autobotcomment (2026-11-24 18:32, case-file link with an#autobot:ignoreopt-out) asks nothing of the code and contains no instruction aimed at the change; it was not followed. No prompt-injection attempt found in the PR text.
Open questions / could not be found
- Does the maintainer accept documenting the rounding rather than refusing those bounds? Only yatesdr can confirm that the outstanding changes-requested state is satisfied; the review offered both routes and the author chose documentation.
- Does
exclusiveMaximumabove2^53round the same way? It appears nowhere in the repository and is absent from the reviewer's table; a test would settle whether the prose must name it. - What happens for a
number(non-integer) property whose bound sits above2^53? Unverified here; the paragraph is written forintegerproperties though its last sentences are generic. - Commit bodies of
a640a302/e831b496are not readable with the review tools; nit 9's provenance point rests on the reviewer's verbatim quotation.