Skip to content

fix(feishu): preserve text before media attachments - #102397

Closed
NianJiuZst wants to merge 5 commits into
openclaw:mainfrom
NianJiuZst:codex/issue-102390-feishu-media-text
Closed

NianJiuZst wants to merge 5 commits into
openclaw:mainfrom
NianJiuZst:codex/issue-102390-feishu-media-text

Conversation

@NianJiuZst

@NianJiuZst NianJiuZst commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #102390

What Problem This Solves

Fixes an issue where Feishu users would lose the assistant's visible text when a final reply contained both prose and a MEDIA: image attachment while streaming cards were active. The affected chat could show only the no-visible-reply fallback or an attachment without the intended explanation.

Why This Change Was Made

The Feishu reply dispatcher now closes the final streaming text card before sending regular media attachments, so the text is committed as visible content before the attachment path runs. If the streaming close accepts no text content, the dispatcher falls back to a normal text reply before sending media; voice-media duplicate-text suppression stays on the existing path.

A real Feishu repro showed two more gaps. First, dispatcher-backed streaming block replies were being treated as delivered as soon as they were queued. If async channel delivery later failed, the block pipeline could still dedupe the final answer and leave the turn with no visible reply. The core reply path now waits for dispatcher-backed block delivery to settle when streaming callers need an acknowledgement, and the block pipeline aborts on delivery errors so the final payload remains available as fallback.

Second, a live retry hit Create card request failed with HTTP 400 while starting the Feishu streaming card. That start failure was swallowed by the preview path, leaving no active streaming session while the turn could still complete without a visible final. The Feishu dispatcher now treats streaming start as an explicit success/failure state: partial/reasoning previews only mutate streaming state after a successful start, final text+media falls back to the normal static card/media path after a start failure, block-card replies fall back to static cards if independent block delivery was not actually sent, and late partial snapshots cannot append after a final has been committed.

User Impact

Feishu replies that combine a text body with an image attachment now preserve both parts of the answer. If streaming close, streaming block delivery, or streaming-card startup fails, OpenClaw keeps or re-enters the final reply path instead of silently deduping the answer away and showing the no-visible-reply fallback.

Evidence

  • node scripts/run-vitest.mjs src/auto-reply/reply/block-reply-pipeline.test.ts src/auto-reply/reply/dispatch-from-config.test.ts src/auto-reply/reply/agent-runner-payloads.test.ts extensions/feishu/src/reply-dispatcher.test.ts (core 350 tests, Feishu 90 tests)
  • node scripts/run-vitest.mjs extensions/feishu/src/reply-dispatcher.test.ts (Feishu 90 tests)
  • ./node_modules/.bin/oxlint extensions/feishu/src/reply-dispatcher.ts extensions/feishu/src/reply-dispatcher.test.ts
  • git diff --check
  • Local Feishu proof image exists and parses as a valid PNG. A live retry before ed94079/8a22d60 still returned the no-visible fallback; logs showed the model produced the expected text+MEDIA: final, then Feishu streaming startup failed with Create card request failed with HTTP 400, and no final was queued. Commits ed94079 and 8a22d60 add streaming-start-failure and block-card-fallback coverage for that live gap.
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base upstream/main is clean after 92e40e3: no accepted/actionable findings reported.

@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: S labels Jul 9, 2026
@clawsweeper

clawsweeper Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 2:18 AM ET / 06:18 UTC.

Summary
The PR changes Feishu reply dispatching and shared block-reply acknowledgement so final text-plus-media replies, streaming-card start failures, and block delivery failures can fall back without losing visible content.

PR surface: Source +68, Tests +210. Total +278 across 6 files.

Reproducibility: yes. at source level: current main can route final Feishu text plus media through the active streaming branch, send media without caption text, and return before normal text delivery. I did not run a live Feishu tenant reproduction in this read-only review.

Review metrics: none identified.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #102390
Summary: This PR and the sibling Feishu PR are candidate fixes for the same source-backed Feishu final text plus MEDIA delivery bug.

