Skip to content

fix(feishu): deliver the controls an agent reply offers - #135255

Merged
steipete merged 4 commits into
openclaw:mainfrom
edenfunf:fix/feishu-reply-presentation
Sep 2, 2026
Merged

steipete merged 4 commits into
openclaw:mainfrom
edenfunf:fix/feishu-reply-presentation

Conversation

@edenfunf

@edenfunf edenfunf commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor
Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers can help update the branch when needed.

What Problem This Solves

Feishu/Lark agent replies could lose their buttons, discard a later attachment because its prose repeated, or resend an obsolete streaming preview after replacing it with controls. A failed card could also erase the receipt of an attachment already accepted by Feishu. Controls-only block replies could incorrectly end with a model-failure notice. Later final text could overwrite a readable controls fallback, and a fallback could inherit native-button label truncation even though plain text had room for the complete label.

Why This Change Was Made

Inbound replies now use the existing public renderPresentationForDelivery SDK helper after modifying hooks. Inbound and generic outbound delivery share Feishu's card builder, fallback renderer, and capability declaration. This removes the copied presentation policy and duplicate outbound card construction, addressing the shared-rendering concern raised during the ClawSweeper review.

The delivery owner records each accepted part and its content. Distinct controls and attachments survive repeated prose; a rejected caption cannot be reported as delivered. Streaming close and discard settle the captured preview generation: an obsolete preview cannot reappear through idle recovery, and an independent error card preserves the earlier completed answer and its receipt. If both deletion and clearing fail, delivery reports the failure and retains the still-visible preview's original receipt.

Independent controls and readable fallbacks use the existing independent-message sender for final, block, and tool replies. Their text and attachments retain their receipts while ordinary cumulative final text keeps normal streaming behavior. The shared renderer also passes the normalized original presentation to the fallback owner, preserving complete labels while native cards continue to use channel-adapted limits. Three duplicated post-sending paths now share one local helper. The Feishu and plugin docs describe these boundaries.

Compared with integrated main, production is +593/-466 (net +127), tests +981/-141, docs +13/-4, and assertion-baseline metadata -1. The production growth implements native reply controls, partial-delivery accounting, and preview ownership; shared rendering and post delivery remove duplication. The card-elements helper is private, and its table-fallback test exercises the production card builder.

User Impact

Command buttons and HTTP(S) links survive final and block replies, including controls without ordinary text. Attachments keep their own receipts, required bot recipients keep their mentions, and unsupported or oversized portable presentations retain readable, complete labels. Explicit oversized native cards still report an error. Intentional final hook cancellation is respected. Block cancellation remains per-payload, so core can still deliver a separate fallback afterward.

Release note: Fix Feishu/Lark reply controls, attachment receipts, required mentions, complete fallback labels, and streaming preview cleanup. Thanks 許元豪 (@edenfunf).

Evidence

Original PR head: e863fecda6a20e718f3764c536e2ced1300fe445. The candidate preserves that ancestry and integrates main bab0c49c94a0f6d64365f6ed286bf095e245ad36; committed candidate: 5ec5b5786a741d0a3d1da0e532a938ff0ca98c02. Tested tree: fe0ff02416e7bacb31ea7f3f9d9157c2c875486a.

Boundary Before-change evidence Candidate result
Signed webhook → built Gateway → scripted model → Feishu SDK → canonical message_sent Seven final cases: four healthy guards and three failures involving partial receipts, required mentions, and canceled final recovery. An additional admitted controls-only block lost its controls. All eight Gateway cases pass.
Serialized dispatcher and native API receipt ownership Repeated-final cases dropped a new attachment or changed callback; preview replacement resent obsolete prose; failed deletion and clearing duplicated the retained preview and changed its receipt. All eight ordered native cases pass.
Held close, oversized fallback with voice, block/tool/final controls, accepted cards without message IDs, and independent error controls Owner regressions reproduce answer-then-error cleanup, streaming fallback replacement, and truncated labels; healthy streaming controls run alongside them. All fourteen candidate native cases pass.
Per-payload block cancellation Existing core behavior permits a later independent fallback. All three signed Gateway observations pass: exactly one later core fallback, no later model final, and no Feishu raw fallback. No turn-wide block-suppression change.

The final tree passes 1,969 Feishu tests across 101 files, 311 shared presentation/delivery tests across four files, and the 10 selected fallback/streaming regressions (a subset of the Feishu suite). The last pre-fix regression run had four failures and six healthy controls. pnpm check:changed passes, including the normal core, plugin, and script checks. A fresh independent review of the complete candidate found no actionable P0–P2 findings. The full Gateway build and all 30 native behavior cases plus three observations pass. Exact-head CI passed on the committed candidate.

The Gateway runs capture signed durable ingress, actual model-produced dispatch kinds, native request ordering, and canonical delivery events. The ordered owner runs exercise the real serialized dispatcher, Feishu owner, and SDK HTTPS requests, and capture native card state and returned receipts. They do not claim that the model emitted those explicit sequences. All runs bind source/build/plugin hashes and verify owned-process cleanup.

