Skip to content

fix(agents): keep fenced code byte-for-byte through duplicate-block collapse - #135945

Merged
obviyus merged 20 commits into
openclaw:mainfrom
ruel225:fix/sanitize-duplicate-block-code-135882
Sep 2, 2026
Merged

obviyus merged 20 commits into
openclaw:mainfrom
ruel225:fix/sanitize-duplicate-block-code-135882

Conversation

@ruel225

@ruel225 ruel225 commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Every delivered assistant reply passes through sanitizeUserFacingText. Its final collapseConsecutiveDuplicateBlocks stage split the reply on blank lines without consulting code regions.

Repeated lines inside a fence could be deleted. Any duplicate elsewhere also caused retained fenced chunks to be trimmed, which removed meaningful indentation. The stored transcript stayed correct while channel users received corrupted code.

Fixes #135882

Why This Change Was Made

The shared duplicate-paragraph projector keeps its incremental candidate detector. When that detector finds a possible duplicate, the canonical transform uses the existing parser-owned findCodeRegions ranges.

  • Each code region becomes a deterministic unique token with no whitespace or line breaks.
  • The existing prose collapse runs unchanged on the masked text.
  • Unique tokens prevent code-touched paragraphs from comparing as duplicates and make code a sequence barrier.
  • The exact parser-owned bytes replace the tokens after prose collapse.
  • Streaming stays on the current fast path until a duplicate candidate appears.

This stays in the shared text-projection owner used by the sanitizer. It adds no Telegram branch and no second Markdown parser.

User Impact

Telegram and other channel users receive fenced code with its indentation and repeated lines intact. Adjacent duplicate prose still collapses as before.

Production delta: +74/-6, net +68. Tests and test support: +139/-30, net +109. Current main absorbed the CI workflow, Chromium, and complete CLI-output repairs. The production growth carries the parser-owned block/inline distinction needed to preserve block code while retaining inline-prose duplicate collapse.

Evidence

Telegram Test Server

Ran the real Telegram direct-message path with the deterministic mock provider on baseline main d413210bc7420923d101ce64211511cdac7b9464 and final exact head 8c740cc4e325c344108689738b266561285c5b0c after integrating current main fcbe9938d8c6b71917d4b70bdc8d2049d6c18547.

The model response contained an indented Python method and three blank-line-separated repeated lines inside fenced code.

Result Current main Exact head
Delivered characters 203 226, exact expected rendered text
def log indentation column 0 column 4
[worker] retrying lines 2 3
Telegram code entities 2 2
Provider requests 1 1
Stored fenced transcript exact exact

Exact delivered head text:

Here is the retry loop and the log it produced:

class Worker:
    def run(self):
        self.log("retrying")

    def log(self, msg):
        print(msg)

[worker] retrying

[worker] retrying

[worker] retrying

[worker] done

The same run read the per-agent SQLite transcript before cleanup. It retained the original Markdown fences, indentation, and all three repeated lines.

Tests and checks

  • New regression test on current main: 3 expected failures for fenced bytes, initial indented code, and code-barrier reset.
  • Current exact-head projection and sanitizer tests: 28 passed.
  • Earlier full owner and sanitizer suites: 142 tests passed; delivery sibling suites: 228 tests passed.
  • 12,960 generated code-free inputs matched the previous prose-collapse output.
  • Oxfmt, Oxlint, and git diff --check: passed.
  • Prior Codex Sol autoreview: no accepted or actionable P0 findings. The exact-head landing review runs after push.
  • CI root-cause repair: required comparison bases now load during the authenticated checkout. The guard, protocol, and npm-lock lanes no longer fetch after credentials are removed. Workflow and Git lifecycle suites passed 416 tests, and workflow validation passed.
  • CI flake repair: the lease cleanup test now uses the existing 10-second worker-lifecycle lease, so constrained runners cannot turn its abort assertion into an unrelated lease-expiry result. The focused owner suite passed 10 tests.
  • Windows CI cleanup repair: terminal test-instance cleanup now reuses the existing force-tree path on Windows, so inherited Gateway pipes cannot outlive completed assertions. The shared helper suite passed 36 tests; exact Windows proof runs in CI.
  • Lease worker startup repair: the process-exit test now uses the existing compiled test-subprocess owner instead of launching a TypeScript child that can exhaust the production heartbeat readiness deadline. State lease suites passed 14 tests; compiled-subprocess inventory passed 39 tests.
  • ClawSweeper review repairs: the original incremental duplicate projector now owns continuation suffixes after parser-backed reconciliation. A code-bearing regression keeps parser calls at one across 256 appends. The abort test now awaits heartbeat-worker exit before checking that lease state stays unchanged.
  • Hosted Chromium repair: the corner-shape browser probe now treats the computed CSS alias superellipse(1) as semantic round. All 3 focused browser tests passed locally; exact hosted proof runs in CI.
  • Built-CLI proof repair: finite CLI commands now wait for child stream closure and retain complete output, while long-lived Gateway logs remain bounded. The exact failed artifact emitted 288,423 bytes beyond the old 262,144-byte cap. The inherited-pipe and 300 KiB regressions pass with all 38 shared helper tests.

