Skip to content

fix(line): give up a card LINE will refuse instead of losing the reply - #135229

Merged
steipete merged 2 commits into
openclaw:mainfrom
edenfunf:fix/line-flex-bubble-budget
Sep 2, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
edenfunf:fix/line-flex-bubble-budget

Conversation

@edenfunf

@edenfunf edenfunf commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Generated LINE cards larger than LINE's 30 KB serialized bubble limit can reject the entire reply. The existing text fallback is never selected when the renderer returns an oversized native card.

Why This Change Was Made

The LINE card renderer now uses the same UTF-8 JSON byte predicate as Markdown table conversion. An oversized generated card returns null so the existing presentation fallback preserves the answer, title and control labels. The shared 30 KB bubble and 50 KB carousel constants introduced for custom-card normalization remain intact.

Production is +10/-7 (net +3); tests are +48. The three added production lines carry one platform-cap contract at the native renderer boundary after removing duplicate byte-limit ownership. No config, dependency, storage, schema or public API changes are introduced. ClawSweeper's serialized-state heuristic does not apply to these transient outgoing HTTP payloads; there is no persisted data migration.

User Impact

Cards within the limit remain native. Oversized cards become chunked text containing the full reply and control labels. Existing Markdown tables and custom-card normalization preserve their behavior.

Evidence

The independently authored candidate was tested on canonical main d225e672bd216d87be6098e732e7acff4c7c7cd3. The pre-fix owner produced two expected overflow failures with twenty-seven controls passing. The fixed rich-message and Markdown-table suites passed 82 tests, including the independently landed quick-reply HTTP delivery matrix; the full build and all changed-file gates completed with exit 0. Fresh candidate autoreview found no P0 issue. The completed Testbox run is https://github.com/openclaw/openclaw/actions/runs/33567661996.

An actual built ephemeral Gateway drove the production LINE path against a synthetic LINE HTTP API and mock provider. A signed webhook/model reply control passed. A generated card of exactly 30,000 bytes stayed native; 30,001-byte and UTF-8 30,002-byte cards became seven and three accepted text messages respectively, with answer/title/control content preserved. Temporary Gateway state was removed. This is real application-flow proof with mocked external services, not an authenticated LINE service run.

{"passed":true,"cases":[{"bubbleBytes":30000,"nativeFlex":true,"acceptedRequests":2},{"bubbleBytes":30001,"nativeFlex":false,"textMessages":7},{"bubbleBytes":30002,"utf8":true,"nativeFlex":false,"textMessages":3}],"answerAndControlContentPreserved":true,"gatewayTemporaryStateRemoved":true}

This candidate preserves the quick-reply prompt and overflow implementation independently merged by #134976 in canonical main d225e672bd216d87be6098e732e7acff4c7c7cd3. Native integration and exact-head CI are tracked separately; this recorded execution is bound to the stated baseline and frozen candidate hashes.

The platform size contract was checked directly in LINE's Messaging API reference. This addresses the review's missing primary-contract lookup; the production diff is reduced from +15 to +3 without changing the intended fallback behavior.

Closes #135228. Original contribution by @edenfunf.

@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: line Channel integration: line size: S labels Sep 1, 2026
@edenfunf
edenfunf marked this pull request as ready for review September 1, 2026 13:31
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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. 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, 9:15 PM ET / September 2, 2026, 01:15 UTC.

ClawSweeper review

What this changes

The PR rejects generated LINE Flex cards whose serialized UTF-8 JSON exceeds LINE’s per-bubble limit, allowing the existing text fallback to deliver the reply and control labels.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No blocking correctness finding in this focused LINE delivery repair. Keep this PR open for normal maintainer review; the local partial clone could not hydrate the latest main blobs, so exact-current-main equivalence remains a reviewer limitation rather than a contributor defect.

Priority: P1
Reviewed head: 853cbaddf1dc5bac3a52d1e8ffce07ac87bd0b0a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with useful exact-boundary coverage and sufficient synthetic-transport Gateway proof.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): The changed owner is the generated-card branch of the LINE presentation renderer; supplied Gateway proof exercises that production path against a synthetic LINE HTTP API and records accepted text fallback above the limit with preserved content.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The changed owner is the generated-card branch of the LINE presentation renderer; supplied Gateway proof exercises that production path against a synthetic LINE HTTP API and records accepted text fallback above the limit with preserved content.
Evidence reviewed 6 items Renderer boundary: The introduced guard rejects only an oversized generated action-card bubble before native payload construction; the existing fallback path handles a null render result.
Both delivery paths retain fallback: Direct auto-replies fall back in prepareLineReplyPayload, while the generic outbound presentation caller converts a null channel render into full presentation text.
Boundary regression coverage: The added table-driven test covers exactly 30,000 bytes plus one-byte and multibyte overflow, asserting native delivery at the boundary and text fallback with answer and label preservation above it.
Findings None None.
Security None None.

How this fits together

