Repository navigation
fix: long fenced replies can stall the Gateway after a leaked tool call - #189605
Merged
Merged
Conversation
Carry the existing fence scan across appended partial snapshots so literal code examples do not repeatedly parse the accumulated reply. Preserve the canonical fallback for new candidates and uncertain Markdown ownership. Co-authored-by: steipete <[email protected]>
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
roboclaw-bot
marked this pull request as ready for review
October 31, 2026 17:42
roboclaw-bot
enabled auto-merge (squash)
October 31, 2026 17:47
Collaborator
Author
|
Merged via squash auto-merge.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 1, 2026
…9605) Carry the existing fence scan across appended partial snapshots so literal code examples do not repeatedly parse the accumulated reply. Preserve the canonical fallback for new candidates and uncertain Markdown ownership. Co-authored-by: steipete <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #186601, #181696; #186605 addresses the separate assistant-visible sanitizer owner.
What Problem This Solves
A long fenced reply after a leaked plain-text tool call can block the Gateway while every cumulative partial snapshot reparses accumulated Markdown. This targets the snapshot projection attributed in the R11 freeze, rather than the separate assistant-visible text sanitizers.
User Impact
Settled tool-call snapshots retain literal fenced examples without repeatedly parsing the entire reply. No configuration, migration, or operator action is required.
Why This Change Was Made
The existing two-entry snapshot reuse discarded its settled ranges whenever an appended chunk contained Markdown delimiters. Carry the existing fence scan with each reuse anchor and inspect only appended candidates. An unfinished prose tail preserves earlier proven fence verdicts; candidates in the unresolved tail still use canonical scrubbing. Content-block changes, uncertain ownership, and custom resolvers retain their existing invalidation rules.
This removes repeated snapshot-parser work without adding a parser or another cache owner. Production delta: +32 lines; test delta: 0 lines. The existing loose call-count test is replaced with a byte-budget regression and exact comparison of every projected snapshot.
Evidence
Acceptance rule: append 34-byte chunks containing a fenced literal tool call followed by unfinished prose through the production snapshot owner used by sanitizeEventPartial; resolver input must remain within 4× reply size, and every projected snapshot must equal the independently expected visible text.
The committed 40-append regression fails on base: 29,315 bytes exceeds its 5,616-byte budget. A separate initial reproduction through the real normalizer with cumulative snapshots and 64-byte deltas parsed 8,405,071 bytes for a 32,694-byte fenced TOML reply and 34,644,559 for a 66,486-byte reply (4.12× work for 2.03× text), confirming the quadratic snapshot path. That original workload passes the linear budget with the repair.
Focused checks, each timeout-wrapped with the operator-approved explicit Bun override and --maxWorkers=1:
Limits: no live Gateway or model was run under this host's restrictions. The supplied incident profile file was unavailable in the task checkout; attribution is supported by the reported stack and the independently reproduced owner path. Some mixed-fence chunks also hit a separate existing live candidate-protection fallback in resolvePartialProtectionCheck; this PR addresses only snapshot projection, and the related issue reports remain outside its scope. Exact-head CI run 41225803065 passed for 7307c1e in 9m 9s. Its changed-node jobs passed in 2m 5s and 4m 15s (whole-job wall times, not per-test CPU). The native watcher reported GREEN; superseded draft checks were excluded by its owner, with no inherited-failure admission. Landed as 4cc5638; main ancestry, touched-file content, and the exact steipete co-author trailer were verified.
Requested by @steipete
Work sessions
Discussion, implementation and verification