Skip to content

fix(markdown): preserve task lists across chunk boundaries - #135200

Merged
steipete merged 5 commits into
mainfrom
codex/qa-20260901-markdown-composition
Sep 1, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/qa-20260901-markdown-composition

Conversation

@steipete

@steipete steipete commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where task-list messages gain an extra bullet when a rendered chunk boundary falls immediately before the item. At Google Chat's default 32,000-byte limit, the second delivered message could become \n\n* [x] done instead of \n\n[x] done.

Why This Change Was Made

Whitespace coalescing rebuilt Markdown IR from only text, styles, and links, discarding list and block metadata that later renderers need. Contiguous chunks now reuse the canonical source slicer; disjoint chunks and fallback edits share one append operation that preserves semantic metadata and authored coordinates. The duplicate partial append and span-merging paths are removed.

Meaningful whitespace is retained only when its rendered output is nonempty. Existing suppression of plain separators and empty attributed output remains intact, including Signal's fallback behavior. Production: +111/−144 (net −33). Tests: +702/−118 (net +584). Private QA support: +77/−28 (net +49); scenario: +127. QA support is excluded from the published package.

User Impact

Chunked messages retain their task-list structure, code and annotation content, and authored link boundaries. The change adds no configuration, dependency, or channel-specific production rule.

Related: #128615 and #127655 discuss lossless raw whitespace after unsuccessful coalescing. This repair also covers semantic whitespace, but its demonstrated task-list defect occurs during successful coalescing. It deliberately retains the existing treatment of unformatted separators and does not claim to resolve that broader raw-whitespace contract. The earlier trailing-inline-code fix in #134451 is preserved.

Evidence

The task-list regression failed before the repair with the extra bullet and passed afterward. The real guarded HTTP fixture exercises SDK dispatch, the required outbound queue, planning, formatting, the Google Chat adapter, and two captured POST bodies. Both exact bodies and the 32,000-byte bound pass. All eight transport cases pass together, including cancellation, dispatcher/socket cleanup, malformed UTF-8, and token-safe errors.

The earlier owner-sweep snapshot passed 192 tests across 16 Markdown suites. After CI exposed lint and test-boundary problems, the repair replaced three unnecessary type assertions with checked assignments, renamed a shadowed local, and removed a redundant Google Chat test from core infrastructure; the plugin-owned formatter and HTTP proofs remain. The 20 chunker and 40 formatter cases pass again, as do scoped type-aware lint, the assertion ratchet, and the core type-boundary check. Independent Codex review is clean.

The fixtures use loopback HTTP and synthetic authentication; this is not a hosted Google API or model-provider run. The initial CI also timed out in the unchanged ACP source-CLI exit test. That timeout remains unexplained and is not waived or addressed by increasing its deadline; the corrected head must pass required CI before landing.

The ClawSweeper link-boundary rank-up was checked with three additional real-parser/renderer tests: one authored link spanning retained whitespace, one spanning whitespace trimmed by attributed rendering, and two distinct adjacent authored links sharing a URL. All three pass. The requested link-merging change is not applied: contiguous source ranges are already coalesced before canonical slicing, so a spanning source link remains continuous within each output chunk. Merging by URL would instead fuse separately authored links. The new tests retain this distinction and verify each rendered payload stays within its limit. Independent Codex review of this test-only addition is clean; production code is unchanged.

The latest ClawSweeper finding about raw-whitespace loss is addressed: the assertion requiring dropped unformatted spaces was removed. The complete final 22-case chunker file passes, including semantic whitespace, task lists, attributed-output suppression, and the three authored-link cases. Scoped formatting and independent Codex review pass; production is unchanged.

The Telegram QA observer now preserves native text and formatting entities together through messages and edits, validates UTF-16 ranges, and exposes isolated snapshots for the registered telegram-semantic-formatting-boundaries scenario. The scenario checks literal whitespace, fenced-code chunk boundaries, checkbox labels, and native formatting entities through the normal Gateway send path. This QA addition changes no shipped production code.

