Skip to content

fix(tool-call-repair): preserve stream content order after repair - #103585

Merged
steipete merged 1 commit into
mainfrom
codex/fix-zero-arg-stream-order
Jul 10, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-zero-arg-stream-order

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #103220
Related: #102975
Related: #102933

What Problem This Solves

Fixes an issue where users receiving streamed plain-text tool-call repairs could see the repaired visible answer move to the wrong content index when the original stream included non-text content between text chunks.

Why This Change Was Made

The repair now projects the recovered visible suffix back onto the original text blocks instead of collapsing all replacement text into the first text block. This keeps streamed partial events and terminal done snapshots aligned without changing the existing tool-call scrubbing boundary.

User Impact

Users get the visible answer in the same message position that was streamed, preserving surrounding non-text content order after over-cap tool-call cleanup.

Evidence

  • Autoreview: clean, no accepted/actionable findings.
  • AWS Crabbox run run_bec0bf9fc2a1: focused tests passed for src/plugin-sdk/provider-stream-shared.test.ts and packages/tool-call-repair/src before an unrelated late Vitest worker exit in broad changed tests.
  • Focused regression added: byte-over-cap visible suffix remains at content index 2 while thinking content at index 1 is preserved.

Keep byte-over-cap visible suffixes at their streamed content indexes when terminal message snapshots are normalized.

Co-authored-by: ZOOWH <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Jul 10, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for exact head a95f2c5:

  • Added a regression so byte-over-cap visible suffix text remains at the streamed content index while non-text content order is preserved.
  • Autoreview: clean.
  • AWS Crabbox run_bec0bf9fc2a1: focused provider stream/tool-call repair tests passed; later broad raw AWS changed-suite ended with a Vitest worker exit, so native hosted gates were required.
  • Native prepare: OPENCLAW_TESTBOX=1 scripts/pr prepare-run 103585 passed; hosted exact CI run 29081686375 passed for this SHA.
  • Gate mode: hosted_exact_or_recent_rebase; remote PR head matches local prep head.

@steipete
steipete merged commit 2c90921 into main Jul 10, 2026
114 of 117 checks passed
@steipete
steipete deleted the codex/fix-zero-arg-stream-order branch July 10, 2026 09:16
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant