Repository navigation
fix(feishu): deliver the controls an agent reply offers - #135255
Conversation
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.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 11:51 PM ET / September 2, 2026, 03:51 UTC. ClawSweeper reviewWhat this changesThe 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 provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readinessKeep 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 Review scores
Verification
How this fits togetherThe 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]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +127, Tests +840, Docs +9, Other -1. Total +975 across 19 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest 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. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
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]>
|
Merged via squash.
|
) * 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]>
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
renderPresentationForDeliverySDK 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 mainbab0c49c94a0f6d64365f6ed286bf095e245ad36; committed candidate:5ec5b5786a741d0a3d1da0e532a938ff0ca98c02. Tested tree:fe0ff02416e7bacb31ea7f3f9d9157c2c875486a.message_sentThe 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:changedpasses, 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
8cfd23c94c1d2556eb7009b7ca4795478d5867e6has 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.
control,legacy,partial_failure,peer_mention,thread,hook_rewrite,hook_canceladmitted_blockowner_discard,owner_discard_media,owner_discard_clearowner_discard_failed,owner_discard_failed_mediarepeat_media,repeat_legacy_callback,repeat_commandheld_normal_closeoversized_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_fallbackerror_final_short,error_final_overflowblock_payload_cancel,block_payload_empty,block_message_cancelEvery 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 report308529c00aeedd197491a19a31f32fed44c25956461228193ca31f3bf9510b60; component regressions746016a6430a29accd7c218b9a4170aad6893211df2fe0bfbd6299404e981564; combined evidence archivef5537becf6aea7cdd2d41ded9ba41c2c9ba1bdfdc285dfd55ac5be558fb28b77. These reports contain no credentials, raw Gateway logs or private paths.