PR #637: Bound synthesized tool-call IDs to 37 characters across HTTP protocols

Raw Markdown for agents: https://autobot.eidonix.com/api/v1/cases/aeb3d580-055d-40a3-961f-8ffee81188c1

Opened by a workflow run, Nov 30, 2026 7:00 AM EST. decide malicious: all_clear (100%): No malicious content found

explore

Author: flare-autobot (COLLABORATOR bot account; commit d150811 authored by derek); Discord: flare-autobot Motivation: Tool-call IDs that Flare invents (because no native parser supplies one) were built by concatenating the request ID, which grows with a monotonic counter, so after ~100,000 requests they passed OpenAI's 40-character limit and OpenAI/Azure rejected replay. The PR replaces that concatenation with a fixed 37-character SHA-256-derived ID. Scale: +881 / −7 in 3 files Proposal:

Touches:

Related items:

Link: https://github.com/NVIDIA/hyperflare-inference/pull/637 Autobot comments: CI is failed on head d150811 while the description reports 1803/245/227 passing suites on aarch64 only; x86_64 and Windows were never run locally, so the failure's cause is unknown and unexplained. The 40-character OpenAI/Azure limit — now asserted as fact in docs/api.md:448 and in a code comment at output.rs:17-19 — is backed only by issue #447's third-party LiteLLM link; maintainer yatesdr had asked for that client contract to be established first. Undeclared: tool-call IDs become opaque (previously the request ID was readable from them), the close()/apply() reordering changes error-path behaviour beyond ID formatting, and Responses item.id (encode.rs:268-270) is left unbounded despite the description's "<= 54 characters" claim whose arithmetic does not follow. The PR never cites #176, the merged change whose uniqueness intent it preserves. Zero reviews, zero comments, opened and last updated in the same minute; no duplicate or competing fix exists.

Full report · Notes

Classify intake

Selected: triage:review, bug, area:api

Threshold: 65%

Triage

Priority

Type

Area

Model

Apply Labels (Intake)

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

Value Proposition

Value Proposition — PR #637 "Bound synthesized tool-call IDs to 37 characters"

Charter alignment. The code lives where the charter wants it: in the shared Helios HTTP/protocol layer (helios/src/server/output.rs), with no per-model branch, no parser edit, no new flag, no config default, no Cargo.toml change, and no touch to cores/protobuf/contracts. It fixes length at generation rather than truncating at output, matching "address the root cause." The PR description meets the four-part evidence standard plus a limitations section — above repo norm. The tension is the motivating scenario: a long-running, multi-provider Flare server replayed through OpenAI/Azure reads like the "general-purpose production server" non-goal.

Novelty & status. Neither obsolete nor superseded. The format!("call_{}_{}", self.id, index) concatenation is still on main; no competing fix for #447 exists. #176 (cc696a6b, merged) created the {prefix}-{run:016x}-{seq} format that #637 hashes; #637 preserves #176's cross-restart uniqueness intent rather than undoing it — though it never cites #176. It is genuinely additive.

