PR #514: helios: allow lenient EOS close for GLM argument-tag tool calls

Raw Markdown for agents: https://autobot.eidonix.com/api/v1/cases/25cadfaf-b4bc-42e0-adf7-f4d65893d07d

Opened by a workflow run, Nov 25, 2026 6:31 AM EST.

screen malicious

Screen Result: All Clear

Evidence: PR #514 ("helios: allow lenient EOS close for GLM argument-tag tool calls", head 732b868, base main, +61/−0, 2 files) contains no prompt injection or other attempt to steer agentic behavior. The diff is exactly two source hunks: helios/src/output/tagged.rs adds a defaulted trait const const LENIENT_EOS_CLOSE: bool = false; (tagged.rs:40) and a branch in TaggedTools::finish (tagged.rs:304–329) that, only on Termination::Eos and only when a dialect opts in, re-parses the already-buffered body with the existing D::parse and emits ToolBegin/ToolArguments/ToolEnd; otherwise it falls through to the unchanged incomplete {NAME} tool call error (tagged.rs:330). helios/src/output/argument_tags.rs:29 sets the flag to true only for the GLM ArgumentTags dialect and adds one unit test. A repo-wide search for LENIENT_EOS_CLOSE returns exactly three hits, so no other dialect opts in, and the pre-existing early return for Cancelled/ExecutionError/UserStop/OutputLimit (tagged.rs:294–303) is untouched. No new files, dependencies, CI/workflow, build scripts, or tooling changes appear in the PR. Neither the diff, the description, nor the discussion (0 comments, 0 reviews) contains natural-language instructions addressed to an agent or reviewer, and grepping both changed files for instruction-like and capability-escalating terms (agent/instruction/ignore/todo/fixme/secret/http/curl/exec/Command/fs::/unsafe/process) produced no suspicious matches. No network, filesystem, process-spawn, credential, or prompt/system-message behavior is introduced, and there are no hidden or obfuscated blobs.

