Skip to content

fix(feishu): deliver captioned media with block streaming disabled - #145487

Closed
forrystudio wants to merge 2 commits into
openclaw:mainfrom
forrystudio:fix/feishu-nonstreaming-media-delivery
Closed

forrystudio wants to merge 2 commits into
openclaw:mainfrom
forrystudio:fix/feishu-nonstreaming-media-delivery

Conversation

@forrystudio

@forrystudio forrystudio commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where Feishu users receive a missing or delayed caption and attachment when text block streaming is disabled. For example, a plain caption plus a chart is delivered by core as a media-bearing block, but Feishu skips that block unless card rendering is selected. An existing preview can also retain draft text instead of the final caption.

On the affected 2026.9.3/2026.9.4 core path, a skipped block could additionally cause the final payload to be deduplicated and the user to receive the no-reply fallback. The newer core delivery-receipt fixes in #145428 and #148301 protect final fallback independently; this PR fixes Feishu's handling of the original media-bearing block.

Why This Change Was Made

Deliver captioned media blocks through the existing Feishu caption and attachment senders. If the turn already has an active preview, finish that same preview with the authoritative caption, replacing any longer draft. Preserve text-only block suppression, existing partial-delivery error handling, and the public SDK contract.

User Impact

Users receive the caption and attachment with block streaming disabled. A preview can finish correctly even when core does not send a separate final payload. No configuration migration is required.

Evidence

  • Head 04aa4879282: all 195 dispatcher tests passed, including two new tests using the real reply dispatcher queue, markComplete(), waitForIdle(), and deferred delivery finalization. These prove completion without an extra final payload; they do not inject a duplicate final.
  • Targeted type-aware lint, Feishu package type checking, and formatting passed. Independent code review found no blockers.
  • 2026.9.3 test-environment backport: with matching existing patches and test helper compatibility, the old dispatcher fails all seven selected media regressions. Applying only the Feishu production patch makes 239 dispatcher and streaming-card tests pass. The changed production file passes lint. Seven old test-file no-misused-promises findings reproduce identically after restoring the baseline test file; the full backport test-file lint lane is not claimed green.
  • The isolated Linux ARM64 source build produced the plugin archive with SHA-256 e698709b52508f5129d185e925bac0f40cbc22aa42b5f7c68df505af0d171d3d. The reviewed artifact was deployed through the existing managed-package patch workflow on a dedicated test account, preserving the installed core and semantic configuration. All archived files were verified against the installed package, and the actual loaded root was bound to that package. Gateway readiness and the Feishu channel connection passed, with zero reconnect attempts. This proves installed artifact identity and startup, not inbound/model-loop or live-message delivery behavior.
  • Current-head hosted CI passed: openclaw/ci-gate completed successfully for 04aa487928236d8a99a938dd273b39e532d53084, with no failed or pending checks. This head adds tests only to the previously reviewed production change at 114be5dd4836972c6b29b3d741b002416435d5b5.
  • Historical real Feishu proof, September 12, 2026: the same production change passed all three cases below through the actual source dispatcher, plugin runtime, Feishu SDK, media loader, and CardKit, with real message API readback and no transport mocks.
Historical live case API-read result
Preview off, block disabled One accepted caption post and one accepted native image
Partial preview mode without an existing preview, block disabled One accepted caption post and one accepted native image
Partial mode with a longer existing preview, block disabled The same card changed to the shorter final caption, draft suffix disappeared, streaming mode closed, and the native image arrived

Each historical case had two accepted message IDs and visible-reply state true. Readback found exactly one marker-bearing caption in the bounded window. Image assertions cover returned receipts, not an audit of unrelated images. The recorded source producer SHA-256 was 1635e9c249a4ac53d50ac4640b78c7b05c4904f543c077e2bf6aa5d126b764f8.

The historical live proof exercises the source dispatcher and real transport, not normal inbound/model processing or the installed Gateway bundle. The September 15 test deployment does not add a new live-message claim. API readback is not a client screenshot. Failure injection is covered by automated tests. No production service, configuration, or managed Skill is changed by this PR validation.