Local validation passed: 9 Python cases, 21 TypeScript cases, 7 catalog/profile-selection cases, scoped formatting, the normal plugin source and test type checks, scoped lint, and independent managed Codex review with no actionable P0–P2 findings. Native Telegram Test Server proof passed on da56b8ca8263df6c445d879fbe7188515dbfba82 in workflow 33561650273. The leased-group Gateway send scenario completed with 1 passed, 0 failed, and 0 skipped scenarios. It observed exact native text and TDLib entity vectors for inline-code whitespace plus an emoji and link (UTF-16 offsets 3 and 9), two fenced-code chunks (3976 and 11 characters, with Pre entities), and two checkbox chunks (1994 characters each, Bold offset 6/length 1988). This uses the default 4000-character Telegram chunk limit. No model invocation is claimed. The redacted native evidence artifact contains the synthetic text and entity observations. All PR-head checks completed: 238 successful, 49 skipped, and 1 neutral, with no failures. This supplies the native-delivery evidence and green-CI rank-up requested in the latest ClawSweeper review.

The broader live-transport workflow also ran the default non-Telegram lanes and finished with failures; it is not an all-lanes-green result. Telegram and mock parity passed. The retained failures are Slack's disabled-channel log warning, Discord's missing reserved QA voice-channel ID, Matrix's CLI encryption-owner verification, and exhausted WhatsApp credential capacity. Inspection of the failing branches places each before the changed Markdown formatter runs; they remain separate follow-ups. The native Telegram evidence above refers specifically to the successful Telegram job and its exact-head artifact.

Compose canonical Markdown IR slices without losing list, block, annotation, or link metadata. Reuse one append owner for disjoint chunks and fallback edits, and retain semantic whitespace only when the rendered output is nonempty. Remove the duplicate partial metadata mergers.
@clawsweeper

clawsweeper Bot commented Sep 1, 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 channel: googlechat Channel integration: googlechat size: L maintainer Maintainer-authored PR labels Sep 1, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 6:10 PM ET / 22:10 UTC.

ClawSweeper review

What this changes

Recomposes Markdown chunk fragments from original source slices so list, block, link, and annotation metadata survive message-size boundaries, with Google Chat and Telegram coverage.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this maintainer-labeled PR open for normal maintainer review. Current main still uses the metadata-dropping chunk merger; this branch replaces it with canonical source slicing and includes head-pinned native Telegram proof.

Priority: P2
Reviewed head: da56b8ca8263df6c445d879fbe7188515dbfba82

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A canonical, net-negative shared repair with strong channel-facing proof; normal review should account for its multi-channel delivery surface.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The changed production owner is the shared rendered-size chunker; the captured exact-head Telegram Test Server run exercises Gateway send through the Telegram formatter and records the resulting native text and TDLib entities for whitespace, code, links, and task-list boundaries. The Google Chat SDK/HTTP regression complements that live channel proof with the reported 32,000-byte payload shape.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The changed production owner is the shared rendered-size chunker; the captured exact-head Telegram Test Server run exercises Gateway send through the Telegram formatter and records the resulting native text and TDLib entities for whitespace, code, links, and task-list boundaries. The Google Chat SDK/HTTP regression complements that live channel proof with the reported 32,000-byte payload shape.
Evidence reviewed 6 items Current-main implementation: At fetched main, the whitespace coalescer rebuilds adjacent chunks through a merger that only carries text, styles, links, and annotations; structural list and block metadata is absent from that merger.
Repair owner boundary: The branch centralizes slice recomposition in appendMarkdownIR and transfers list-item and block metadata alongside spans before the shared chunker renders a candidate.
Caller and regression coverage: Google Chat invokes the shared rendered-size chunker, and focused tests cover the default 32,000-byte task-list boundary plus semantic whitespace.
Findings None None.
Security None None.

How this fits together

The shared Markdown chunker turns parsed agent output into size-bounded channel payloads. Channel formatters consume those chunks for Google Chat, Telegram, Slack, Signal, and WhatsApp delivery.

flowchart LR
  source[Agent Markdown] --> parser[Markdown parser]
  parser --> chunker[Rendered-size chunker]
  chunker --> formatter[Channel formatter]
  formatter --> delivery[Google Chat and Telegram delivery]
  delivery --> observer[Native Telegram QA observer]
Loading

Before merge

  • Resolve merge risk (P1) - This shared chunker changes message construction for several channel formatters; the focused Google Chat checks and Telegram Test Server proof reduce, but do not eliminate, cross-channel delivery risk.
  • Complete next step (P2) - The PR already provides a bounded repair and real behavior proof; the remaining action is ordinary maintainer review rather than an automated repair job.
Agent review details

Security

None.

PR surface

Source +20, Tests +492, Other +215. Total +727 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 5 178 158 +20
Tests 5 594 102 +492
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 245 30 +215
Total 13 1017 290 +727

Review metrics

Metric Value Why it matters
Production versus proof delta shipped production −33 net; tests +584 net; QA/skill support +49 net; scenario +127 The shared repair is net-negative in shipped code while expanded boundary and native-channel coverage carries the proof burden.

Merge-risk options

Maintainer options:

  1. Review as a delivery-sensitive shared change (recommended)
    Accept the bounded residual cross-channel delivery risk after confirming the focused owner and channel evidence on this clean head.

Technical review

Best possible solution:

Land the canonical metadata-preserving shared chunker path after normal maintainer review, retaining the focused formatter and native Telegram regressions.

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

Yes—current main still contains the metadata-dropping merger, and the focused Google Chat boundary test encodes the failing 31,998-character input; this read-only review did not execute it.

Is this the best way to solve the issue?

Yes—the branch repairs recomposition at the shared Markdown IR owner by reusing canonical slicing instead of adding a Google Chat-specific workaround.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The changed production owner is the shared rendered-size chunker; the captured exact-head Telegram Test Server run exercises Gateway send through the Telegram formatter and records the resulting native text and TDLib entities for whitespace, code, links, and task-list boundaries. The Google Chat SDK/HTTP regression complements that live channel proof with the reported 32,000-byte payload shape.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded fix for malformed chunked channel output rather than an urgent availability or security incident.
  • merge-risk: 🚨 message-delivery: The shared rendered-size chunker feeds multiple channel formatters, so a semantic regression could alter delivered message structure.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The changed production owner is the shared rendered-size chunker; the captured exact-head Telegram Test Server run exercises Gateway send through the Telegram formatter and records the resulting native text and TDLib entities for whitespace, code, links, and task-list boundaries. The Google Chat SDK/HTTP regression complements that live channel proof with the reported 32,000-byte payload shape.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed production owner is the shared rendered-size chunker; the captured exact-head Telegram Test Server run exercises Gateway send through the Telegram formatter and records the resulting native text and TDLib entities for whitespace, code, links, and task-list boundaries. The Google Chat SDK/HTTP regression complements that live channel proof with the reported 32,000-byte payload shape.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. The PR adds observable Telegram formatting-boundary behavior and supplies a native Test Server scenario for it.

Evidence

What I checked:

Likely related people:

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

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 (6 earlier review cycles)
  • reviewed 2026-09-01T12:57:04.055Z sha 65bc68b :: needs maintainer review before merge. :: none
  • reviewed 2026-09-01T13:10:50.084Z sha 65bc68b :: needs maintainer review before merge. :: none
  • reviewed 2026-09-01T13:38:12.501Z sha 9552690 :: found issues before merge. :: [P2] Merge contiguous link spans after recomposition
  • reviewed 2026-09-01T15:23:17.977Z sha 7d02f04 :: found issues before merge. :: [P2] Do not lock dropped whitespace into the chunker contract
  • reviewed 2026-09-01T15:56:37.601Z sha 6e6d92d :: needs maintainer review before merge. :: none
  • reviewed 2026-09-01T21:41:25.333Z sha da56b8c :: needs maintainer review before merge. :: none

Use checked metadata assignments and an unshadowed source-range name. Retain the plugin formatter and HTTP regressions while removing the duplicate plugin import from the core outbound planner test graph.
@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. 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. and removed 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. labels Sep 1, 2026
@clawsweeper clawsweeper Bot added the proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. label Sep 1, 2026
@clawsweeper clawsweeper Bot added 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: 🦐 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 1, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 1, 2026
@clawsweeper clawsweeper Bot added the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Sep 1, 2026
@steipete
steipete merged commit a9469a2 into main Sep 1, 2026
300 checks passed
@steipete
steipete deleted the codex/qa-20260901-markdown-composition branch September 1, 2026 22:14
@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

* fix(markdown): preserve task lists across chunk boundaries

Compose canonical Markdown IR slices without losing list, block, annotation, or link metadata. Reuse one append owner for disjoint chunks and fallback edits, and retain semantic whitespace only when the rendered output is nonempty. Remove the duplicate partial metadata mergers.

* fix(markdown): keep composition proof in its owning test graph

Use checked metadata assignments and an unshadowed source-range name. Retain the plugin formatter and HTTP regressions while removing the duplicate plugin import from the core outbound planner test graph.

* test(markdown): preserve authored link boundaries during chunking

* test(markdown): avoid codifying dropped whitespace

* test(qa): verify native Telegram formatting boundaries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: googlechat Channel integration: googlechat extensions: qa-lab maintainer Maintainer-authored PR merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. 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. size: XL 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.

1 participant