The LINE plugin converts agent reply presentations into native Flex cards or fallback text before sending them through LINE’s outbound transport. This change adds the platform-size decision at the generated-card boundary so an oversized card does not cause the entire reply to be rejected.

flowchart LR
  A[Agent reply presentation] --> B[LINE presentation renderer]
  B --> C{Bubble within 30 KB?}
  C -->|Yes| D[Native Flex card]
  C -->|No| E[Text fallback]
  D --> F[LINE outbound delivery]
  E --> F
  F --> G[LINE Messaging API]
Loading

Before merge

  • Resolve merge risk (P1) - The production delta is +3 lines for a bug fix; it is presently justified by one shared platform-limit predicate at the renderer boundary, with no clear net-neutral absorption found.
  • Resolve merge risk (P1) - The local checkout could not hydrate the fetched current-main blobs because its promisor remote could not resolve GitHub, so current-main source equivalence should be reconfirmed during the normal exact-head merge gate.
  • Complete next step (P2) - This open PR already owns the linked repair and has no discrete automated follow-up.
Agent review details

Security

None.

PR surface

Source +3, Tests +48. Total +51 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 10 7 +3
Tests 1 48 0 +48
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 58 7 +51

Review metrics

Metric Value Why it matters
Production versus tests production +3/-7; tests +48/-0 The small production increase centralizes an existing byte-limit rule, while the new tests cover exact and multibyte boundaries.

Stored data model

Persistent data-model change detected: serialized state: extensions/line/src/flex-templates/message.ts, serialized state: extensions/line/src/markdown-to-line.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #135228
Summary: This PR is the candidate repair for the linked oversized generated Flex-card delivery failure.

Members:

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land one shared UTF-8 bubble-size predicate at the LINE renderer boundary so oversized generated cards consistently use the established content-preserving text fallback.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land one shared UTF-8 bubble-size predicate at the LINE renderer boundary so oversized generated cards consistently use the established content-preserving text fallback.

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

Yes, at source level: a presentation with buttons and a generated bubble over 30,000 serialized UTF-8 bytes reaches the pre-fix native-card path, while the related report records LINE’s rejection. This review did not rerun that external request.

Is this the best way to solve the issue?

Yes. Rejecting the generated card at its renderer boundary lets both existing fallback owners preserve the whole reply; transport-time recovery would occur after a rejected native request, and truncation would lose content.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: The repaired path can silently lose a complete LINE reply when the platform rejects an oversized Flex card.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 owner is the generated-card branch of the LINE presentation renderer; supplied Gateway proof exercises that production path against a synthetic LINE HTTP API and records accepted text fallback above the limit with preserved content.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed owner is the generated-card branch of the LINE presentation renderer; supplied Gateway proof exercises that production path against a synthetic LINE HTTP API and records accepted text fallback above the limit with preserved content.

Evidence

What I checked:

  • Renderer boundary: The introduced guard rejects only an oversized generated action-card bubble before native payload construction; the existing fallback path handles a null render result. (extensions/line/src/rich-messages.ts:215, 853cbaddf1dc)
  • Both delivery paths retain fallback: Direct auto-replies fall back in prepareLineReplyPayload, while the generic outbound presentation caller converts a null channel render into full presentation text. (src/channels/plugins/outbound/presentation-delivery.ts:57, 853cbaddf1dc)
  • Boundary regression coverage: The added table-driven test covers exactly 30,000 bytes plus one-byte and multibyte overflow, asserting native delivery at the boundary and text fallback with answer and label preservation above it. (extensions/line/src/channel.rich-messages.test.ts:117, 853cbaddf1dc)
  • Shared invariant: Markdown-table conversion already substitutes text when a Flex bubble exceeds the same predicate; this PR centralizes that byte calculation rather than creating a parallel limit. (extensions/line/src/markdown-to-line.ts:452, 853cbaddf1dc)
  • Related merged history: The earlier quick-reply preservation repair is an ancestor of this head, so this branch retains that renderer work rather than reverting it. (extensions/line/src/rich-messages.ts:190, d225e672bd21)
  • Runtime proof supplied: The PR body records an ephemeral Gateway using the production LINE path against a synthetic HTTP API: a 30,000-byte card stayed native, while larger ASCII and UTF-8 cards became accepted text messages with reply and control content preserved. (853cbaddf1dc)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • edenfunf: 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 (1 earlier review cycle)
  • reviewed 2026-09-01T14:56:31.172Z sha 292c412 :: needs maintainer review before merge. :: none

Share the existing UTF-8 bubble-size predicate between tables and generated cards. Select the full text fallback before LINE rejects an oversized card while preserving quick-reply prompt and overflow handling.

Refs openclaw#135229, openclaw#135228.

Co-authored-by: xuyuanhao <[email protected]>
@steipete
steipete merged commit 2a247c0 into openclaw:main Sep 2, 2026
104 of 106 checks passed
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: line Channel integration: line P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

A LINE reply that offers a control and carries a long answer is dropped whole

2 participants