Value vs maintenance cost. Beneficiaries are narrow: operators past ~100k requests. Evidence for the 40-character contract is second-hand only (a LiteLLM issue cited in #447), and maintainer yatesdr stated on #447 that "the client contract this should meet is not established yet." #637 doesn't answer him; it promotes the unverified limit to a published guarantee at docs/api.md:448 and in a code comment. Countervailing weaknesses: CI is red on head d1508112 while the body claims 1803/245/227 green (x86_64/Windows never run locally); the change silently makes IDs opaque and alters error-path semantics (output.rs:1714-1723, 1764-1789) — more than ID formatting; the sibling item.id (encode.rs:268-270) stays unbounded despite the unsupported "<= 54 characters" claim; "injective" and "full 64-bit entropy" overstate a 128-bit truncated digest; 454 test lines for a two-line formatting fix; likely textual conflict with #638 in docs/api.md and protocol/tests.rs.

Verdict: Worth it with changes. Conditions: (1) establish or drop the 40-character contract — cite a spec/live rejection or reframe the docs as robustness rather than an external requirement; (2) explain and fix red CI, including the x86_64/Windows legs; (3) declare the opaque-ID consequence and split the state-machine reorder out of the ID-formatting change; (4) bound item.id or remove the unsupported <= 54 claim. The length hardening itself is cheap and low-risk; the unverified contract and process gaps are what cost.

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

Subtraction and simplicity

The production half of PR #637 is already lean: one helper (synthesize_tool_call_id, output.rs:31-49), two call sites (:101, :1768), no new flags, config knobs, env switches, wrappers, fallback branches or dependencies (sha2 was already gated at helios/Cargo.toml:147-149), and the 4-line close() reordering (:1714-1723) fixes a real partial mutation rather than over-building. The removable weight is elsewhere.

Top deletions: (1) MAX_SYNTHESIZED_TOOL_CALL_ID_LEN (output.rs:20) has no production consumer — only the compile-time assert!(37 <= 40) (:22), a debug_assert (:47) and a test line (:1298) — so delete it with the assert; and its 40 is exactly the unestablished external limit yatesdr objected to in #447. (2) The two test helpers assert_synthesized_tool_call_id (output.rs:1296-1308) and assert_synthesized_protocol_tool_call_id (protocol/tests.rs:2666-2682) are the same function duplicated, the second hardcoding 37/40 magic numbers; the output.rs test module is already pub(crate) (:503-504) and imported cross-module, so one shared helper is the convention. (3) Three assertions re-call the pure function under test with the same arguments (output.rs:1348, :1378, :1437) and assert nothing. (4) ~880 lines of tests in two modules rebuild the same seq/choice/128-call matrix; trim the output.rs copy, keep protocol/tests.rs and the genuinely new error-path test (:1488-1671). (5) docs/api.md:443-451 publishes the unreferenced 40-character limit as fact plus internal hash inputs — an AGENTS.md prose/scope violation; document only observable behaviour. Optional: use the repo's existing hex() idiom (runtime_core/protection.rs:174-176) instead of the let _ = write! loop. Not simplifications: the Responses item_id bound (encode.rs:269) is a correctness-lens item, and close() reordering should stay.

Full report · Notes

Correctness and contracts

PR #637 is mechanically sound and correctly placed — one SHA-256 per synthesized tool call, off the token loop, no locks/shared state/buffering, and the close() reorder genuinely fixes partial state mutation. The problems are contract and claim accuracy, not concurrency or memory.

Findings:

Open: why CI failed; whether the 40-char limit is real and whose; whether truncating #176's run-embedded uniqueness to 128 bits was ever accepted (the PR never cites #176); whether item_id should be bounded too.

Full report · Notes

Final review

Recommendation: Changes Requested

The core implementation in helios/src/server/output.rs is clean, portable, and low-risk: hashing (scope_id, index) with domain-separated, length-delimited SHA-256 into a fixed 37-character call_<32 lowercase hex> ID eliminates unbounded counter growth without affecting hot-path decoding, concurrency, memory budgets, or model core compatibility, and the ResponseOutput::apply/close reorder fixes a genuine partial-mutation bug. However, two issues block merging as-is: CI (native-serving.yml) is currently failing on head d150811 with no explanation while x86_64 Linux and windows-2022 were not run locally, and the PR promotes unverified provider length maxima (40/64 chars) and internal hash inputs into the published API contract (docs/api.md:443-451, helios/src/server/output.rs:17-19) without resolving maintainer yatesdr's standing contract question on #447.

Merge Risk

Level: Low

Walkthrough

Pre-merge Checks

Blockers

  1. Unexplained CI failure on head d150811 (.github/workflows/native-serving.yml:18-21 (not opened), 56-77): CI is currently failing on head d150811, while the PR description only reports local Linux aarch64 test runs and explicitly notes that x86_64 Linux (ubuntu-24.04) and Windows (windows-2022) builds were not executed locally. Per docs/design-review.md:180-184, 247-251, runnable CPU checks across the native-serving workflow cannot be waived by disclosure alone.
    • Fix: Inspect the failing GitHub Actions run on d150811, fix any failure introduced by this branch, or—if caused by an unrelated runner/infra flake—re-run CI to green and note the root cause in the PR description.

Should Fix

  1. Unverified external provider length contract and internal hash details published as API specification (docs/api.md:443-451, helios/src/server/output.rs:17-19): On #447, maintainer yatesdr specifically noted that "Flare documents no length limit, and the only limit cited is a third-party report of Azure OpenAI rejecting 41 characters, so the client contract this should meet is not established yet." This PR does not supply a primary OpenAI/Anthropic schema reference or live rejection capture, yet asserts the 40-character Chat Completions limit and 64-character Responses/Messages limits as fact in docs/api.md:448-450 and helios/src/server/output.rs:17-19, exceeding the stated evidence (.agents/skills/repo-prose/SKILL.md:52-53 (not opened)). In addition, docs/api.md:445-448 publishes internal hash derivation inputs (per-server-start run ID, monotonic counter, choice index, call index), unnecessarily locking internal implementation details into the external API contract.
    • Fix: Either attach primary API documentation / live rejection evidence establishing the external limits and obtain maintainer confirmation on #447, or trim docs/api.md:443-451 to state only Helios's observable guarantee—for example: "When a model output parser supplies no tool-call identifier, Helios synthesizes a fixed 37-character ASCII identifier (call_ followed by 32 lowercase hexadecimal digits) that is unique within a response and identical between buffered and streamed outputs."—and remove the unverified 40/64 provider-limit claims from helios/src/server/output.rs:17-19.

Subtract / Simplify

  1. Remove the unused MAX_SYNTHESIZED_TOOL_CALL_ID_LEN constant, tautological compile-time assert, and redundant debug_assert! (helios/src/server/output.rs:17-22, 46-47): MAX_SYNTHESIZED_TOOL_CALL_ID_LEN = 40 has no production callers beyond const _: () = assert!(37 <= 40) and debug_assert!(id.len() <= 40) (strictly implied by debug_assert_eq!(id.len(), 37) on the previous line). Delete lines 17–20, 22, and 47 (keeping const SYNTHESIZED_TOOL_CALL_ID_LEN: usize = 37; and line 46), which also removes the unverified provider-limits comment.
  2. Deduplicate the synthesized-ID assertion helper (helios/src/server/output.rs:1296-1308 vs helios/src/server/protocol/tests.rs:2666-2682): Both files define nearly identical assert_synthesized_*_tool_call_id helpers, with protocol/tests.rs hardcoding 37 and 40. helios/src/server/output.rs:503-504 is already #[cfg(test)] pub(crate) mod tests and already imported across modules (helios/src/server/logprobs.rs:233 (not opened), helios/src/server/stops.rs:476 (not opened)). Make assert_synthesized_tool_call_id pub(crate), delete the duplicate in protocol/tests.rs, and drop the redundant alphabet/length sub-assertions inside it (stripping "call_" and checking 32 lowercase hex bytes already implies length 37 and [a-zA-Z0-9_-]+).
  3. Trim duplicated test matrix in helios/src/server/output.rs:1311-1486: synthesized_tool_call_ids_are_bounded_deterministic_and_distinct (176 lines) repeats the same seq × run × choice sweep and a 128-call loop that helios/src/server/protocol/tests.rs:2684-2975 already tests end-to-end through Encoder. Keep the protocol-level test and response_output_rejects_invalid_tool_begin_and_unclosed_close_without_partial_mutation (output.rs:1488-1671), and reduce output.rs:1311-1486 to focused unit checks (suffix-concatenation disambiguation, explicit-ID passthrough, and a single Accumulator/ResponseOutput parity check).

Nits

Dropped on verification

Full report Decision to Test: no (100%): 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

Apply labels

No label changes