ClawSweeper Rank-Up Moves

  • Applied the remaining merge-risk move: parser-backed masking remains the single canonical code-protection path, while the existing suffix fast path and direct sanitizer and streaming regressions remain in place.
  • Applied the inline-code move: parser-owned block regions remain unique barriers, while identical inline spans reuse stable tokens and collapse as ordinary prose across static and partitioned streaming input.

…ollapse

collapseConsecutiveDuplicateBlocks split the reply on blank lines without
consulting code regions, so blank lines inside fences produced chunks that
compared equal after whitespace folding and were silently deleted; kept
chunks were re-emitted trimmed, stripping indentation from the first line
of fenced code. Protect any block overlapping a code region (never deleted,
never re-trimmed) and rejoin with the original blank-line separators.

Co-Authored-By: Claude <[email protected]>
@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Sep 2, 2026
@ruel225
ruel225 marked this pull request as ready for review September 2, 2026 05:04
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 2, 2026, 3:40 PM ET / 19:40 UTC.

ClawSweeper review

What this changes

The branch protects Markdown code during outbound duplicate-paragraph collapse, with supporting regressions and test-runtime reliability updates.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Needs maintainer review before merge - 4 items remain

Keep this PR open: current main still corrupts code-bearing duplicate blocks, and the PR has credible Telegram Test Server proof, but its parser masking leaves the prior P2 regression for identical prose containing inline code unresolved.

Priority: P1
Reviewed head: 35fe83f907823d7c1ed38ba34699e0dbc40b9119

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The user-visible repair is well evidenced, but one confirmed P2 delivery-semantics regression remains.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied Telegram Test Server direct-message trace exercised the outbound sanitizer with fenced Python and repeated fenced logs, recording exact improved rendered output; the sanitizer/projection surface is unchanged from the proved head to the current head.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied Telegram Test Server direct-message trace exercised the outbound sanitizer with fenced Python and repeated fenced logs, recording exact improved rendered output; the sanitizer/projection surface is unchanged from the proved head to the current head.
Evidence reviewed 7 items Current-main behavior: Fetched main retains the unmasked duplicate projector, including whitespace-normalized paragraph comparison and trimStart handling; the PR remains necessary.
Delivery path: Normal replies pass through sanitizeUserFacingText before the reply payload is delivered, so this filter affects channel-visible output.
Introduced regression: The introduced masking path replaces every code region with a distinct token after detecting a duplicate. Because the parser includes inline spans, identical prose paragraphs containing identical inline code no longer compare equal.
Findings 1 actionable finding [P2] Preserve duplicate collapse for inline-code prose
Security None None.

How this fits together

The shared outbound text sanitizer normalizes assistant replies before channels deliver them. Its duplicate-paragraph filter must preserve code bytes while still collapsing genuinely repeated prose.

flowchart TD
  Reply[Assistant reply] --> Sanitizer[Outbound text sanitizer]
  Sanitizer --> Projection[Text projection filters]
  Projection --> Duplicate[Duplicate paragraph collapse]
  Duplicate --> Code[Markdown code-region handling]
  Code --> Delivery[Channel delivery]
Loading

