Skip to content

fix: preserve emphasis in Markdown table row labels - #205349

Merged
vincentkoc merged 7 commits into
mainfrom
fix/markdown-table-intraword-strong-row-label-c34
Nov 27, 2026
Merged

vincentkoc merged 7 commits into
mainfrom
fix/markdown-table-intraword-strong-row-label-c34

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

When OpenClaw converts a Markdown table to bullets, it makes the first column of each row bold. A label written as pre**fix** could display as prefix**** with only pre bold. A mix of adjacent italic and bold text could also expose asterisks.

User Impact

The entire label reads prefix. In x*old***a**_b_, all of xoldab is bold, with italics on old and b. The following line keeps its own formatting. Teams preserves CJK italics on either side of the repaired span, and Matrix keeps the authored destination of a bare URL such as https://example.com/a_b.

Why This Change Was Made

The bullet formatter keeps the authored spelling whenever adding bold preserves its text and formatting. For labels that need repair, the shared Markdown renderer carries italics and strikethrough across the affected text. Code delimiters, reference keys, link destinations, and escaped punctuation keep their authored syntax. For labels with multiple inline constructs, the formatter copies unaffected source slices and repairs the strong delimiters within the affected slice. It uses the shared CJK emphasis rules to locate those boundaries. When the constructs touch, the formatter compares the rendered text, link destinations and ranges, and coverage of each non-bold style. If formatting changes their meaning, it can remove just the redundant strong delimiters from the authored source and check an alternate bold wrapper. This builds on the earlier table-cell source preservation work. Earlier table-cell repair

Evidence

  • Replayed the original failing case and its minimized example. The property passed 10,000 distinct cases at seed 46113.
  • Compared the shared formatter and single serialized messages from the normal Discord sender against the authored text and per-character styles. All 2,791 comparisons passed, including 1,350 adjacent-format cases and 504 strike cases. Every previously correct spelling in these samples was retained.
  • Verified the whole strike across two italic words and the space around a bold word, and a struck reference link next to italics. Checked code, literal punctuation, the following row value, and single-column, off, and code table modes.
  • The first hosted plugin-SDK declaration build flagged a possibly undefined indexed run. The comparison now checks that the run exists before reading its styles. All 2,791 comparisons and 10,000 generated cases passed again after that change.
  • Hosted plugin-SDK declarations passed after the undefined guard. Core lint then flagged the unbraced return that keeps an already-correct label. The follow-up adds the two braces. Targeted native lint and formatting passed, as did all 2,791 comparisons and 10,000 generated cases on that change.
  • Earlier revisions passed hosted core lint, plugin-SDK declarations, and the table suite. On this update, all 2,791 shared and serialized Discord comparisons and all 10,000 property cases passed. The Discord sender preserved literal Japanese stars, full-label bold, adjacent italics, and contiguous strikethrough split across two authored spans.
  • Captured the normal Teams activity and Matrix event for adjacent constructs. For pre**fix**前*斜体:*后, Teams kept the full label bold and 斜体: italic. For pre**fix**(https://example.com/a_b), Matrix kept the exact URL in both the link text and destination. Independent review passed all 40 original and 36 combined Teams/Matrix controls.
  • On the November 25 head, core lint identified a mutating sort in the style-span comparison. The one-line correction uses toSorted. All 4,096 deterministic baseline/candidate projections matched and retained their input spans. The repository format check, source syntax check and normal commit hook passed. All 26 registered table tests and the previously failing core lint job passed on this revision. The sender checks above used synthetic transports.

Multiword label compatibility

On f95af114, the formatter checks the full label after reconstructing its parts. Adding a trailing word to the two adjacent-markup examples reproduced the review findings on the previous revision. Its table suite passed 26 cases and failed exactly the two added regressions. The corrected source passed all 28 cases in Vitest 5.0.5. The Teams formatter kept the CJK text italic. Matrix emitted the authored https://example.com/a_b destination with no added backslash. Both single-word controls stayed byte-identical and the following price row remained intact. These results exercise the real formatter and serialization code with synthetic input. Current-head hosted qualification is pending.

@vincentkoc vincentkoc self-assigned this Nov 25, 2026
@clawsweeper

clawsweeper Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. labels Nov 25, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 25, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 25, 2026
@clawsweeper

clawsweeper Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR repairs generated bold formatting around Markdown table row labels while preserving authored inline formatting.

Example: Convert a two-column table containing the row label prefix to bullets.

  • Before: The generated bold delimiters expose asterisks and leave part of the label unbolded.
  • After: The entire word prefix appears bold without visible delimiters.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) A useful repair with focused regression coverage, but two existing compatibility findings remain unresolved and real channel behavior is unproven.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Table row labels can display stray asterisks or lose intended bold and italic formatting.
