Skip to content

fix(line): preserve semantic indentation in fenced code - #117996

Merged
steipete merged 1 commit into
mainfrom
codex/auto-qa-line-code-indent-aeaa
Aug 2, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/auto-qa-line-code-indent-aeaa

Conversation

@steipete

@steipete steipete commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

LINE code cards silently removed leading spaces and tabs from fenced source code, changing Python indentation and other whitespace-sensitive examples before delivery.

Why This Change Was Made

The existing Markdown/LINE code-card owner used a full trim() even though Markdown parsing already preserved the code content. Replacing it with trimEnd() keeps meaningful leading whitespace while preserving the established trailing-newline behavior; there is no new abstraction or product configuration.

User Impact

Code examples sent through both normal LINE outbound delivery and automated replies retain their original indentation, tabs, and Unicode characters.

Exact-Head Proof

  • Parent: aeaaaad4d045755f870e048fe697a113bb69af6c.
  • Reviewed candidate: 2c0c9f012f5192d0fd9ab56077fa7f90ad5c97cd.
  • Authentic unchanged-parent RED: 3 failed / 31 passed in the real LINE Markdown-to-Flex owner. The trailing-newline fixture also contains leading indentation; it is counted honestly as a third manifestation of the same indentation root, not as an independent control.
  • Exact-head GREEN: 233/233 passing across seven actual LINE suites: real Markdown/Flex owner, outbound send, automated replies, retry/recovery, real LINE SDK card provider, and loopback protocol delivery.
  • pnpm tsgo:extensions and pnpm tsgo:extensions:test both pass; scoped type-aware lint and formatting pass. The single dedicated Testbox lease was explicitly stopped and independently verified completed.
  • Proof: https://github.com/openclaw/openclaw/actions/runs/30750449729.
  • Final exact-head required openclaw/ci-gate passed; latest ClawSweeper independently rates the real parent/head evidence proof: sufficient.
  • Four fresh independent hostile reviewers found no P0–P3 defects. Official gpt-5.6-sol high-reasoning review explicitly included --max-priority P3; real TruffleHog is clean.
  • Production delta: one existing line replaced; no dependency, security, config, protocol, or persistence change.

Maintainer Decision

Explicit repository-owner authorization covers this independently proved, low-risk, one-owner correction.

Agent Transcript

Agent-assisted owner refactor and real regression proof; independently reviewed by four fresh source reviewers and explicit Sol/high P0–P3 review. No credentials or private reasoning are included.

@openclaw-barnacle openclaw-barnacle Bot added channel: line Channel integration: line size: XS maintainer Maintainer-authored PR labels Aug 2, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 9:54 AM ET / 13:54 UTC.

ClawSweeper review

What this changes

The PR changes LINE fenced-code cards to retain leading indentation while still removing trailing whitespace, with regression coverage for spaces, tabs, Unicode, and terminal newlines.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for normal maintainer landing. Current main still removes leading whitespace from LINE fenced-code cards at the producing boundary; the proposed trimEnd() repair is narrow, covered by focused regression cases, and does not introduce a new product surface. The maintainer label is a protected signal, so automated cleanup should not close or dispatch it.

Priority: P2
Reviewed head: 2c0c9f012f5192d0fd9ab56077fa7f90ad5c97cd

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) This is a focused, owner-boundary regression repair with direct real-path proof and targeted behavior coverage.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The PR body provides an exact-head Testbox run showing the real LINE Markdown-to-Flex path failing on its parent and passing after the fix, and the supplied check context marks real-behavior proof successful.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR body provides an exact-head Testbox run showing the real LINE Markdown-to-Flex path failing on its parent and passing after the fix, and the supplied check context marks real-behavior proof successful.
Evidence reviewed 6 items Current-main defect: Current main extracts fenced-code text with trim(), which removes meaningful leading spaces and tabs before rendering the Flex code card.
Visible delivery owner: processLineMessage converts each fenced-code span through toCodeBlock into a Flex card and records it in the source-ordered message output, so repairing extraction fixes both normal delivery routes that consume this helper.
Parser contract: The LINE options explicitly preserve source block spacing, while the Markdown-core parser renders code-block token content into the intermediate representation; the local full trim is the remaining owner that discards leading indentation.
Findings None None.
Security None None.

How this fits together

OpenClaw’s LINE plugin parses outbound Markdown into an intermediate representation, turns fenced blocks into Flex code cards, and sends those cards through normal reply and outbound delivery. The changed extraction boundary determines the exact code text recipients see.

flowchart LR
  A[Assistant Markdown reply] --> B[LINE Markdown parser]
  B --> C[Fenced code span]
  C --> D[LINE code-card conversion]
  D --> E[Flex code card]
  E --> F[LINE delivery]
Loading

Before merge

  • Resolve merge risk (P1) - GitHub reports the branch as behind main; refresh the exact merged head and its focused proof before landing, without treating ordinary base drift as a behavioral regression.
  • Complete next step (P2) - The patch is correct, but the protected maintainer label requires normal human maintainer review and exact-head merge gating rather than automated repair or cleanup.
Agent review details

Security

None.

PR surface

Source 0, Tests +26. Total +26 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 1 26 0 +26
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 27 1 +26

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the owner-boundary trimEnd() correction after rebasing or otherwise refreshing the exact merge head and confirming the focused LINE proof still passes.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the owner-boundary trimEnd() correction after rebasing or otherwise refreshing the exact merge head and confirming the focused LINE proof still passes.

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