Members:

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

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Add redacted live Feishu proof showing final text plus image delivery and no no-visible-reply fallback.
  • [P1] Coordinate with fix(feishu): preserve text when replies include media #102399 so maintainers land one canonical fix path.
  • [P1] Refresh the branch against current main before merge because src/auto-reply/reply/dispatch-from-config.ts changed after the PR base.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR still needs accessible redacted real Feishu proof; screenshots, recordings, terminal/live output, or logs are acceptable after redacting private IDs, secrets, phone numbers, IPs, and non-public endpoints, and updating the PR body should trigger re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P2] No accessible after-fix Feishu proof shows the real tenant/client path delivering both final text and media without the no-visible-reply fallback.
  • [P1] The diff changes final text/media ordering plus shared block-delivery acknowledgement, where mistakes could still suppress, duplicate, or misclassify visible channel replies.
  • [P1] An overlapping open PR targets the same Feishu bug, so maintainers should choose one canonical landing path before merging either branch.
  • [P1] Current main has changed src/auto-reply/reply/dispatch-from-config.ts since this PR's base, so final mergeability and review should be refreshed against the current base before landing.

Maintainer options:

  1. Require live Feishu proof before merge (recommended)
    Ask for an accessible redacted Feishu screenshot, recording, live log, or transcript showing final text, media delivery, and no fallback warning after this patch.
  2. Accept maintainer-owned live risk
    A Feishu owner may waive contributor proof if they can own or supply equivalent validation outside the PR.
  3. Pause behind the sibling fix
    Keep this branch paused if maintainers want fix(feishu): preserve text when replies include media #102399 to become the canonical proof-positive landing path.

Next step before merge

  • [P1] The code repair is present; the remaining blocker is proof sufficiency and canonical branch selection, not a narrow automated edit.

Maintainer decision needed

  • Question: Should maintainers require accessible live Feishu proof and select this broader branch over the sibling Feishu fix before merge?
  • Rationale: The source patch looks directionally correct, but the contributor has not provided public after-fix Feishu proof and another open PR targets the same bug with a narrower dispatcher-only change.
  • Likely owner: m1heng — The package metadata names this handle as the Feishu community maintainer, so they are the best available owner for proof sufficiency and branch selection.
  • Options:
    • Require proof and pick one branch (recommended): Keep this PR open but require redacted live Feishu evidence and a maintainer choice between this branch and fix(feishu): preserve text when replies include media #102399 before merge.
    • Accept a maintainer proof waiver: A Feishu owner may intentionally accept the mocked/source proof and own the remaining live-delivery risk for this channel path.
    • Prefer the sibling fix: If maintainers prefer the narrower sibling branch, this PR should wait or close only after that sibling becomes proof-positive and viable.

Security
Cleared: The diff changes Feishu/core reply delivery logic and tests only; I found no concrete credential, dependency, workflow, package, or supply-chain concern.

Review details

Best possible solution:

Land one Feishu-owner fix that preserves text plus media and recovery from streaming delivery failures, with accessible redacted Feishu proof and no duplicate sibling merge.

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

Yes at source level: current main can route final Feishu text plus media through the active streaming branch, send media without caption text, and return before normal text delivery. I did not run a live Feishu tenant reproduction in this read-only review.

Is this the best way to solve the issue?

Yes on direction: closing the Feishu streaming card before regular media and falling back to plain text on close/start/delivery failure is the narrow owner-boundary fix. It is not merge-ready until accessible real Feishu behavior proof is added and the overlapping fix path is coordinated.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P1: The PR targets a user-visible Feishu channel workflow where valid assistant text and media can be lost or replaced by a misleading fallback.
  • merge-risk: 🚨 message-delivery: The diff changes final text/media ordering and block-delivery acknowledgement, where mistakes can suppress, duplicate, or wrongly classify visible replies.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR still needs accessible redacted real Feishu proof; screenshots, recordings, terminal/live output, or logs are acceptable after redacting private IDs, secrets, phone numbers, IPs, and non-public endpoints, and updating the PR body should trigger re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +68, Tests +210. Total +278 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 125 57 +68
Tests 3 233 23 +210
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 358 80 +278