Before merge

  • Preserve duplicate collapse for inline-code prose (P2) - This remains from the prior review: findCodeRegions includes inline code, but each occurrence receives a different token. Two otherwise identical paragraphs such as Run x`.
  • Resolve merge risk (P1) - The current masking strategy changes existing duplicate-collapse behavior for normal prose with inline code, so users can receive duplicate paragraphs.
  • Resolve merge risk (P1) - The bug-fix production change is +41/-3 lines; the required correction should absorb code protection into the existing projector as narrowly as possible.
  • Complete next step (P2) - Restore duplicate collapse for identical inline-code prose and add regression coverage before merge.

Findings

  • [P2] Preserve duplicate collapse for inline-code prose — src/shared/text/text-projection.ts:177-180
Agent review details

Security

None.

PR surface

Source +38, Tests +101, Other +4. Total +143 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 1 41 3 +38
Tests 9 139 38 +101
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 4 0 +4
Total 12 184 41 +143

Review metrics

Metric Value Why it matters
Production vs test-support delta production +41/-3 (net +38); tests/test support +143/-38 (net +105) The production masking path is the central repair and should be narrowed with the inline-code correction before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #135882
Summary: This PR is a candidate repair for the reported outbound sanitizer corruption, but it remains incomplete until the inline-code regression is fixed.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Repair inline-code matching before merge (recommended)
    Limit byte-preserving protection to block-code barriers or otherwise retain equality for identical inline-code prose, with regression coverage for static and streamed projection.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Preserve duplicate collapse for identical prose containing inline code and add partitioned static/streaming regression coverage.

Technical review

Best possible solution:

Protect fenced and indented code as byte-preserving barriers while retaining the existing duplicate match for identical prose paragraphs that contain inline code, then cover that contract through the existing partitioned projection test table.

Do we have a high-confidence way to reproduce the issue?

Yes—source inspection gives a high-confidence reproduction: pass two identical paragraphs such as Run x`.

Run x.` through the duplicate filter; distinct inline-code tokens prevent the second paragraph from collapsing.

Is this the best way to solve the issue?

No—the branch correctly protects fenced code but masks inline spans too, changing ordinary prose semantics. Block-code-only protection or equivalent stable matching is the narrower maintainable repair.

Full review comments:

  • [P2] Preserve duplicate collapse for inline-code prose — src/shared/text/text-projection.ts:177-180
    This remains from the prior review: findCodeRegions includes inline code, but each occurrence receives a different token. Two otherwise identical paragraphs such as Run x`.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1e37a56c7528.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp. Replaced prior rating: 🐚 platinum hermit.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove merge-risk: 🚨 automation: Current PR review merge-risk labels are merge-risk: 🚨 message-delivery.

Label justifications:

  • P1: The PR addresses and can still regress channel-visible assistant reply delivery.
  • merge-risk: 🚨 message-delivery: The introduced duplicate-collapse behavior can cause users to receive repeated inline-code prose instead of the established collapsed output.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp. Replaced prior rating: 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied Telegram Test Server direct-message trace exercised the outbound sanitizer with fenced Python and repeated fenced logs, recording exact improved rendered output; the sanitizer/projection surface is unchanged from the proved head to the current head.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied Telegram Test Server direct-message trace exercised the outbound sanitizer with fenced Python and repeated fenced logs, recording exact improved rendered output; the sanitizer/projection surface is unchanged from the proved head to the current head.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. The changed sanitizer behavior is directly visible in Telegram-delivered reply text and has appropriate Telegram Test Server evidence.

Evidence

