Recommendation: Changes Requested
Commit 826a427 resolves every technical, protocol, documentation, and test-churn issue from Round 3: truncated Responses custom tool calls now close cleanly as incomplete with empty input instead of failing the request, abandoned function calls report status: "incomplete" across all non-EOS causes, docs/api.md accurately documents tool_choice: required/named failures and TAGGED_JSON-compatible tagged-parser behavior, and restoring Accumulator::finish(&self) shrank the diff from 15 files to 7. Direct verification found zero remaining code bugs or hot-path defects. The sole remaining blocker is the unresolved Round 3 governance gate (AGENTS.md:182-187, 201-207): the PR reverses #364's pre-publication 1 MiB / validation bound and main's non-EOS Err("incomplete emitted tool call") contract (along with their pinning tests and docs), and while the PR description now transparently asks @voipmonitor and @yatesdr to approve both changes, no maintainer decision is recorded on the PR yet. Once a maintainer signs off on both contract changes in the thread, no further code changes are required to merge.
Merge Risk
Level: Medium
- Unratified public-contract reversals:
DsmlOutput::applypublishesEvent::ToolBeginand argument fragments beforevalidate_argumentsand#364's 1 MiB bound (helios/src/output/dsml.rs:151-155, 191-205), anddrops_unfinished_callomits announced-but-unfinished calls onUserStop/Cancelled/ExecutionError(helios/src/server/output.rs:479-481, 1735-1748;helios/src/server/protocol/encode.rs:681-707), reversing two reviewedmaininvariants (docs/api.md:580-583, 600onmain,helios/tests/deepseek_output.rs:511onmain, anduser_stop_cannot_retract_an_already_emitted_partial_tool_call). - Prior protocol regressions and CI breakage resolved: Truncated Responses
customtool calls skip JSON/grammar validation and suppressresponse.custom_tool_call_input.{delta,done}(encode.rs:470-491, 511-514), abandoned Responses items reportstatus: "incomplete"across all non-EOS causes (encode.rs:687-707), Messages/Responses closing frames are emitted beforediscard_abandoned(), and thehelios/tests/integration suites pass on the updated contract. - No concurrency, memory, or hot-path regressions: All modified state is per-request (
helios/src/server/http.rs:358-400),Call::publishslices newly appended bytes within the 1 MiB buffer withpublished_argument_bytes <= literal_startpreserved acrossclose_literal,Encoder::applyfeeds one event at a time toAccumulator::apply(O(total bytes) total work), strict-tool parking (encode.rs:592-631) is untouched, andProtocol::Responsesis strictly single-choice (helios/src/server/protocol/decode.rs:835).
Walkthrough
- Incremental DSML publication (
helios/src/output/dsml.rs:38, 49-62, 151-155, 191-205): AnnouncesEvent::ToolBeginatToolNameEnd, tracksCall::published_argument_bytesand emitsEvent::ToolArgumentsfragments viaCall::publishafter eachToolCallArgumentsTextappend (keepingstring="false"literals unpublished untilclose_literalsettles them), and flushes trailing bytes plusEvent::ToolEndaftervalidate_arguments. - Non-EOS unfinished-call omission without
Accumulator::finishchurn (helios/src/server/output.rs:163-174, 479-481, 1707, 1735-1762): KeepsAccumulator::finish(&self)unchanged frommain, addsdiscard_unfinished_call(&mut self), addsdrops_unfinished_call(cause) -> cause != Termination::Eos, and exposesResponseOutput::is_abandoned(index)/discard_abandoned()so closing frames render before the truncated block is popped. - Abandoned-item and custom-tool handling in
Encoder(helios/src/server/protocol/encode.rs:470-491, 511-514, 681-707): Callsdiscard_unfinished_call()on Chat andResponseOutput::finish(cause)/discard_abandoned()on Messages/Responses, marks any abandoned Responses item asincompleteregardless of termination cause, skips JSON/grammar validation andcustom_tool_call_input.*frames for abandoned custom calls (emittinginput: ""), and clearsincomplete_itemafter discarding. - Tests & API docs (
helios/src/output/dsml.rs:750-1025,helios/src/server/protocol/tests.rs:56-87, 3844-4230,helios/tests/deepseek_{output,requests}.rs,docs/api.md:540-578): Adds folded truncation-matrix tests, truncated custom-tool and abandoned function-call tests,ToolChoice::Required | Namedfailure tests, UTF-8 split and literal-deferral tests, adaptsdeepseek_output.rs/deepseek_requests.rsfor streaming events, and updatesdocs/api.mdfor DSML streaming, custom-tool scoping, non-EOS omission,required/named failures, and post-publication 1 MiB enforcement.
Pre-merge Checks
- [PASS] Security / malicious screen: No unsafe code, external I/O, or instruction-hijacking patterns; 1 MiB parser (
helios/src/output/dsml.rs:22, 42-47, 234-236) and 8 MiB response (helios/src/server/output.rs:119-121, 1837-1839) bounds remain enforced. - [WARN] Charter & value fit: Directly serves the charter's coding-agent / heavy-tool-use vision with no per-model shared-layer branch and honest disclosure in the PR description, but reverses two reviewed
maininvariants (#364pre-publication bound and non-EOSincomplete emitted tool callerror) without the explicit maintainer sign-off required byAGENTS.md:182-187, 201-207. - [PASS] Related / duplicate / conflict check: No duplicate PR;
#670'sTAGGED_JSONsemantic mismatch indocs/api.md:540-547is fixed, and any rebase over#670is conflict-free;#364reversal is disclosed and tracked in Blocker #1. - [PASS] Tests & verification evidence: Full 15-target release
heliostest command (with1fbcc3c9baseline comparison explaining the 20 pre-existing environment failures),deepseek_output/deepseek_requests(15 passed each),flare(254 passed),flare-cli(245 passed), and live served parity probe are all reported on826a427.
Blockers
- Explicit maintainer sign-off still required for the two contract reversals and their accompanying test/doc rewrites (
AGENTS.md:182-187, 201-207;helios/src/output/dsml.rs:151-155, 191-205;helios/src/server/output.rs:479-481, 1269-1278, 1735-1748;helios/tests/deepseek_output.rs:515;docs/api.md:547-555, 574-576).- Verified behavior & impact: Both reversals remain active on
826a427and still have zero human maintainer comments or approvals in the PR thread:#364's pre-publication 1 MiB and key-validation guarantee (docs/api.md:600onmain, explicitly verified in@yatesdr's#364review and pinned byassert!(published.is_empty())athelios/tests/deepseek_output.rs:511onmain) is reversed soToolBeginand earlyToolArgumentsfragments publish beforevalidate_argumentsand before a subsequent append crosses 1 MiB, withdeepseek_output.rs:515weakened toassert_eq!(parsed.ended, 0, ...).main's non-EOSErr("incomplete emitted tool call")guarantee (helios/src/server/output.rs:165, 1728anduser_stop_cannot_retract_an_already_emitted_partial_tool_call) is replaced by silent omission viadrops_unfinished_call(cause) = cause != Termination::Eos(output.rs:479-481), renaming and inverting that regression test atoutput.rs:1269-1278.
- Under
AGENTS.md:182-187, 201-207, relaxing existing error/validation guarantees — including via accompanying test and doc updates — requires an explicit maintainer design decision on record before merging. - Fix: Obtain an explicit maintainer comment on this PR from
@voipmonitor/@yatesdr(or a repository maintainer) approving (a) post-publication validation and 1 MiB enforcement for streamed DSML calls and (b) non-EOS unfinished-call omission (vs restricting omission toOutputLimitor keeping the error). If approved as-is, no further code changes are needed.
- Verified behavior & impact: Both reversals remain active on
Should Fix
None.
Subtract / Simplify
- Have
Call::publishownself.check_size()?(helios/src/output/dsml.rs:53-62, 191-192, 201-203): ChangingCall::publishto returnResult<()>and callself.check_size()?before emitting makes the check-before-publish ordering structural in one place instead of repeating the two-line pair at:191-192and:201-203(keeping:218-220for non-publishing actions likeToolNameandLabelToolCallArguments). - Simplify the
custommatch inEncoder::changeandself.opencheck inResponseOutput::finish(helios/src/server/protocol/encode.rs:471-478;helios/src/server/output.rs:1737-1745):- In
encode.rs:471-478, matching&self.outputs[0].blocks[i]once avoids matchingBlock::Tooltwice to computecustomand then extractarguments. - In
output.rs:1737-1741,if drops_unfinished_call(cause) && let Some(last) = self.open && matches!(self.blocks[last], Block::Tool { ended: false, .. })usesself.opendirectly instead of re-derivingself.blocks.len() - 1viaself.blocks.last().
- In
- Disambiguate the remaining duplicate test name (
helios/src/output/dsml.rs:956vshelios/src/server/protocol/tests.rs:3960):a_truncated_second_call_keeps_the_completed_first_callstill exists verbatim in both files; prefixing the parser-layer test (e.g.,dsml_truncated_second_call_keeps_the_completed_first_call) keepscargo test <name>unambiguous.
Nits
docs/api.md:550-555line wrap & protocol clarity: Line 554 (...error event for streams. A client that received fragments...) is unwrapped relative to surrounding prose, and lines 550-551 ("The closing frame of such an item reports statusincomplete") describe Responses items specifically (Messagescontent_block_stopcarries nostatusfield and Chat has no per-call closing frame).- Custom-tool test cause matrix (
helios/src/server/protocol/tests.rs:4103):a_truncated_custom_call_closes_incomplete_without_failing_the_requesttestsOutputLimitandUserStop; addingTermination::CancelledandTermination::ExecutionErroraligns it withan_announced_call_is_omitted_when_the_response_truncates(:3846-3851).
Dropped on verification
- Code Correctness Finding 1 ("Major: O(N²) delta coalescing in
Accumulator::apply"): Dropped as a false positive. Verified athelios/src/server/output.rs:78thatlet mut deltas: Vec<Value> = Vec::new()is local to eachAccumulator::applycall (not persisted across tokens), and athelios/src/server/protocol/encode.rs:633-636that the sole production caller passesvec. The coalescing branch atoutput.rs:123-135never runs on the production Chat streaming path; total streaming work is O(total bytes). - Code Correctness Finding 2 ("Minor: Messages truncated call becomes a completed zero-argument
tool_useblock; omitcontent_block_stop"): Dropped as invalid. Suppressingcontent_block_stopaftercontent_block_startviolates Anthropic's SSE block-framing grammar and directly contradicts Round 1/2 Blocker #2; Anthropiccontent_block_stopcarries nostatusfield, andmessage_deltasignals truncation viastop_reason(max_tokens/stop_sequence/end_turnrather thantool_use,encode.rs:753-756, 833). - Subtraction Finding 1 ("cross-choice
incomplete_itembug acrossself.outputs+ replaceis_abandoned/discard_abandonedwithChange::End(usize, Outcome)"): Bug claim dropped as false positive, and refactor dropped to avoid moving-goalposts churn. Verified athelios/src/server/protocol/decode.rs:835(if protocol != Protocol::Completions && choices != 1) andencode.rs:348, 851thatProtocol::Responsesalways haschoices == 1(self.outputs.len() == 1), so no cross-choice interference is possible; furthermore,is_abandoned+discard_abandonedwas the exact API requested in Round 3 Subtract/Simplify #2. - Subtraction Finding 4 sub-claim ("
self.blocks.last()disagrees withself.openwhen an endedBlock::Toolis last andself.open == Some(text_block)"): Dropped as unreachable. Verified inResponseOutput::apply(helios/src/server/output.rs:1780-1864) that opening any block closes the previous block and pushes to the tail, andEvent::ToolEndimmediately setsself.open = None, soself.openis alwaysSome(self.blocks.len() - 1)when open. Kept only the cleanerself.openexpression under Subtract / Simplify #2. - Subtraction Finding 5 sub-claim ("
deepseek_output.rs:515should assert(parsed.began, parsed.ended) == (0, 0)"): Dropped as inconsistent with streaming. Under incremental DSML streaming,Event::ToolBeginis emitted atToolNameEndbefore duplicate/empty keys are parsed, soparsed.beganis necessarily1; the governance requirement for that contract change is tracked in Blocker #1. - Unobservable CI status and minor PR-description matrix wording (
GatesInfo notes): Dropped under the anti-pedantry rule.