Explore scratchpad · NVIDIA/hyperflare-inference #514

Raw Markdown for agents: https://autobot.eidonix.com/p/00348f63-43b5-4654-a3be-ac6573fc80d0.md

#1 [high] The change: LENIENT_EOS_CLOSE trait const + GLM EOS recovery

PR #514 (jannerchang, open, ready for review, opened 2026-11-25, head 732b868, base main @ 2771618, +61/-0, 2 files, no reviews, no CI checks). Diff (pr_diff, result 2):

  1. helios/src/output/tagged.rs: adds const LENIENT_EOS_CLOSE: bool = false; to trait ToolDialect (default false, doc comment lines 38-40), and in TaggedTools::finish (tagged.rs:293-331) inserts before the unconditional error: if cause == Termination::Eos && D::LENIENT_EOS_CLOSE { let raw = std::mem::take(&mut self.buffer); if let Ok(calls) = D::parse(&raw, &self.tools) && !calls.is_empty() { return Ok(<ToolBegin/ToolArguments/ToolEnd triples, index = self.index + offset>); } } then falls through to Err(format!("incomplete {} tool call", D::NAME).into()) (unchanged line 330).
  2. helios/src/output/argument_tags.rs:29 adds const LENIENT_EOS_CLOSE: bool = true; to impl ToolDialect for ArgumentTags (GLM).
  3. helios/src/output/argument_tags.rs:346-376 new test unclosed_glm_tool_call_at_eos_emits_parsed_call: pushes </think><tool_call>run<arg_key>text</arg_key><arg_value>ok</arg_value>, finish(Eos), asserts one call run with {"text":"ok"}; second half asserts <tool_call> (empty name) still errors. Size/scope: 61 added lines, 0 removed; no doc change, no package/format change, no config/default change. It does NOT touch chatml.rs, dsml.rs, xtml.rs, minimax_xml.rs, gemma_call.rs — those keep false. Note the new code path duplicates the event-construction block that already exists in TaggedTools::push (tagged.rs:269-287) — same flat_map/enumerate/index+offset shape.

#3 [high] The why: problem statement, linked issues, how long wanted

Claimed problem (PR #514 description): with GLM models (e.g. GLM-5.3-Flash), multi-turn tool calling occasionally produces a complete <tool_call>name<arg_key>..</arg_key><arg_value>..</arg_value> then EOS without </tool_call>; TaggedTools::finish unconditionally errors with "incomplete GLM tool call", aborting the stream. Evidence offered in the PR: NO reproduction, no captured stream, no model/log, no frequency, no before/after count. Only a unit test with hand-written text. This contrasts with the repo charter ("Bug fixes need to address the root cause… Bring real evidence") and with how comparable PRs document live evidence (e.g. #67 had captured Qwen streams; #133 had measured frequencies). Earlier traces of the same symptom class (found in the orientation leads):

#4 [high] Claims and evidence: test claim verified in shape but not run here; CI absent

PR "Verification" section claims: cargo test --manifest-path helios/Cargo.toml --features runtime-core,server --lib -- output::argument_tags:: output::chatml:: on main (2771618): 24 passed, 0 failed, including unclosed_glm_tool_call_at_eos_emits_parsed_call, malformed_calls_fail, and chatml::tests::terminal_cause_preserves_incomplete_call_errors_and_never_fabricates_calls. Observations:

#5 [high] The change: what the lenient branch actually accepts, strict-path interaction, docs left unchanged

Verified by reading the code at PR head 732b868 (results 3, 28, 29, 60, 76, 90; argument_tags.rs:24-118):

#6 [high] Related work: #418/#67/#179/#59/#228/#102 overlap and the reversal of #67's EOS rule

Related items found via related_items(514) (result 67) and items_touching(tagged.rs) (result 68):

#7 [high] People and community: new outside contributor, no engagement, parser area owned by mark-yong/jcartu/yatesdr

Facts gathered:

#8 [high] Project fit: charter evidence rule, model-agnostic rule, docs rule, and #228 as leniency precedent

From read_charter (result 65) and AGENTS.md (results 63, 64):

#9 [high] Reach: GLM-only, compiled-in, no flag; client-visible finish_reason and required-tool-choice changes

Reach of PR #514:

#11 [high] Research summary

Case file for PR #514 (helios: allow lenient EOS close for GLM argument-tag tool calls) is assembled in the scratchpad, with every angle covered and every orientation lead followed.

What the change is: a default-false const LENIENT_EOS_CLOSE: bool on ToolDialect (tagged.rs:38-40), enabled only for GLM's ArgumentTags (argument_tags.rs:29), plus a branch in TaggedTools::finish (tagged.rs:304-329) that on Termination::Eos retries D::parse on the buffered body and returns ToolBegin/ToolArguments/ToolEnd if it parses non-empty, otherwise falling through to the unchanged incomplete {NAME} tool call error. One unit test. 61 added lines, 2 files, no deletions, no docs, no config surface.

Findings a reader could not get from the description: (1) the behavior being changed is documented in docs/api.md:441-444 and :501-502 and was called a deliberate maintainer policy decision in #133's thread (99cfcd5be, pinned by output_limits_allow_incomplete_tools_but_eos_rejects_them), and #67 explicitly kept truncated calls failing at EOS — so this partially reverses that rule for GLM, with no doc edit; (2) the evidence is a hand-written unit test only — no captured GLM stream, no frequency, no before/after, against a charter that demands root-cause evidence for bug fixes; (3) for strict: true GLM tools the failure mode changes from an incomplete-call error to either success or a TextGrammar::validate error, because recovered events bypass OutputEncoder::pending_strict_calls; (4) the closest prior work is #418 (merged 3 days earlier), which deliberately tightened GLM EOS handling, plus #59 (open, stale, same two files) and #179; (5) zero reviews, zero comments, no labels, no CI on the head, author has no merged PRs and no repo association.

Angles with entries: the change (what it accepts, strict interaction, docs), the why (problem claim, prior reports #67/#133, undocumented), related work, recent activity (last touches to argument_tags.rs; nothing on main since branch point), people/community, project fit (charter, AGENTS.md rules, #228 precedent), claims and evidence, reach (GLM recipes only; finish_reason and required-tool-choice changes), process.

#13 [high] Claims and evidence: existing EOS-error tests per dialect; no GLM test pinned the flipped case

Tests elsewhere in the tree that pin the EOS-error contract, and what #514 does to each (all traced by reading, none run):

#14 [high] The change: description-vs-diff audit (nothing claimed missing; consequences undeclared)

Checking the PR description against the diff (pr_diff result 2) item by item: Description says → diff does:

#2 [medium] The change: buffer-drain detail and the skip-change mismatch

Reading the surrounding code (result 3, 4, 28, 29):

#10 [medium] Process: ready-for-review, unlabeled, unreviewed, no CI, <1 day old

Process facts for PR #514 (orientation packet + pr_comments result 1):

#12 [medium] Recent activity: GLM parser changed 4x in 6 weeks, #514 stacks on #418, main quiet in these files

Facts for the "recent activity" angle (search_history results 34, 61; orientation packet):