Skip to content

fix(tool-call-repair): bound serialized stream normalization - #104100

Merged
steipete merged 6 commits into
mainfrom
pr-102975-prep
Jul 11, 2026
Merged

steipete merged 6 commits into
mainfrom
pr-102975-prep

Conversation

@steipete

@steipete steipete commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The zero-argument XML repair merged in #103220 left serialized plain-text tool calls with multiple parser and stream-normalization paths. Incomplete, oversized, or split calls could be exposed in terminal snapshots; mixed text/non-text streams could also lose ordering, native blocks, or visible prefix/suffix text.

This is a maintainer follow-up to #98984, #102240, #102933, #102975, #103220, and #103585.

Why This Change Was Made

Consolidate serialized-call recognition behind one canonical grammar and one ordered, byte/character-bounded stream projection. Preserve shipped bracket/XML compatibility while making executable zero-argument XML calls explicit, retaining native content blocks and stable content indexes, and keeping recognized incomplete or oversized known-call syntax fail-closed while malformed non-call text remains visible.

The refactor deletes the older duplicated stream-state matrix and keeps provider and embedded-agent terminal behavior aligned.

User Impact

Models that serialize tool calls as text no longer leak incomplete/oversized syntax or lose surrounding visible text and native blocks. Valid shipped formats continue to execute, including legacy implicit-close parameter calls; explicit zero-argument XML calls now repair consistently across provider streams, terminal snapshots, and embedded runs.

Evidence

  • Focused repair matrix: 315/315 tests passed on Blacksmith Testbox
  • Static proof: all changed-surface typecheck lanes passed; exact formatting and targeted lint passed
  • Fresh autoreview: clean, no accepted/actionable findings
  • Blacksmith Testbox: run 29136209593
  • Live Gateway/provider proof at 8720b33ccbc90c2f7619e6b7c80f6aee215901aa: full build; two loopback Responses requests; session_status start/result; final TOOLCALL_LIVE_OK; raw XML absent from events, history, transcript, and Gateway logs

Contributor credit is retained for @wangyan2026, @qingminglong, @wuqxuan, and @ZOOWH.

No agent transcript is attached.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Jul 11, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for 8720b33ccbc90c2f7619e6b7c80f6aee215901aa:

  • Refactored serialized tool-call normalization onto one canonical composite scanner with monotonic classification and a single terminal scrub path. The scanner now bounds pending event count/bytes, preserves valid partial calls, repairs zero-argument XML calls, and keeps malformed non-call suffix text visible without leaking incomplete or oversized recognized syntax.
  • Focused Testbox matrix: 315/315 passed across provider/tool payload, grammar/payload/stream, and agent suites. Core, core-test, plugin, and plugin-test tsgo lanes passed; exact formatting and targeted oxlint passed.
  • Fresh autoreview completed with no accepted or actionable findings after fixing split optional-closer whitespace handling and the complete-call trailing-whitespace memory cap.
  • Exact-head live gateway proof passed from a detached remote checkout: two inference requests, session_status tool start/result with {} args, final TOOLCALL_LIVE_OK, and no raw XML in events, history, transcript, or gateway logs. Testbox action: https://github.com/openclaw/openclaw/actions/runs/29136209593
  • Exact-head CI completed successfully: https://github.com/openclaw/openclaw/actions/runs/29137051527

Native scripts/pr review artifacts validate, and OPENCLAW_TESTBOX=1 scripts/pr prepare-run 104100 completed with prep_head_sha == pr_head_sha == 8720b33ccbc90c2f7619e6b7c80f6aee215901aa.

@steipete
steipete merged commit 05ebaf4 into main Jul 11, 2026
126 of 129 checks passed
@steipete
steipete deleted the pr-102975-prep branch July 11, 2026 03:00
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8720b33ccb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CHANGELOG.md

### Fixes

- **Plain-text XML tool calls:** repair zero-argument calls and keep byte/character-bounded stream normalization from leaking incomplete or oversized tool syntax while preserving visible suffix text. (#98984, #102240, #102933, #102975, #103220, #103585) Thanks @wangyan2026, @qingminglong, @wuqxuan, and @ZOOWH.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove the manual changelog entry

AGENTS.md says CHANGELOG.md is release-only and that release generation owns it, so adding this Unreleased note in a normal fix commit bypasses the release-note pipeline and can leave duplicate or stale generated release notes. Put this release-note context in the PR body, squash/direct commit message, or the release generator input instead of editing the changelog here.

Useful? React with 👍 / 👎.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 11, 2026
…w#104100)

* fix(tool-call-repair): bound serialized stream normalization

Co-authored-by: wuqingxuan <[email protected]>
Co-authored-by: 徐闻涵0668001344 <[email protected]>
Co-authored-by: qingminlong <[email protected]>
Co-authored-by: WangYan <[email protected]>

* fix(tool-call-repair): preserve strict scan narrowing

* fix(tool-call-repair): lint serialized name validation

* fix(tool-call-repair): replay split suffix whitespace

* fix(tool-call-repair): cap complete-call whitespace

* test(tool-call-repair): assert bounded whitespace replay

---------

Co-authored-by: wuqingxuan <[email protected]>
Co-authored-by: 徐闻涵0668001344 <[email protected]>
Co-authored-by: qingminlong <[email protected]>
Co-authored-by: WangYan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant