Repository navigation
fix(telegram): keep table before blockquote/list as sibling, not nested or dropped - #168383
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 real behavior proof before merge. What this changesThis PR preserves parser-owned table boundaries so Telegram retains separate neighboring blocks and correctly nested tables. Example: A Brand/Status table containing Acme/waiting precedes “- follow up Acme” and “- send draft”.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: it repairs a concrete Telegram table-loss bug still present on current main, and no actionable code defect was found. Priority: P1 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherShared Markdown parsing produces text coordinates and table metadata; Telegram converts them into native rich blocks and plain-text recovery content for delivery. flowchart LR
A[Agent Markdown] --> B[Shared Markdown parser]
B --> C[Text coordinates and table metadata]
C --> D[Telegram rich block renderer]
D --> E[Delivery planner]
E --> F[Rich message]
E --> G[Plain recovery]
Technical reviewBest possible solution: Land the focused parser-owned boundary repair once the required Telegram evidence and normal landing gates are satisfied. Do we have a high-confidence way to reproduce the issue? Current-main source establishes both failures through coincident table offsets, container sorting, and list-item filtering; the reporter supplies official-release output, and the PR reports a production-revert negative control, but this read-only review executed no target code. Is this the best way to solve the issue? Preserving coordinates at the shared parser fixes the ownership ambiguity directly, supports trailing nested tables, and removes the Telegram-specific heuristic without changing configuration or transport contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 92a5349b3d91. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -11, Tests +74, Docs +2. Total +65 across 4 files. Added test files: 1. 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:
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 HistoryReviewed October 10, 2026, 5:31 PM ET / 21:31 UTC (Revision 3). |
Keep native-table coordinates through parser trimming so sibling blocks cannot claim or drop table content. Remove the Telegram table ownership heuristic and cover adjacent and trailing containers. Original fix by @dhruv1220; maintainer cleanup moves the repair to the shared Markdown parser and simplifies Telegram block planning. Co-authored-by: Dhruv Arora <[email protected]>
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…ed or dropped (openclaw#168383) Co-authored-by: Dhruv Arora <[email protected]>
…ed or dropped (#168383) Co-authored-by: Dhruv Arora <[email protected]> (cherry picked from commit c1d38ec)
…ed or dropped (#168383) Co-authored-by: Dhruv Arora <[email protected]> (cherry picked from commit c1d38ec)
Fixes #168366
What Problem This Solves
Fixes: Telegram rich replies nest a preceding Markdown table inside a following quote or silently omit it before a following list.
User Impact
Tables and their neighboring quotes, lists, headings, code blocks, and paragraphs retain their authored boundaries. Tables at the end of a quote or list also stay in their container. Rich delivery and the plain-text recovery path preserve every table value. No configuration, schema, protocol, or SDK surface changes are required.
Why This Change Was Made
A native table previously consumed no Markdown IR coordinates, allowing an unrelated following block to share its position. The parser now reserves one whitespace coordinate for each native table and preserves it through quote closure and final trimming. Telegram can use ordinary block ordering; its table-specific ownership heuristic is deleted. The quote boundary is calculated once for both style and structural metadata.
Original fix by @dhruv1220; maintainer cleanup moves boundary preservation to the shared Markdown parser, removes the renderer special case, and extends the regressions to sibling and trailing-container cases. The contributor's ancestry and human co-author credit are preserved.
Evidence
Validated head:
170f80fd67a7833d832543d82a1328628e6c6a0b, after merging main1041e5562854746ed2ebeac6aaf4fa89e1357397. Contributor code ran only on secretless Untrusted AWS leases using the clean-main bootstrap,--fresh-pr,--no-hydrate, no instance role, no Tailscale, andCRABBOX_ENV_ALLOW=CI. The explicitly requestedr7a.xlargeinstances provided approximately 31 GiB RAM.pnpm test extensions/telegram/src/rich-blocks-table-segments.test.ts --maxWorkers=1, 4.26 s wall time on leasecbx_f79179dc6dd7. The five requested adjacency cases, heading/code siblings, separate quotes, and trailing quote/list tables assert independent shapes and full content in both blocks andplainText.packages/markdown-core/src/ir.tsandextensions/telegram/src/rich-blocks.tswith the pinned main versions yields 5 failing / 5 passing cases in 3.54 s, including both reported defects. Tests remain unchanged. The contributor's original prefix heuristic also failed a separate-quotes probe before the rewrite.pnpm tsgo:core(70.43 s),pnpm tsgo:core:test packages(105.03 s, including extension declarations),pnpm tsgo:extensions(80.45 s), andpnpm tsgo:extensions:test(122.42 s). Remote oxfmt passes. Canonical CI changed lint passes, with the core lint shards also green. The manual all-files command usingoxlint.core.jsonincorrectly places Telegram outside its project and reports an unresolved existingMarkdownTableCell; the repository routes plugin lint throughextensions/tsconfig.json, and that correctly routed job passes. No source suppression or type workaround was added.Real Gateway delivery proof
Fresh lease
cbx_fb9af8f1df7freplayed the reporter's exact Markdown (including the bold quote and both list items) through a real isolated Gateway, the Telegram plugin, a loopback fake Telegram Bot API, and the QA mock OpenAI provider. Four main-production turns and four fixed-production turns passed: each reported input was delivered successfully as rich content and again through actual plain fallback after an injectedRICH_MESSAGE_ENTITY_INVALIDresponse. Main used the two production files reverted to the pinned base; fixed used the clean pushed head. Ports and state were isolated, and all subprocess groups were stopped.blockquote[table, paragraph]table, blockquote[paragraph]list(table absent)table, listFor the list case, main's actual fallback was only
• follow up Acme\n• send draft. The fix sendsBrand | Status\nAcme | waiting\n• follow up Acme\n• send draft. Headers, cell values, quote text, and both list items retain their authored counts in both corrected rich payloads and plain fallbacks;Acmeoccurs twice in the reported list input and twice after the fix. The four-turn runs took 89.97 s main / 87.49 s fixed, including startup. Another eight Gateway turns with unique content sentinels also passed on leasecbx_509169b55011. This proves Gateway and Telegram-plugin delivery against the fake API, not Telegram Test Server or client rendering.The first live harness attempt reached a successful send but waited for an outdated success-log message. The harness receipt matcher was corrected against the current send owner, then both modes passed on the fresh lease above. That attempt is not counted as passing live proof.
Remote commands and scope
Launches unset instance-profile and Tailscale environment overrides; the trusted bootstrap verifies the full head and IMDSv2 no-role boundary before installation. One command at a time ran per lease. All five task-owned leases (
cbx_45500c926b1d,cbx_b563ed605d6f,cbx_f79179dc6dd7,cbx_509169b55011,cbx_fb9af8f1df7f) returned successful stop receipts, including failed preliminary probes.Review and inherited CI failures
The latest full ClawSweeper review of this head found no code findings and rated the repair complete. Its missing behavior evidence and QA profile 2 attribution are supplied here. The campaign requires a secretless real Gateway with a fake Bot API; this evidence therefore does not claim Telegram Test Server or client rendering. Nested trailing tables are covered by the independent renderer regressions and full module tests. The original
check-lintjob114191625449failed only because oxfmt rejected the two original changed files; formatting is corrected and current canonical lint passes. There were no human review findings or inline comments.The current CI aggregate remains red for inherited QA failures, not claimed green.
subagent-completion-direct-fallbackfails its private-completion projection assertion;memory-dreaming-sweeptimes out after 180000 ms with no promotion bus events. Both also fail in scheduled main QA, at mainb66d8da2938da040a1db9a83851d80d59320ff5c.PR CI used merge
921c32d976882873d3e745e7568427ef47480b31(main6b5284f579371f0e372b6c1882f863df19ffdb57plus this head). It differs from that main parent only in this PR's four paths. The memory-core and memory-host-sdk trees and both scenario blobs match the independently failing main run. Both runs complete dreaming withcandidates=0, applied=0; the cause of missing candidates remains outside this renderer repair. The memory scenario does not send channel messages and uses the memory owner's separate line chunker, not this Markdown IR.Exact change size against the merged main base
packages/markdown-core/src/ir.tsextensions/telegram/src/rich-blocks.tsextensions/telegram/src/rich-blocks-table-segments.test.tsdocs/channels/telegram/rich-messages.mdProduction total +13/-24 = -11 LOC. No changelog edit; release-note context is preserved here. No merge performed.