What I checked:

  • Repository policy read and applied: Root AGENTS.md and extensions/AGENTS.md were read fully; their PR-review, plugin-boundary, message-delivery, and real-behavior-proof rules shaped this review. (AGENTS.md:1, 583ca34bf88d)
  • Current main failure path: On current main, a final Feishu text-plus-media reply can enter the active streaming branch, update streamText, send media, and return before normal text delivery commits the prose. (extensions/feishu/src/reply-dispatcher.ts:767, 583ca34bf88d)
  • Media helper does not carry the prose: Current main sends regular media with an empty caption and marks visibility only for the media send, so the text must be committed separately through streaming close or text fallback. (extensions/feishu/src/reply-dispatcher.ts:520, 583ca34bf88d)
  • PR head Feishu repair path: PR head closes the streaming card before final media and sends the final prose as normal text when the close reports no visible content. (extensions/feishu/src/reply-dispatcher.ts:795, 92e40e3d2e95)
  • PR head block delivery acknowledgement path: PR head counts settled dispatcher-backed block deliveries and throws when a timeout-bound streaming acknowledgement did not actually settle, preserving the final payload as fallback. (src/auto-reply/reply/dispatch-from-config.ts:3268, 92e40e3d2e95)
  • Regression coverage added: PR head adds tests for closing final streaming text before media, close-false text fallback, streaming-start failure fallback, block-card fallback after start failure, and block delivery failure propagation. (extensions/feishu/src/reply-dispatcher.test.ts:1469, 92e40e3d2e95)

Likely related people:

  • m1heng: The Feishu package metadata describes @openclaw/feishu as community maintained by this handle, making them the clearest proof and channel-behavior routing contact. (role: declared plugin owner; confidence: medium; files: extensions/feishu/package.json)
  • vincentkoc: Current blame for the implicated Feishu streaming/media branch and recent GitHub history for the shared reply pipeline point to Vincent Koc as a recent area contributor. (role: recent Feishu and shared reply-path contributor; confidence: medium; commits: 686b6b51da, 9fabdcf49d76, 6c85b90469f9; files: extensions/feishu/src/reply-dispatcher.ts, src/auto-reply/reply/block-reply-pipeline.ts, src/auto-reply/reply/dispatch-from-config.ts)
  • steipete: Recent commit history shows repeated work on the shared auto-reply and block-streaming paths adjacent to the dispatcher fallback and dedupe behavior. (role: shared reply pipeline contributor; confidence: medium; commits: f0093b7020e7, 7cca3d4618b9, 90b1ab1c7026; files: src/auto-reply/reply/block-reply-pipeline.ts, src/auto-reply/reply/dispatch-from-config.ts, extensions/feishu/src/reply-dispatcher.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-09T03:58:17.496Z sha ddbb1be :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-09T04:10:17.995Z sha ddbb1be :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-09T05:11:15.150Z sha a85f5ff :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-09T05:17:21.774Z sha a85f5ff :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-09T05:44:07.568Z sha 8a22d60 :: needs real behavior proof before merge. :: [P2] Handle the async streaming-start promise | [P2] Update tests for async progress callbacks
  • reviewed 2026-07-09T05:51:22.972Z sha 8a22d60 :: needs real behavior proof before merge. :: [P2] Handle the async streaming-start promise | [P2] Update tests for async progress callbacks
  • reviewed 2026-07-09T06:03:18.839Z sha 92e40e3 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-09T06:11:56.704Z sha 92e40e3 :: needs real behavior proof before merge. :: none

@NianJiuZst
NianJiuZst marked this pull request as ready for review July 9, 2026 03:50
@NianJiuZst
NianJiuZst marked this pull request as draft July 9, 2026 03:51
@clawsweeper clawsweeper Bot added 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. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Jul 9, 2026
@NianJiuZst
NianJiuZst marked this pull request as ready for review July 9, 2026 04:03
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 9, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 24, 2026
@NianJiuZst NianJiuZst closed this Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Feishu: Assistant reply with text + MEDIA: directive silently loses the text and triggers "reply completed without visible content" fallback

1 participant