Repository navigation
fix: preserve paragraph breaks in streamed replies - #125340
Adkid-Zephyr wants to merge 10 commits into
Conversation
|
🦞👀 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: needs changes before merge. What this changesPreserves authored line and paragraph separators through streamed reply chunking, coalescing, normalization, and routing. Example: A newline-mode reply streams
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: it provides a useful, proven repair for separator loss that remains in current main, with no actionable defect found in the pinned patch. Priority: P2 Before merge
FindingsNone. Agent review detailsHow this fits togetherEmbedded agent and ACP streams enter the shared block chunker and delivery pipeline; normalized payloads leave through direct dispatch or channel routing. flowchart TD
A[Embedded agent stream] --> C[Block chunker]
B[ACP event projector] --> C
C --> D[Presentation and coalescing]
D --> E[Shared normalization]
E --> F[Dispatcher or reply router]
F --> G[Channel delivery]
Technical reviewBest possible solution: Land the shared separator-preservation repair while retaining current main's chunk limits, source accounting, and delivery lifecycle. Do we have a high-confidence way to reproduce the issue? Current-main source shows paragraph separators being consumed before visible chunks are emitted, and separate coalescer flushes cannot restore them; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch repairs the shared source and normalization owners, preserves ordinary configured joiners, and limits the sanitizer exception to established block continuations. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2d72268bd9e9. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +131, Tests +756. Total +887 across 20 files. Added test files: 2. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label 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 HistoryReview history (21 earlier review cycles; latest 8 shown)
Reviewed October 18, 2026, 12:06 AM ET / 04:06 UTC (Revision 22). |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Thanks for the PR. We're closing older pull requests that have gone stale against current This PR has had no commits since September 14 and is waiting on requested changes. Thanks for the work; please open a fresh PR rebased on main if streamed paragraph breaks are still lost on a current release. |
Closes #42106
AI-assisted with Codex. Validation and independent code review were performed by agents.
What Problem This Solves
Streamed source line breaks can disappear between independently delivered blocks. This affects both embedded replies and ACP replies: a forced ACP flush of
First.\nfollowed bySecond.must reconstructFirst.\nSecond., and paragraph boundaries must survive every shared normalization stage.The chunker now retains source line/paragraph boundaries across drains and checkpoints when the boundary and visible text fit the cap. Coalescing respects an existing leading source line break instead of adding another joiner; ordinary text retains the configured joiner. A private
streamedSourceBoundaryfact carries an established continuation through presentation, coalescing, dispatch preparation and routing. The sanitizer skips only leading-empty-line removal for that fact on block replies; first blocks, suppressed output, errors, internal-context filtering, tool replies and final replies retain their normal cleanup.ACP establishes that fact in its existing serial pipeline callback only after an earlier source block was accepted by delivery. Both routed preparation and the real
routeReplynormalization consume it. Async admission order, source cursors and fence handling remain with their existing owners. A direct import from the canonical payload type also avoids the type-only barrel cycle caught by CI. No public configuration/protocol fields or channel-rendering changes are introduced.Candidate and integration
Candidate:
5847aff32fb96bd45484fadde6bbc02195789440.Merge commit
f475a3adf14862e7c7cc34ede09c1fea4304520eincorporates frozen main5f357b747802439b4878dea48a78bb91957b7ff5. That merge commit’s tree matches the recorded conflict-freegit merge-treeresult, and its frozen-lockfile install passed. The current candidate descends from that verified merge. Against that base: 20 files; production +160/-29 (net +131), tests +771/-15 (net +756).Evidence
routeReply→ durable wrapper, with the outbound delivery boundary mocked. Controls cover a suppressed first source, status output and marked blocks reused as final/tool replies.f475a3adf1, and all four categories pass after the one-line joiner repair. Existing ordinary-text configured-joiner cases remain green.check-changed --base 5f357b747802439b4878dea48a78bb91957b7ff5 --head HEAD, exactpnpm check:architecture,git diff --check, scoped lint/format and owner type checks all passed. The clean private-QA runtime build passed, with temporary observation code absent.5f357b7478..5847aff32fsource diff, including source accounting, chunk limits and fences, delivery lifecycle, metadata propagation, direct/routed normalization and filtering, and reported no actionable finding. The earlier bundled autoreview helper produced no validated report; it is not counted as a successful review.Actual Gateway evidence
The original matched experiment is retained separately: with identical scenario and log-only instrumentation, the pre-presentation-fix
a32bf3f44cproduction overlay produced["First", "Second"], while5a50d8b762produced["First", "\n\nSecond"]. This established the earlier embedded-path repair.The current candidate
5847aff32fwas then rerun as a regression confirmation, using the same stable mock stream, signed local Slack ingress, real Gateway/Slack plugin and local Crabline API. Its source and dependencies differ from the old pair, and diagnostic field bindings were renamed; this is not presented as a new strictly paired experiment against that old baseline.Temporary log-only observation immediately after shared sanitization and before the channel transform produced:
{"text":"First","applyChannelTransforms":true,"hasChannelTransform":true,"transformAlreadyApplied":false} {"text":"\n\nSecond","applyChannelTransforms":true,"hasChannelTransform":true,"transformAlreadyApplied":false} {"text":"First\n\nSecond","applyChannelTransforms":false,"hasChannelTransform":false,"transformAlreadyApplied":false}All three records were retained. The frozen predicate
applyChannelTransforms && hasChannelTransform && !transformAlreadyAppliedselects exactly two nonempty blocks within the 20-character cap; their concatenation exactly equals the emitted SSE sourceFirst\n\nSecond. The third record is internal final normalization with no channel transform. Allreply_payload_sendingrecords were exactly two block deliveries; native API logs contained exactly twochat.postMessagecalls (First,Second) and no extra final/fallback send, update or delete.The instrumentation and scenario copy were restored before the clean runtime rebuild and final checks. This proves the observed shared source boundary in an isolated, instrumented Gateway. Slack's existing channel transformation/rendering remains unchanged; no live external-channel result is claimed.
CI
CI run 34807553901 completed successfully for
5847aff32fb96bd45484fadde6bbc02195789440. Its completed-check snapshot recorded 169 SUCCESS, 44 SKIPPED and 1 NEUTRAL, with no failed or pending checks.ClawSweeper Revision 18 reviewed this exact head, found the prior ACP/coalescing findings addressed and no remaining actionable defect, and marked it ready for maintainer review. Maintainer review and merge remain pending.