The native endpoint is a synthetic HTTPS service using Lark SDK 1.73.0. Authenticated tenant/client screenshots and button-click round trips were unavailable within the required secretless fork-code execution environment; they are not claimed by this proof.

The latest ClawSweeper review reports no actionable findings. Its remaining request for maintainer judgment about the net production growth and lifecycle complexity is resolved: the shared owner design and the full native preview/partial-delivery evidence support retaining this handling. Current main 8cfd23c94c1d2556eb7009b7ca4795478d5867e6 has no changes to the bound runtime paths.

Proof preparation required two harness corrections. The repository development launcher rebuilt the staged checkout's artifacts; that attempt was rejected and a complete recovery build preceded the reported native runs. A synchronous Git-index collector then exceeded Node's buffer before starting its scenarios; streaming every index byte fixed the collector while preserving the complete source/build guards. A separate host checkout guard stopped and resumed work through a clean pinned launcher. Production and scenario assertions did not change. The original baseline and final launcher/bootstrap setups are not claimed identical.

Complete native scenario results

The original submitted-PR native cohort contains 11 reproduced failures and five healthy controls. Its 16 cases have matching final-source families. Fourteen additional final-source behavior guards have the separately recorded component regressions described above; the three policy observations are not asserted pre-fix defects.

Family Passed Scenarios
final 7/7 control, legacy, partial_failure, peer_mention, thread, hook_rewrite, hook_cancel
block 1/1 admitted_block
owner 3/3 owner_discard, owner_discard_media, owner_discard_clear
owner-fault 2/2 owner_discard_failed, owner_discard_failed_media
final-owner 3/3 repeat_media, repeat_legacy_callback, repeat_command
held-close 1/1 held_normal_close
review-regressions 11/11 oversized_final_voice, oversized_block_voice, oversized_block_before_final_auto, oversized_block_before_final_card, keep_prior_block_before_block_controls, keep_prior_block_before_tool_controls, accepted_card_missing_id, accepted_card_missing_id_with_media, oversized_final_before_final_auto, oversized_final_before_final_card, durable_outbound_full_label_voice_fallback
error-final 2/2 error_final_short, error_final_overflow
block-policy (observations) 3/3 block_payload_cancel, block_payload_empty, block_message_cancel

Every family passed its prerequisites and behavior assertions, rejected invalid signatures, verified unchanged source and complete build/plugin hashes, and confirmed process/fixture cleanup. Native-kind arrays record creation order; streaming fixtures separately assert the required acceptance/content ordering, allowing an empty preview to be created before another independent part settles.

Evidence digests: complete sanitized report afb7a2748f51284400114a583c12293c24eb6932b71a28e8931c2dddcc3e5b32; before-change report 308529c00aeedd197491a19a31f32fed44c25956461228193ca31f3bf9510b60; component regressions 746016a6430a29accd7c218b9a4170aad6893211df2fe0bfbd6299404e981564; combined evidence archive f5537becf6aea7cdd2d41ded9ba41c2c9ba1bdfdc285dfd55ac5be558fb28b77. These reports contain no credentials, raw Gateway logs or private paths.

Feishu registers a presentation renderer and advertises buttons, but core resolves a presentation inside the outbound send pipeline only. Replies the plugin delivers itself reached delivery with their controls still portable, so every button was dropped and a controls-only reply produced no message at all.
The resolver had one caller and its collaborators all live in presentation-card.ts; a module whose only export has a single call site is a forwarding layer.
@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: feishu Channel integration: feishu size: M labels Sep 1, 2026
@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, 11:51 PM ET / September 2, 2026, 03:51 UTC.

ClawSweeper review

What this changes

The PR renders portable controls on Feishu’s direct agent-reply path as native cards or readable fallback text, while preserving media, streaming, and delivery-receipt behavior.

Regression provenance

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

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open: current main still decides the Feishu reply from text and media before rendering a presentation, so a controls-only reply can produce no visible result. The pinned branch repairs that owner-local gap with adequate boundary proof; it needs ordinary maintainer review and exact-head checks, not another repair job.

Priority: P1
Reviewed head: 5ec5b5786a741d0a3d1da0e532a938ff0ca98c02

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-backed repair with meaningful owner-boundary regression coverage and production-boundary request evidence.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body supplies a post-fix terminal trace through the real Feishu reply dispatcher, existing sender, and real Lark SDK request construction; it observes interactive requests and a visible controls-only delivery, although it does not prove a live tenant click.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body supplies a post-fix terminal trace through the real Feishu reply dispatcher, existing sender, and real Lark SDK request construction; it observes interactive requests and a visible controls-only delivery, although it does not prove a live tenant click.
Evidence reviewed 5 items Current-main gap: Current main computes reply sendability from text and media without first materializing portable presentation controls, then returns a no-visible result when both are absent.
Pinned repair path: The introduced dispatcher path renders the accepted reply presentation before sendability decisions and sends the resulting native card through the existing Feishu sender.
Shared rendering contract: The shared helper supplies an adapted presentation for native rendering and the normalized original as an optional fallback source; the core bridge forwards both to channel adapters.
Findings None None.
Security None None.

How this fits together