An earlier broad Windows lane on the pre-rebase revision was not green: 100/102 files passed, with doctor cleanup EPERM failures and one setup SecretRef expectation that reproduced on the clean base. The focused results above are the current-head checks.

@clawsweeper

clawsweeper Bot commented Sep 12, 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.

@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: S labels Sep 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 5:25 AM ET / 09:25 UTC (Revision 8).

ClawSweeper review

What this changes

The Feishu plugin delivers captions and attachments when text block streaming is disabled and replaces an existing preview with the completed caption.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main still skips the reported Feishu media block, and the merged core recovery fixes do not replace this repair. No blocking correctness or security findings remain; the recorded real Feishu proof covers the unchanged production patch.

Priority: P2
Reviewed head: 04aa487928236d8a99a938dd273b39e532d53084

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with source-matched real transport proof and meaningful queue/failure regressions has no identified blocking defect.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Recorded real Feishu API readback exercises the changed source dispatcher with previews off, partial mode without a preview, and replacement of a longer existing preview. Caption/image acceptance and completed-card replacement are observed, and the producer hash matches the unchanged production file in this head. Queue tests supplement that proof; installed startup does not claim inbound/model-loop coverage. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Recorded real Feishu API readback exercises the changed source dispatcher with previews off, partial mode without a preview, and replacement of a longer existing preview. Caption/image acceptance and completed-card replacement are observed, and the producer hash matches the unchanged production file in this head. Queue tests supplement that proof; installed startup does not claim inbound/model-loop coverage. No stored-data contract changes.
Evidence reviewed 8 items Verified introduced patch: The pinned merge-base-to-head diff changes Feishu caption admission and preview replacement, with focused regression coverage. Other base-branch changes are outside this PR's introduced delta.
Current main still needs the repair: Current main's non-streaming block branch still requires presentation fallback or enabled block streaming before sending caption and media, then returns without sending either for the reported plain-caption case. It also lacks media-block preview replacement.
Latest release retains the affected gate: Inspection of v2026.9.8 through the GitHub contents API found the same caption admission gate at line 1450 and no reuseMediaBlockPreview logic. Local release-blob inspection failed, so the successful API read supplied this release check.
Findings None None.
Security None None.

How this fits together

OpenClaw sends completed agent reply payloads to the Feishu plugin, which chooses posts, streaming cards, and attachment sends. Delivery receipts tell core which content actually reached the conversation.

flowchart TD
  A[Agent reply payload] --> B[Feishu reply dispatcher]
  B --> C[Streaming settings and active preview]
  C --> D[Caption post or completed card]
  B --> E[Native attachment sender]
  D --> F[Delivery receipts]
  E --> F
  F --> G[Core final reply accounting]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +6, Tests +226. Total +232 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 12 6 +6
Tests 1 226 0 +226
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 238 6 +232

Review metrics

None.

Technical review

Best possible solution:

Keep captioned-media handling in the existing Feishu dispatcher, using its established senders and preview settlement without adding configuration or SDK surface.

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

Yes, from source: deliver a plain caption with media as a block while Feishu block streaming is disabled; current main returns without sending it. This review did not run a current-main reproduction.

Is this the best way to solve the issue?

Yes. The patch repairs the plugin's admission and preview handling through existing delivery owners while preserving text-only suppression and partial-send accounting.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 10080eaf91bc.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs a bounded Feishu caption-and-attachment delivery defect in an existing streaming configuration.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Recorded real Feishu API readback exercises the changed source dispatcher with previews off, partial mode without a preview, and replacement of a longer existing preview. Caption/image acceptance and completed-card replacement are observed, and the producer hash matches the unchanged production file in this head. Queue tests supplement that proof; installed startup does not claim inbound/model-loop coverage. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded real Feishu API readback exercises the changed source dispatcher with previews off, partial mode without a preview, and replacement of a longer existing preview. Caption/image acceptance and completed-card replacement are observed, and the producer hash matches the unchanged production file in this head. Queue tests supplement that proof; installed startup does not claim inbound/model-loop coverage. No stored-data contract changes.

Evidence