Acceptance criteria:

  • [P1] pnpm test src/shared/text/text-projection.test.ts.
  • [P1] pnpm test src/agents/embedded-agent-helpers.sanitizeuserfacingtext.duplicateblocks.test.ts.

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Restore collapse for identical prose paragraphs containing inline code and add the case to the partitioned projection coverage.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (14 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-02T11:18:33.412Z sha a706009 :: needs changes before merge. :: [P2] Restore incremental projection after duplicate collapse
  • reviewed 2026-09-02T12:01:37.279Z sha 910a56e :: needs changes before merge. :: [P2] Restore incremental projection after duplicate collapse | [P2] Keep the abort heartbeat assertion meaningful
  • reviewed 2026-09-02T12:25:03.815Z sha 1201453 :: needs changes before merge. :: [P2] Restore incremental projection after duplicate collapse | [P2] Keep the abort heartbeat assertion meaningful
  • reviewed 2026-09-02T14:50:18.210Z sha 16fab19 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T15:18:00.204Z sha 92efc15 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T17:36:04.237Z sha 4467a4d :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T18:35:32.522Z sha 4467a4d :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T18:52:35.823Z sha 7f36f88 :: needs changes before merge. :: [P2] Preserve duplicate collapse for inline-code prose | [P2] Keep later streamed paragraphs incremental

…ons untrimmed

The duplicate-block collapse discovered code regions from already-trimmed
text, so an initial indented code block lost its leading indentation before
the parser could classify it, and a protected block's normalized text stayed
in the comparison state, letting prose after it collapse against prose before
it. Restructure the collapse around parser-owned code regions: protected code
is emitted byte-for-byte and ends the duplicate sequence, and each code-free
prose run collapses independently with its run edges kept byte-exact.

Co-Authored-By: Claude <[email protected]>
@ruel225

ruel225 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 2, 2026
@openclaw-barnacle openclaw-barnacle Bot closed this Sep 2, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 2, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 2, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 2, 2026
@obviyus obviyus closed this Sep 2, 2026
@obviyus obviyus reopened this Sep 2, 2026
@obviyus obviyus closed this Sep 2, 2026
@obviyus obviyus reopened this Sep 2, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. label Sep 2, 2026
# Conflicts:
#	.github/workflows/ci.yml
#	test/scripts/ci-workflow-guards.test.ts
@obviyus

obviyus commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

landpr-approve-unrelated-red
pr: 135945
head: 7f36f88
breaking: 509c95b
check: openclaw/ci-gate

# Conflicts:
#	ui/src/styles/corner-shape.browser.test.ts
@obviyus

obviyus commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

landpr-approve-unrelated-red
pr: 135945
head: 35fe83f
breaking: 509c95b
check: openclaw/ci-gate

@openclaw-barnacle openclaw-barnacle Bot removed the app: web-ui App: web-ui label Sep 2, 2026
@obviyus

obviyus commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

landpr-approve-unrelated-red
pr: 135945
head: 9a1f686
breaking: 509c95b
check: openclaw/ci-gate

# Conflicts:
#	test/helpers/openclaw-test-instance.ts
#	test/scripts/ci-linux-git.test.ts
@obviyus

obviyus commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

landpr-approve-unrelated-red
pr: 135945
head: 4358a94
breaking: 509c95b
check: openclaw/ci-gate

@obviyus

obviyus commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

landpr-approve-unrelated-red
pr: 135945
head: 8c740cc
breaking: 509c95b
check: openclaw/ci-gate

@obviyus
obviyus merged commit cfe80b3 into openclaw:main Sep 2, 2026
292 checks passed
@obviyus

obviyus commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Thanks @ruel225!

Proof: Telegram Test Server direct message preserved the exact 226-character rendered reply, four-space code indentation, three repeated fenced lines, and two code entities with one provider request.

  • Bug: Duplicate-paragraph cleanup deleted repeated fenced lines and stripped meaningful code indentation.
  • Fix: Parser-owned block regions stay byte-exact barriers, while identical inline-code prose still collapses normally.
Before After
def log moved to column 0 and one repeated fenced line disappeared def log stays at column 4 and all three repeated lines arrive

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 3, 2026
…#135945)

## What Problem This Solves

Every delivered assistant reply passes through `sanitizeUserFacingText`. Its final `collapseConsecutiveDuplicateBlocks` stage split the reply on blank lines without consulting code regions.

Repeated lines inside a fence could be deleted. Any duplicate elsewhere also caused retained fenced chunks to be trimmed, which removed meaningful indentation. The stored transcript stayed correct while channel users received corrupted code.

Fixes openclaw#135882

## Why This Change Was Made

The shared duplicate-paragraph projector keeps its incremental candidate detector. When that detector finds a possible duplicate, the canonical transform uses the existing parser-owned `findCodeRegions` ranges.

- Each code region becomes a deterministic unique token with no whitespace or line breaks.
- The existing prose collapse runs unchanged on the masked text.
- Unique tokens prevent code-touched paragraphs from comparing as duplicates and make code a sequence barrier.
- The exact parser-owned bytes replace the tokens after prose collapse.
- Streaming stays on the current fast path until a duplicate candidate appears.

This stays in the shared text-projection owner used by the sanitizer. It adds no Telegram branch and no second Markdown parser.

## User Impact

Telegram and other channel users receive fenced code with its indentation and repeated lines intact. Adjacent duplicate prose still collapses as before.

Production delta: +74/-6, net +68. Tests and test support: +139/-30, net +109. Current `main` absorbed the CI workflow, Chromium, and complete CLI-output repairs. The production growth carries the parser-owned block/inline distinction needed to preserve block code while retaining inline-prose duplicate collapse.

## Evidence

### Telegram Test Server

Ran the real Telegram direct-message path with the deterministic mock provider on baseline main `d1196942a01194b32399182af6e5f9bfe9861c35` and final exact head `8c740cc4e325c344108689738b266561285c5b0c` after integrating current main `925e94d08db3014f004b4abefb609d82d18f7dd5`.

The model response contained an indented Python method and three blank-line-separated repeated lines inside fenced code.

| Result | Current main | Exact head |
| --- | --- | --- |
| Delivered characters | 203 | 226, exact expected rendered text |
| `def log` indentation | column 0 | column 4 |
| `[worker] retrying` lines | 2 | 3 |
| Telegram code entities | 2 | 2 |
| Provider requests | 1 | 1 |
| Stored fenced transcript | exact | exact |

Exact delivered head text:

```text
Here is the retry loop and the log it produced:

class Worker:
    def run(self):
        self.log("retrying")

    def log(self, msg):
        print(msg)

[worker] retrying

[worker] retrying

[worker] retrying

[worker] done
```

The same run read the per-agent SQLite transcript before cleanup. It retained the original Markdown fences, indentation, and all three repeated lines.

### Tests and checks

- New regression test on current main: 3 expected failures for fenced bytes, initial indented code, and code-barrier reset.
- Current exact-head projection and sanitizer tests: 28 passed.
- Earlier full owner and sanitizer suites: 142 tests passed; delivery sibling suites: 228 tests passed.
- 12,960 generated code-free inputs matched the previous prose-collapse output.
- Oxfmt, Oxlint, and `git diff --check`: passed.
- Prior Codex Sol autoreview: no accepted or actionable P0 findings. The exact-head landing review runs after push.
- CI root-cause repair: required comparison bases now load during the authenticated checkout. The guard, protocol, and npm-lock lanes no longer fetch after credentials are removed. Workflow and Git lifecycle suites passed 416 tests, and workflow validation passed.
- CI flake repair: the lease cleanup test now uses the existing 10-second worker-lifecycle lease, so constrained runners cannot turn its abort assertion into an unrelated lease-expiry result. The focused owner suite passed 10 tests.
- Windows CI cleanup repair: terminal test-instance cleanup now reuses the existing force-tree path on Windows, so inherited Gateway pipes cannot outlive completed assertions. The shared helper suite passed 36 tests; exact Windows proof runs in CI.
- Lease worker startup repair: the process-exit test now uses the existing compiled test-subprocess owner instead of launching a TypeScript child that can exhaust the production heartbeat readiness deadline. State lease suites passed 14 tests; compiled-subprocess inventory passed 39 tests.
- ClawSweeper review repairs: the original incremental duplicate projector now owns continuation suffixes after parser-backed reconciliation. A code-bearing regression keeps parser calls at one across 256 appends. The abort test now awaits heartbeat-worker exit before checking that lease state stays unchanged.
- Hosted Chromium repair: the corner-shape browser probe now treats the computed CSS alias `superellipse(1)` as semantic `round`. All 3 focused browser tests passed locally; exact hosted proof runs in CI.
- Built-CLI proof repair: finite CLI commands now wait for child stream closure and retain complete output, while long-lived Gateway logs remain bounded. The exact failed artifact emitted 288,423 bytes beyond the old 262,144-byte cap. The inherited-pipe and 300 KiB regressions pass with all 38 shared helper tests.

## ClawSweeper Rank-Up Moves

- Applied the remaining merge-risk move: parser-backed masking remains the single canonical code-protection path, while the existing suffix fast path and direct sanitizer and streaming regressions remain in place.
- Applied the inline-code move: parser-owned block regions remain unique barriers, while identical inline spans reuse stable tokens and collapse as ordinary prose across static and partitioned streaming input.

Co-authored-by: Claude <[email protected]>
Co-authored-by: Ayaan Zaidi <[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 merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

outbound sanitizer: duplicate-block collapse de-indents and deletes lines inside fenced code in delivered replies

2 participants