The Feishu plugin dispatches agent replies directly to Feishu rather than always using the generic outbound pipeline. Portable presentation blocks must be rendered into Feishu cards before that dispatcher decides what is visible and records delivery.

flowchart LR
  A[Agent reply] --> B[Feishu reply dispatcher]
  B --> C[Presentation rendering]
  C --> D[Native card or text fallback]
  D --> E[Feishu delivery]
  E --> F[Visible reply and receipt]
Loading

Before merge

  • Resolve merge risk (P1) - The bug fix has a net production increase of 127 lines (with a substantial helper relocation); the added receipt and streaming handling is justified by the direct-reply owner boundary, but deserves maintainer review for lifecycle complexity.
Agent review details

Security

None.

PR surface

Source +127, Tests +840, Docs +9, Other -1. Total +975 across 19 files.

View PR surface stats
Area Files Added Removed Net
Source 10 593 466 +127
Tests 5 981 141 +840
Docs 3 13 4 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 19 1587 612 +975

Review metrics

Metric Value Why it matters
Production versus test delta production +127, tests +840, docs +9, baseline -1 The production increase includes moving existing card helpers out of outbound delivery and adding the previously missing reply-path rendering and receipt handling.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep one Feishu-owned rendering path shared by direct outbound and inbound replies; retain the added lifecycle handling because no net-neutral path can make controls-only replies visible while preserving preview and partial-delivery receipts.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep one Feishu-owned rendering path shared by direct outbound and inbound replies; retain the added lifecycle handling because no net-neutral path can make controls-only replies visible while preserving preview and partial-delivery receipts.

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

Yes, with high confidence: current main reaches the text/media-only sendability decision before presentation rendering, and the supplied before/after production-boundary trace demonstrates the resulting silent controls-only path.

Is this the best way to solve the issue?

Yes: the branch reuses the established shared presentation adapter and existing Feishu card sender at the plugin-owned direct-reply boundary rather than adding a competing core path.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: Feishu agent replies can drop offered controls and can produce no visible message when controls are the only reply content.
  • 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 (terminal): The PR body supplies a post-fix terminal trace through the real Feishu reply dispatcher, existing sender, and real Lark SDK request construction; it observes interactive requests and a visible controls-only delivery, although it does not prove a live tenant click.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies a post-fix terminal trace through the real Feishu reply dispatcher, existing sender, and real Lark SDK request construction; it observes interactive requests and a visible controls-only delivery, although it does not prove a live tenant click.

Evidence

What I checked:

  • Current-main gap: Current main computes reply sendability from text and media without first materializing portable presentation controls, then returns a no-visible result when both are absent. (extensions/feishu/src/reply-dispatcher.ts:1274, 52dd976a355f)
  • Pinned repair path: The introduced dispatcher path renders the accepted reply presentation before sendability decisions and sends the resulting native card through the existing Feishu sender. (extensions/feishu/src/reply-dispatcher.ts:1346, 5ec5b5786a74)
  • Shared rendering contract: The shared helper supplies an adapted presentation for native rendering and the normalized original as an optional fallback source; the core bridge forwards both to channel adapters. (src/channels/plugins/outbound/presentation-delivery.ts:57, 5ec5b5786a74)
  • Boundary regression coverage: Focused tests cover native buttons for final and block replies, a controls-only legacy reply, authored table fallback, changed callback values, and partial media/card delivery. (extensions/feishu/src/reply-dispatcher.test.ts:900, 5ec5b5786a74)
  • Supplied real-path proof: The captured PR body records before/after requests from the real Feishu dispatcher, sender, and Lark SDK with only the SDK transport intercepted: controls become an interactive request and a controls-only reply produces one request. (5ec5b5786a74)

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 (1 earlier review cycle)
  • reviewed 2026-09-01T14:26:08.068Z sha e863fec :: needs maintainer review before merge. :: none

@steipete steipete self-assigned this Sep 1, 2026
Share Feishu presentation rendering across outbound and agent replies. Keep accepted attachments, controls, and their receipts intact, and settle replaced streaming previews without replaying obsolete text. Preserve completed answers when a separate error final offers controls, and retain complete labels in readable fallbacks.

Release note: Fix Feishu/Lark reply controls, partial delivery receipts, required mentions, complete fallback labels, and streaming preview cleanup. Thanks @edenfunf.

Co-authored-by: 許元豪 <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation plugin: file-transfer size: XL and removed size: M labels Sep 2, 2026
@steipete
steipete merged commit 1572a9e into openclaw:main Sep 2, 2026
297 checks passed
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

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

* fix(feishu): deliver the controls an agent reply offers

Feishu registers a presentation renderer and advertises buttons, but core resolves a presentation inside the outbound send pipeline only. Replies the plugin delivers itself reached delivery with their controls still portable, so every button was dropped and a controls-only reply produced no message at all.

* fix(feishu): fold the reply presentation resolver into its card module

The resolver had one caller and its collaborators all live in presentation-card.ts; a module whose only export has a single call site is a forwarding layer.

* test(feishu): pin the reply path to the advertised presentation capabilities

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: 許元豪 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. plugin: file-transfer proof: sufficient ClawSweeper judged the real behavior proof convincing. 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.

2 participants