What I checked:

  • Verified introduced patch: The pinned merge-base-to-head diff changes Feishu caption admission and preview replacement, with focused regression coverage. Other base-branch changes are outside this PR's introduced delta. (extensions/feishu/src/reply-dispatcher.ts:1405, 04aa48792823)
  • Current main still needs the repair: Current main's non-streaming block branch still requires presentation fallback or enabled block streaming before sending caption and media, then returns without sending either for the reported plain-caption case. It also lacks media-block preview replacement. (extensions/feishu/src/reply-dispatcher.ts:1397, 10080eaf91bc)
  • Latest release retains the affected gate: Inspection of v2026.9.8 through the GitHub contents API found the same caption admission gate at line 1450 and no reuseMediaBlockPreview logic. Local release-blob inspection failed, so the successful API read supplied this release check. (extensions/feishu/src/reply-dispatcher.ts:1450, fc23bc864e45)
  • Actual production entrypoint and core contract: Feishu's inbound handler supplies this dispatcher to core.channel.inbound.run. Core's block delivery handler explicitly sends non-text content even when block streaming is disabled, establishing why the plugin must accept captioned media blocks. (src/auto-reply/reply/reply-delivery.ts:197, 04aa48792823)
  • Real Feishu proof matches the production source: The captured PR body records September 12 real dispatcher, SDK, media-loader, and CardKit runs: preview off and partial mode each accepted one caption and one image; an existing longer preview became the shorter caption, lost its draft suffix, closed streaming mode, and accepted the image. The recorded producer hash matches the inspected production blob exactly. The subsequent head commit changes tests only. These observations cover the changed outbound boundary; startup and installed-artifact checks are supplemental and do not establish inbound/model-loop coverage. (extensions/feishu/src/reply-dispatcher.ts:1549, 114be5dd4836)
  • Queue settlement and failure coverage: Added tests exercise the real reply dispatcher queue through markComplete and waitForIdle without injecting an extra final payload. Other cases protect text-only suppression, shorter-caption replacement, caption rejection, and accepted-caption preservation after attachment failure. Reported focused tests and hosted CI passed; this read-only review did not execute contributor code. (extensions/feishu/src/reply-dispatcher.test.ts:1586, 04aa48792823)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • joshavant: 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 (7 earlier review cycles)
  • reviewed 2026-09-12T01:27:57.681Z sha 10f28b1d033b1000af96c643bb8bf4429c86fd69 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-12T04:45:00.140Z sha 114be5d :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-12T05:01:01.634Z sha 114be5d :: needs changes before merge. :: none
  • reviewed 2026-09-12T12:50:59.967Z sha 114be5d :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T04:25:13.602Z sha 04aa487 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T04:49:55.379Z sha 04aa487 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-24T03:55:33.747Z sha 04aa487 :: needs maintainer review before merge. :: none

@forrystudio
forrystudio force-pushed the fix/feishu-nonstreaming-media-delivery branch from 10f28b1 to 114be5d Compare September 12, 2026 04:39
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Sep 12, 2026
@forrystudio

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The PR body now includes redacted real Feishu API/runtime evidence from exact head 114be5dd4836972c6b29b3d741b002416435d5b5: all three live caption/image and existing-preview replacement cases passed using the actual dispatcher, plugin runtime, SDK, and CardKit. Current-head CI is complete with no failures. The evidence explicitly distinguishes real transport/API readback from installed-bundle or inbound/model-loop E2E.

@clawsweeper

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

Re-review progress:

@clawsweeper clawsweeper Bot added 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 12, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Sep 12, 2026
@forrystudio

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Resolved the sole remaining Revision 3 request: renamed the PR body's Verification heading to Evidence, retaining the complete real Feishu trace. The new PR context and evidence job passed: https://github.com/openclaw/openclaw/actions/runs/34694565932/job/103555706922 . Code remains at the previously reviewed and live-verified head 114be5dd4836972c6b29b3d741b002416435d5b5.

@clawsweeper

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

Re-review progress:

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Thanks @forrystudio! The focused captioned-media delivery fix has landed in #191585 with your coauthor credit. Closing this as superseded.

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

Labels

channel: feishu Channel integration: feishu P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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