Reviewer-facing note, not a security finding: by design, a truncated GLM generation whose arg-tag body is already complete will now execute the tool instead of failing the response. It is confined to GLM, cannot fabricate arguments the model did not emit (strict parse still requires closed <arg_key>/<arg_value> tags, argument_tags.rs:52–89), and matches the stated purpose. The author (jannerchang, repo association NONE, 0 merged items) has two other open PRs (#513, #397); #514 has no CI checks, so its "24 passed" verification claim is unverified by me. Related GLM parser work (#59 open, #39/#133 closed issues, #418/#405/#67 merged) suggests a possible sequencing overlap with #59 for maintainers to resolve.

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

explore

Author: jannerchang (outside contributor; GitHub association with the repo: NONE; no Discord handle given in the PR) Motivation: GLM models (e.g. GLM-5.3-Flash) sometimes finish a tool call's arguments and then stop generating (EOS) without writing the closing </tool_call> tag. Today the parser treats that as an incomplete call and aborts the whole stream, so the turn dies instead of returning the call the model had effectively finished. This PR lets the GLM dialect accept such a call at EOS if its body still parses. Scale: +61 / −0 lines in 2 files (helios/src/output/tagged.rs, helios/src/output/argument_tags.rs) Proposal:

Full report · Notes

Value Proposition

Verdict: Not worth it (would need a maintainer policy decision and a rewrite before any merge)

The stated problem is real in principle — GLM can emit a complete argument-tag call and then hit EOS without </tool_call> — but this PR is the wrong fix, in the wrong layer, and it breaks a deliberately pinned behavior.

1. It breaks an existing test, and fabricates a tool call from prose

The load-bearing finding. glm_prose_may_mention_the_tool_call_tag (helios/src/grammar/strict.rs:3594-3721) builds a GLM OutputConfig with tools weather and lookup (:3613-3616) and then calls compile_presented_strict_tools(..., Some(&mut out_cfg.content)) (:3637-3639). That function mutates the presentation config: function["strict"] = Value::Bool(true) for every tool with a strict schema (strict.rs:1441-1449). Both tools have strict schemas.

It then asserts assert_unfinished_at_eos(&out_cfg, "Avoid <tool_call>weather") (:3669, helper at :3343-3348, i.e. finish(Eos) must be Err). Trace under this PR:

So the model's answer text "Avoid <tool_call>weather" becomes a synthesized zero-argument weather tool call that the model never made, discarding the prose. That parse returns {} for a bare name is not speculative — the existing test at argument_tags.rs:170-201 asserts exactly calls[1]["function"]["arguments"] == "{}". The client then gets finish_reason: "tool_calls" (encode.rs:622-628) and executes a tool nobody asked for. This is precisely the "never fabricate calls" property that chatml::tests::terminal_cause_preserves_incomplete_call_errors_and_never_fabricates_calls (chatml.rs:855-887) guards for the sibling dialect.

Why the PR's verification missed it: the claimed command filters to -- output::argument_tags:: output::chatml::, which excludes grammar::strict::tests even though grammar is enabled transitively by server (helios/Cargo.toml:25). The posted "24 passed" is true but does not cover the affected area, so the PR description's evidence does not support the merge claim under the charter's "bring real evidence" rule.

2. It reverses a deliberate, documented, maintainer-level decision

3. It conflicts with the charter's architectural rule

The charter's Code Review Standards say: "No per-model special cases or flags: Keep shared runtime layers general rather than adding model-specific branches or flags." const LENIENT_EOS_CLOSE is a per-dialect policy flag on the shared ToolDialect trait, set true only for GLM (argument_tags.rs:29). Unlike the existing trait consts (OPEN, CLOSE, FUNCTION, TRIM_NEWLINES, TOOL_ENDS_REASONING), which all describe model syntax, this one describes error policy. The result is that byte-identical malformed output yields finish_reason: "tool_calls" on GLM and a terminal stream error on Qwen, DSML, and XTML — a model-dependent API contract, undocumented. That is the "good idea in the wrong place" the charter declines (#404).

4. Who benefits, how much, and the evidence

Little, and it is unquantified.

5. Cost

Small in lines (~60) and zero in steady-state performance (finish-path only, no decode/grammar cost). But the maintenance and risk cost is disproportionate: a new cross-cutting policy axis on the shared trait, a divergence in API semantics across dialects, docs that now lie, and one broken strict-mode test plus whatever else the author's narrower filter did not run. The self.calls index is also not advanced by the new branch (tagged.rs:304-329 vs the push path at :269-292), which is latent-index-fragile even though it is currently masked by GLM's single-call-per-<tool_call> shape.

6. Simpler ways to the same end

  1. If this is a real defect, fix the root cause where the data is: capture the failing GLM output and show the frequency on a clean export (post-#129). #133's evidence suggests the observed truncation was the corrupt graph, not the model.
  2. If the model genuinely truncates, fix it at generation, not presentation: the closing tag is in the template/grammar domain (Ignition recipe or strict wire grammar). That is model-agnostic and needs no runtime flag.
  3. If it truly must be presentation-level leniency, make it general and documented: apply it to all dialects, gate it on an explicit request/server option, update docs/api.md:444, and — critically — require that a bare or empty-body envelope with no <arg_key> is rejected, so prose and bare function names can never become {} calls. That last constraint alone would fix the regression in §1 without touching the rest.

What would change the verdict

As written, this PR duplicates an intentional behavior, violates the no-per-model-flags standard, contradicts docs/api.md, and introduces a silent tool-call-fabrication path. Not worth merging. If a priority contributor asks for it, the review to send is: rebase the leniency into a general, documented mechanism, reject empty-body envelopes, and run the full runtime-core,server library suite including grammar::strict::tests.

Full report · Notes Decide Value: no (97%): It is low value or does not align with the project charter. Bypass Low Value Review: No answer in time.

This PR was identified as low value for the following reason.

It is low value or does not align with the project charter. Decision Summary

The auto-reviewer was stopped, but can be re-started manually.

Click "Approve" to override this decision and continue the code review