Reason: Preserving authored text and formatting restores an existing rendering contract, and the maintainer-authored PR establishes direction.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep this PR open: it addresses a current rendering bug, but the earlier CJK and URL regressions remain reachable in multiword labels.

Reviewed head: 662b5244a43875631225a701a2c4921a3e62bc61

Before merge

  • Preserve CJK emphasis in repaired slices of multiword labels (P2) - The earlier CJK finding remains reachable with | Name | Price |\n| --- | --- |\n| pre**fix**前*斜体:*后 tail | 4 | in bullets mode. The trailing space creates multiple slices, bypassing the new single-slice semantic check. This branch passes the first slice through the plain parser and reconstructs it with escaped CJK stars, producing prefix前\*斜体:\*后 inside the generated bold label. Teams protects those escapes before its CJK-aware parse, so previously supported italics become literal asterisks. Preserve the neighboring source when repairing a slice as well as when repairing the complete label.
  • Keep bare URL destinations intact in repaired multiword labels (P2) - The earlier URL finding remains reachable with | Name | Price |\n| --- | --- |\n| pre**fix**(https://example.com/a_b) tail | 4 | in bullets mode. Whitespace selects the multiple-slice branch, where reconstructing the first slice escapes the URL underscore to a\_b. The local checks use the same non-linkifying parser and therefore accept that rewrite, while Matrix linkifies the resulting Markdown afterward and no longer receives the authored destination bytes. Apply source preservation to affected slices instead of restricting the URL-aware semantic check to whole labels without whitespace.

Findings

  • [P2] Preserve CJK emphasis in repaired slices of multiword labels — packages/markdown-core/src/tables.ts:231-238
  • [P2] Keep bare URL destinations intact in repaired multiword labels — packages/markdown-core/src/tables.ts:235-238

Tests

  • Missing end-to-end proof: Provide sanitized before/after channel captures showing repaired labels, preserved adjacent CJK italics, and unchanged URL destinations; redact credentials, IPs, phone numbers, and non-public endpoints.
Agent review details

How this fits together

The shared Markdown table converter turns parsed tables into fallback Markdown, which channel formatters then interpret using their own emphasis and linkification rules.

flowchart LR
A[Authored Markdown table] --> B[Shared table parser]
B --> C[Bullet table converter]
C --> D[Row label repair]
D --> E[Channel formatter]
E --> F[Rendered message]
Loading

Technical review

Best possible solution:

Repair generated bold delimiters while preserving adjacent authored syntax consistently in both the single-slice and multiple-slice paths.

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

Source inspection establishes the original raw-wrapper defect on main and the remaining multiple-slice regression paths; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The shared converter is the appropriate repair boundary, but its multiple-slice branch still rewrites neighboring syntax without the preservation checks added for single-slice labels.

Full review comments:

  • [P2] Preserve CJK emphasis in repaired slices of multiword labels — packages/markdown-core/src/tables.ts:231-238
    The earlier CJK finding remains reachable with | Name | Price |\n| --- | --- |\n| pre**fix**前*斜体:*后 tail | 4 | in bullets mode. The trailing space creates multiple slices, bypassing the new single-slice semantic check. This branch passes the first slice through the plain parser and reconstructs it with escaped CJK stars, producing prefix前\*斜体:\*后 inside the generated bold label. Teams protects those escapes before its CJK-aware parse, so previously supported italics become literal asterisks. Preserve the neighboring source when repairing a slice as well as when repairing the complete label.
    Confidence: 0.98
  • [P2] Keep bare URL destinations intact in repaired multiword labels — packages/markdown-core/src/tables.ts:235-238
    The earlier URL finding remains reachable with | Name | Price |\n| --- | --- |\n| pre**fix**(https://example.com/a_b) tail | 4 | in bullets mode. Whitespace selects the multiple-slice branch, where reconstructing the first slice escapes the URL underscore to a\_b. The local checks use the same non-linkifying parser and therefore accept that rewrite, while Matrix linkifies the resulting Markdown afterward and no longer receives the authored destination bytes. Apply source preservation to affected slices instead of restricting the URL-aware semantic check to whole labels without whitespace.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7c15131629bd.

Provenance checked

  • Authored cell Markdown and generated row-label bold changes intended behavior with a stated reason (5d1a419: Preserve source bytes, inline literals, and document references instead of round-tripping whole messages through a generic renderer.)
  • Inline placement of table rendering keeps the original intent (0843b94: Fold single-consumer assembly helpers into their existing owners without changing behavior.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 5d1a419 adds packages/markdown-core/src/tables.ts:38 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5d1a4193ef88; files: packages/markdown-core/src/tables.ts)

PR surface

Source +257, Tests +110. Total +367 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 259 2 +257
Tests 1 110 0 +110
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 369 2 +367

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • merge-risk: 🚨 compatibility: Affected multiword labels can lose previously supported Teams CJK italics or change Matrix bare-URL destinations.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-25T13:20:41.136Z sha 1207946 :: needs changes before merge. :: [P2] Preserve CJK emphasis when reconstructing a repaired label | [P2] Keep bare URL destinations unchanged during label repair
  • reviewed 2026-11-25T14:30:59.426Z sha ad04d1c :: needs changes before merge. :: [P2] Preserve CJK emphasis inside an unsplit repaired label | [P2] Keep bare URL bytes intact in an unsplit repaired label

Reviewed November 25, 2026, 10:05 AM ET / 15:05 UTC (Revision 3).

@vincentkoc
vincentkoc marked this pull request as ready for review November 25, 2026 14:23
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vincentkoc
vincentkoc merged commit 58aa479 into main Nov 27, 2026
106 checks passed
@vincentkoc
vincentkoc deleted the fix/markdown-table-intraword-strong-row-label-c34 branch November 27, 2026 07:32
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Nov 27, 2026
…restoration-ci-189390-20261127

* commit '6feeb50a3f14fbf0aa5167d342f186dc4d67fc18': (9846 commits)
  fix: stop 2026-11-17 main Git checkouts from half-switching on a schema update (#206341)
  refactor(codex): centralize native completion delivery (#206447)
  fix(subagents): finish claimed stops after session rotation (#206405)
  fix: let owners fork a chat with exec after a subagent or exec completion (#206483)
  test(cli): gate agent --local cold-start processes and workers (#206466)
  perf(ci): skip baseline inventory when line-cap debt is empty (#189909)
  refactor(test): share core process-result fixtures (#174149)
  refactor(ci): reuse canonical budget flag parsing (#189480)
  fix: recover Codex chats after oversized requests (#206475)
  fix(agents): skip the bootstrap ritual in one-shot runs (#206477)
  fix(test): preserve stack coordinates in redacted failure reports (#152384)
  fix(gateway): return consistent unavailable response guidance (#191933)
  fix: preserve emphasis in Markdown table row labels (#205349)
  fix(nextcloud-talk): keep webhook spool helpers private (#206470)
  perf(plugins): overlay native receipts once per visible root (#206464)
  fix: keep GitHub comment approvals alive and skip repeat approval on the session PR (#206129)
  perf(config): retain one snapshot for unchanged validation results (#206465)
  refactor(test): reuse canonical secret fixture cleanup (#189492)
  refactor(subagents): own descendant Stop cancellation (#206444)
  refactor(subagents): keep announce cleanup action type private (#206407)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 28, 2026
* fix: preserve emphasis in Markdown table row labels

* fix: narrow indexed Markdown row label runs

* fix(markdown): brace the table label return

* fix(markdown): preserve neighboring row label source

* fix(markdown): preserve adjacent table label source when formatting loses meaning

* fix: keep Markdown row label sorting immutable

* fix: preserve emphasis and URLs in multiword table labels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant