Repository navigation
fix: keep long replies streaming after tool traces and code fences - #172832
Conversation
Reuse settled visible text in the existing projection owner. Keep provisional tool calls and mutable Markdown with their canonical parsers, carrying fence and reference-definition context across stable boundaries. Add chunk parity and deterministic work-bound regressions for the remaining streaming rescans behind #172629.
…-text-incremental
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e7de11989e
ℹ️ 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".
|
Codex review: needs changes before merge. What this changesThis PR reuses settled visible text so tool traces and fenced code do not repeatedly trigger whole-reply sanitization. Example: A reply starts with
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: it addresses documented streaming-performance residuals still present on main, with no concrete introduced defect found; the failed CI gate needs classification before landing. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe shared text projector receives assistant text deltas, applies canonical visibility filters, and returns visible snapshots and append deltas to streaming consumers. flowchart LR
A[Assistant text deltas] --> B[Shared text projection]
B --> C[Markdown ownership]
C --> D[Canonical visibility filters]
D --> E[Settled output and unresolved suffix]
E --> F[Streaming reply consumers]
Technical reviewBest possible solution: Retain canonical filtering and mutable Markdown ownership while settling reusable output in the existing projection owner. Do we have a high-confidence way to reproduce the issue? Current-main source establishes repeated accumulated-text transforms after trace activation; no target code or benchmark was executed during this read-only review. Is this the best way to solve the issue? The approach fits the existing projection owner, preserves canonical scanners, and adds focused settlement and prefix-parity coverage without creating a competing sanitizer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 37e45ded12fc. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +238, Tests +220, Other +2. Total +460 across 11 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 15, 2026, 2:59 AM ET / 06:59 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…penclaw#172832) * fix: keep trace-bearing and fenced replies incremental Reuse settled visible text in the existing projection owner. Keep provisional tool calls and mutable Markdown with their canonical parsers, carrying fence and reference-definition context across stable boundaries. Add chunk parity and deterministic work-bound regressions for the remaining streaming rescans behind openclaw#172629. * fix: protect literal code before scanning tool payloads * fix: retain ambiguous image and reference label prefixes * fix: retain unfinished Markdown link and definition titles * fix: settle unrelated references in streaming replies
Fixes #172629
What Problem This Solves
Fixes: long streamed replies containing an actual tool trace or fenced code repeatedly sanitize accumulated text, occupying the Gateway thread and delaying other sessions.
User Impact
Long trace-bearing and fenced-code replies reuse settled output while preserving the exact visible text at each stream boundary. No configuration changes or migration are required.
Why This Change Was Made
The earlier trace-head fix stopped activation on ordinary prose, but a real trace head still enabled whole-reply scrubbing. The plain-tool filter also repeatedly parsed growing fenced answers when payload markers appeared.
The existing text projection owner now retains only unresolved source and reuses settled output. Canonical line and tool-call scanners report source/output settlement boundaries. Proven open fences carry their opener without retaining their body; canonical Markdown ownership handles ambiguous syntax, reference definitions, and unfinished titles. Tool calls stay provisional while another suffix can change their output. Replacement/reset behavior stays with the existing projector, and the superseded block-marker latch path is removed.
Late image definitions can revoke inline-code protection, so their unresolved descriptions remain available. Unrelated citations or image references plus external inline code can settle. This is synchronous text projection: no detached effects, captured authority, schema changes, or new SDK contracts.
Evidence
55147a0e6972: a real trace head permanently activates whole-reply sanitization, and the plain-tool activation path reparses accumulated code regions. Merged fix: streaming a reply that mentions tool calls no longer stalls the Gateway event loop #172631 and fix: avoid repeated scans while streaming citation replies #172470 leave these residuals documented.bounds canonical work after $namecounts regex input characters for real trace heads, repeated fenced payload markers, indented fences, earlier definitions, and completed citation/image paragraphs with unrelated inline code. The protected-payload scanner also has an indexed-character work bound. No timing assertions.projects %s in token-sized chunksandmatches the canonical strip while streaming %#compare every prefix at sizes 1, 3, and 7. Cases cover opening/closing fences, traces inside code, multiline inline code, CRLF, provisional JSON/XML suffixes, reference definitions before and after images, nested/escaped/code-owned brackets, unfinished link/definition titles, and replacement/reset behavior. Parser tests protect settlement offsets.oxfmt,oxlint --config .oxlintrc.json --tsconfig config/tsconfig/oxlint.core.json, andgit diff --checkpass. Deslop removed the superseded activation path; no unrelated cleanup or weakened checks. Isolated Codex autoreview through P2 resolved findings about reference context, protected-payload ordering, and nested image descriptions. The cloud P1 about unrelated references pinning output is fixed with deterministic regressions. Final committed-branch autoreview is scoped-clean through P2, with no accepted/actionable findings. Current main was merged without rebase before pushing; the reviewed patch stayed identical by stable patch ID, and all ten changed TypeScript files passed lint/format again.73aafb6c8f49029a188671d85ab7640bd9e7430acompleted with 53 successful jobs. Its only failed execution lane is checks-node-compact-small-5-2: unchangedci-node-test-plan.test.tsexpects oneplanConcurrency === 2job and receives zero. Baseline classification remains unconfirmed. The latest scheduled main run initially failed before tests on the known setup-go codeload 404. After the URL returned 200, a single main lane was retried (job 116279219483) and then cancelled after more than 20 minutes. Its completed log showed different packed runtime shards, not the planner test, so it is not inherited-failure evidence. Source inspection confirms this streaming diff does not affect the planner test's five fixed target inputs, but no matching scheduled-main failure is claimed. No PR test retry was used. The CI-planner failure requires separate triage before treating the aggregate gate as green.