Yes. Passing a fenced block containing leading spaces or tabs through processLineMessage on current main reaches trim() before Flex-card rendering, which source proves removes that indentation; the read-only review did not execute the test suite locally.

Is this the best way to solve the issue?

Yes. toCodeBlock owns the card’s text boundary, so replacing its full trim with trimEnd() repairs the loss at the producer while retaining the established trailing-whitespace behavior.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: The defect can alter whitespace-sensitive code displayed to LINE users, but its blast radius is limited to LINE fenced-code cards.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an exact-head Testbox run showing the real LINE Markdown-to-Flex path failing on its parent and passing after the fix, and the supplied check context marks real-behavior proof successful.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body provides an exact-head Testbox run showing the real LINE Markdown-to-Flex path failing on its parent and passing after the fix, and the supplied check context marks real-behavior proof successful.

Label justifications:

  • P2: The defect can alter whitespace-sensitive code displayed to LINE users, but its blast radius is limited to LINE fenced-code cards.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body provides an exact-head Testbox run showing the real LINE Markdown-to-Flex path failing on its parent and passing after the fix, and the supplied check context marks real-behavior proof successful.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an exact-head Testbox run showing the real LINE Markdown-to-Flex path failing on its parent and passing after the fix, and the supplied check context marks real-behavior proof successful.

Evidence

What I checked:

  • Current-main defect: Current main extracts fenced-code text with trim(), which removes meaningful leading spaces and tabs before rendering the Flex code card. (extensions/line/src/markdown-to-line.ts:77, 0ac3368c8f44)
  • Visible delivery owner: processLineMessage converts each fenced-code span through toCodeBlock into a Flex card and records it in the source-ordered message output, so repairing extraction fixes both normal delivery routes that consume this helper. (extensions/line/src/markdown-to-line.ts:461, 0ac3368c8f44)
  • Parser contract: The LINE options explicitly preserve source block spacing, while the Markdown-core parser renders code-block token content into the intermediate representation; the local full trim is the remaining owner that discards leading indentation. (extensions/line/src/markdown-to-line.ts:45, 0ac3368c8f44)
  • Regression coverage: The proposed table-driven test exercises the public LINE message processor and asserts preserved leading spaces, leading tabs with Unicode, and unchanged terminal-newline trimming in the rendered Flex code text. (extensions/line/src/markdown-to-line.test.ts:227, 2c0c9f012f51)
  • Feature and release provenance: git blame ties the full-trim behavior to the native LINE code-card introduction. That commit is contained by main and no release tag contains it, so the defect is current-main-only rather than a proven shipped-release regression. (extensions/line/src/markdown-to-line.ts:77, 8fb9dcd54e07)
  • Supplied real-path proof: The PR body records parent RED and exact-head GREEN runs through the real LINE Markdown-to-Flex owner plus delivery-related suites, and the supplied check context marks the Real behavior proof job successful. (extensions/line/src/markdown-to-line.test.ts:227, 2c0c9f012f51)

Likely related people:

  • Shakker: Blame attributes the code-block extraction with full trimming to the commit that introduced this native LINE code-card path. (role: introduced current behavior; confidence: high; commits: 8fb9dcd54e07; files: extensions/line/src/markdown-to-line.ts)
  • Peter Steinberger: Directory history shows repeated direct LINE fixes and refactors, including a recent LINE-specific delivery fix, making this a reasonable review-routing candidate alongside the code-path introducer. (role: recent adjacent contributor; confidence: medium; commits: 3550d3140e5a, 75cd0efb0454; files: extensions/line/src)

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.

@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review — exact-head parent-red/233-test-green, real LINE SDK, loopback delivery, extension production+test types, and clean P0–P3 review evidence are already in the PR body.

@clawsweeper

clawsweeper Bot commented Aug 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 repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete merged commit bd86a69 into main Aug 2, 2026
104 of 115 checks passed
@steipete
steipete deleted the codex/auto-qa-line-code-indent-aeaa branch August 2, 2026 13:59
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 2, 2026
* origin/main:
  fix(ui): label Gateway connection settings for accessibility (#118000)
  ci(qa): extend profile evidence timeout (#117999)
  fix(googlechat): report a blocked account instead of a webhook path that was never bound (#117986)
  fix(line): preserve semantic indentation in fenced code (#117996)
  fix(plugins): contain rejected synchronous hook results (#117988)
  fix(cli): preserve shell profiles when completion install fails (#117987)
  fix(tui): preserve legitimate consecutive backspaces (#117989)
  fix: preserve queued messages during /compact (#117840)
  fix(talk): enforce relay lifecycle bounds
  fix(talk): enforce relay terminal precedence
  test(talk): cover relay tool-call retention overflow
  fix(talk): bound relay tool-call lifecycle state
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
* origin/main:
  fix(ui): label Gateway connection settings for accessibility (openclaw#118000)
  ci(qa): extend profile evidence timeout (openclaw#117999)
  fix(googlechat): report a blocked account instead of a webhook path that was never bound (openclaw#117986)
  fix(line): preserve semantic indentation in fenced code (openclaw#117996)
  fix(plugins): contain rejected synchronous hook results (openclaw#117988)
  fix(cli): preserve shell profiles when completion install fails (openclaw#117987)
  fix(tui): preserve legitimate consecutive backspaces (openclaw#117989)
  fix: preserve queued messages during /compact (openclaw#117840)
  fix(talk): enforce relay lifecycle bounds
  fix(talk): enforce relay terminal precedence
  test(talk): cover relay tool-call retention overflow
  fix(talk): bound relay tool-call lifecycle state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: line Channel integration: line maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS 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