Skip to content

fix(feishu): honor the filename override on sent attachments - #205287

Merged
obviyus merged 2 commits into
openclaw:mainfrom
erywim:fix/feishu-filename-override
Nov 25, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
erywim:fix/feishu-filename-override

Conversation

@erywim

@erywim erywim commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Root cause: extensions/feishu/src/channel.ts:942 (on 81d69df) builds the direct-send outboundContext from the action params without filename, so feishuOutbound.sendMedia calls sendMediaFeishu (extensions/feishu/src/outbound.ts:736) with no fileName and the upload falls back to the loaded media basename (extensions/feishu/src/media.ts:581).

Fixes #205246

Thanks @Cindypapa for the report, the server-side im/v1/messages evidence and the Chinese-name control case, and @erywim for the fix.

What Problem This Solves

Sending a local file through the message tool with an explicit filename delivered the Feishu attachment under the media path's basename. For example, media: "/tmp/repro/report_en.pdf" with filename: "季度报告.pdf" arrived as report_en.pdf, and the call still reported success.

Why This Change Was Made

The Feishu send / thread-reply action now puts the caller's filename on its outbound context, and the plugin's sendMedia passes it to the fileName parameter sendMediaFeishu already supports. The upload already gives an explicit fileName precedence over the loaded name. The presentation-fallback media send reuses the same context, so it inherits the override too.

channel.ts and outbound.ts sit above their line caps and may not grow. Instead of moving the attachment resolver out of channel.ts, the plugin now uses the SDK's jsonResult in place of its local copy (jsonActionResult, same body), and the plugin-only FeishuOutboundSendMedia type moves to outbound-types.ts.

User Impact

Agents and operators can set the attachment name recipients see without renaming files on disk. Sends without filename keep the media path basename. Images are unchanged. Only the Feishu plugin changes; the shared message send path for other channels is untouched.

Evidence

Built Gateway (pnpm build) in a secretless node:24.22.1 container with the bundled Feishu plugin, pointed at a local HTTPS stand-in for the Feishu Open API that records the multipart file_name from im/v1/files and serves im/v1/messages. A scripted model calls the message tool with the reporter's exact args; the turn runs through openclaw agent --reply-channel feishu --reply-to chat:oc_repro --deliver.

  • Base vs candidate, twice each plus controls (no filename, Chinese-named file, image): fix(feishu): honor the filename override on sent attachments #205287 (comment). Base uploads report_en.pdf; the candidate uploads 季度报告.pdf; controls are unchanged.

  • Regression test in extensions/feishu/src/outbound.send-authority.test.ts drives handleAction({ action: "send", media, filename }) through the registered adapter and Feishu transport and checks the uploaded multipart body.

Merge danger

Two-way door: a revert restores the old naming. No config, schema, stored state or public contract changes. Blast radius: Feishu direct send / thread-reply media uploads that pass filename.

The Feishu send action dropped a caller-supplied filename at the action
and outbound handoffs, so attachments were uploaded under the media path
basename. Carry the normalized override through the outbound context into
sendMediaFeishu. The attachment-intent resolver and plugin-local outbound
media type move to sibling modules because their owning files are capped.

Closes openclaw#205246

Co-Authored-By: Claude Code <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 25, 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: M labels Nov 25, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:other This issue has meaningful maintainer-visible impact outside the owned taxonomy. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 25, 2026
@clawsweeper

clawsweeper Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

Preserves the caller’s attachment filename through Feishu’s action handler and outbound adapter into the existing uploader.

Example: Send /tmp/report_en.pdf with filename "季度报告.pdf".

  • Before: The attachment is named report_en.pdf.
  • After: The attachment is uploaded with the name 季度报告.pdf.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and source-consistent, but merge-required product proof is absent and exact-head CI has not completed successfully.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Feishu silently ignores an explicit attachment filename, forcing callers to rename staged files.
Reason: Restores an existing message metadata contract with a narrow plugin repair and no new public option or policy.

Merge readiness

⛔ Blocked before merge - 1 item remains

This PR repairs a concrete Feishu filename bug still present on current main; no introduced correctness defect was found.

Reviewed head: ebfec0149e40ff62a3818da668e93ae75d74e120

Before merge

  • Add real behavior proof - The supplied proof is a Vitest action-to-upload regression using the real Lark client, a mocked loader, and a loopback server; no after-fix run through the shipped Gateway or message tool is supplied. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.

Findings

None.

Tests

  • Missing end-to-end proof: Provide redacted after-fix Gateway/message-tool output showing the requested attachment name in Feishu, and establish that the regression fails on the base and passes on the head; redact IPs, keys, phone numbers, and non-public endpoints.
Agent review details

How this fits together

The Feishu plugin receives message actions, resolves attachment sources, and passes media plus display-name metadata through its outbound adapter to the Lark upload and message APIs.

flowchart LR
  A[Message action] --> B[Feishu action handler]
  B --> C[Outbound adapter]
  C --> D[Existing media uploader]
  D --> E[Lark upload and message APIs]
Loading

Technical review

Best possible solution:

Carry the existing filename metadata through Feishu’s two handoffs while retaining the uploader’s current precedence, sanitization, and media-access controls.

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

The official-release report and current source establish the dropped filename at both Feishu handoffs; this read-only review performed no live reproduction.

Is this the best way to solve the issue?

The repair uses the existing uploader and keeps filename propagation plugin-local; the module moves preserve behavior and satisfy the repository’s line-cap constraints.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 283b6d7dc96f.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned PR implementation: The introduced diff carries filename through both missing handoffs; attachment-source resolution and the private media type move without a competing implementation. (extensions/feishu/src/channel.ts:812, ebfec0149e40)
  • Bug remains on current main: Current main does not forward fileName into sendMediaFeishu; both production files are unchanged from the PR’s merge base. (extensions/feishu/src/outbound.ts:740, 283b6d7dc96f)
  • Existing uploader owns filename handling: sendMediaFeishu already prefers explicit fileName over the loaded filename and sanitizes it before assigning the upload’s file_name. (extensions/feishu/src/media.ts:581, ebfec0149e40)
  • Reporter’s official-release reproduction: Cindypapa reports the failure on OpenClaw 2026.11.10 and supplies Feishu message metadata showing report_en.pdf despite the explicit Chinese filename; naming the source file in Chinese works.
  • Regression boundary and supplied proof: The added regression reaches the real Lark client and checks the multipart request, using a mocked media loader and a loopback response fixture; the full PR body and comments provide no separate after-fix product capture. (extensions/feishu/src/outbound.send-authority.test.ts:215, ebfec0149e40)
  • Prior overlapping proposal is not a replacement: fix(feishu): preserve local attachment filenames in message send flow #43239 proposed filename plumbing but is closed unmerged; the current filename search identifies this PR and its linked report as the active work.

Likely related people:

  • SunnyShu: Raw commit f94eb16 adds extensions/feishu/src/outbound.ts:579 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f94eb160fbb8; files: extensions/feishu/src/outbound.ts)

PR surface

Source +14, Tests +19. Total +33 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 115 101 +14
Tests 2 24 5 +19
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 139 106 +33

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Root-cause cluster

Relationship: same_root_cause
Canonical: #205246
Summary: This PR addresses the linked report’s two missing filename handoffs.

Members:

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

Labels

Label changes:

  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 25, 2026, 6:06 AM ET / 11:06 UTC.

- Revert the 94-line move of resolveFeishuSendAttachmentMedia into send-attachment.ts.
- Pass the filename override on the direct-send outbound context in one line and map it to sendMediaFeishu's fileName.
- Reuse the SDK jsonResult instead of the local jsonActionResult copy so channel.ts stays within its line-cap ratchet against main.
@obviyus

obviyus commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Gateway proof for #205246 (built dist in secretless Docker, bundled Feishu plugin, local Feishu Open API stand-in recording the uploaded file_name, scripted model calling message with the reporter's args):

base = 81d69df5dc (merge base; Feishu and outbound code identical to main 23ffeaac55)
cand = dafdbf09ec
override args: {action:send, message:probe, media:/tmp/repro/report_en.pdf, filename:季度报告.pdf, forceDocument:true}

base-chinese-1: file file_name=核验中文名.pdf | im/v1/messages: file 核验中文名.pdf, post
base-image-1: image image_type=message | im/v1/messages: image, post
base-nofilename-1: file file_name=report_en.pdf | im/v1/messages: file report_en.pdf, post
base-override-1: file file_name=report_en.pdf | im/v1/messages: file report_en.pdf, post
base-override-2: file file_name=report_en.pdf | im/v1/messages: file report_en.pdf, post
cand-chinese-1: file file_name=核验中文名.pdf | im/v1/messages: file 核验中文名.pdf, post
cand-image-1: image image_type=message | im/v1/messages: image, post
cand-nofilename-1: file file_name=report_en.pdf | im/v1/messages: file report_en.pdf, post
cand-override-1: file file_name=季度报告.pdf | im/v1/messages: file 季度报告.pdf, post
cand-override-2: file file_name=季度报告.pdf | im/v1/messages: file 季度报告.pdf, post

regression test on base (test file only): uploads the action filename override instead of the media path basename -> FAIL (expected multipart body to contain 'quarterly-report.pdf')
same test on cand: pass (feishu bot/channel/outbound/send-authority/media suites: 2 shards passed)

@obviyus
obviyus merged commit 5271519 into openclaw:main Nov 25, 2026
101 of 104 checks passed
@obviyus

obviyus commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Merged in 5271519. Thanks @erywim for the fix and @Cindypapa for the precise reproduction in #205246. When the message tool sends a file to Feishu with an explicit filename, the attachment now arrives under that name instead of the media path's basename. Sends without filename, files already named the way you want and image sends are unchanged.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 26, 2026
…w#205287)

Root cause: extensions/feishu/src/channel.ts:942 (on 5279ca4) builds the direct-send `outboundContext` from the action params without `filename`, so `feishuOutbound.sendMedia` calls `sendMediaFeishu` (extensions/feishu/src/outbound.ts:736) with no `fileName` and the upload falls back to the loaded media basename (extensions/feishu/src/media.ts:581).

Fixes openclaw#205246

Thanks @Cindypapa for the report, the server-side `im/v1/messages` evidence and the Chinese-name control case, and @erywim for the fix.

## What Problem This Solves

Sending a local file through the `message` tool with an explicit `filename` delivered the Feishu attachment under the media path's basename. For example, `media: "/tmp/repro/report_en.pdf"` with `filename: "季度报告.pdf"` arrived as `report_en.pdf`, and the call still reported success.

## Why This Change Was Made

The Feishu `send` / `thread-reply` action now puts the caller's `filename` on its outbound context, and the plugin's `sendMedia` passes it to the `fileName` parameter `sendMediaFeishu` already supports. The upload already gives an explicit `fileName` precedence over the loaded name. The presentation-fallback media send reuses the same context, so it inherits the override too.

`channel.ts` and `outbound.ts` sit above their line caps and may not grow. Instead of moving the attachment resolver out of `channel.ts`, the plugin now uses the SDK's `jsonResult` in place of its local copy (`jsonActionResult`, same body), and the plugin-only `FeishuOutboundSendMedia` type moves to `outbound-types.ts`.

## User Impact

Agents and operators can set the attachment name recipients see without renaming files on disk. Sends without `filename` keep the media path basename. Images are unchanged. Only the Feishu plugin changes; the shared `message` send path for other channels is untouched.

## Evidence

Built Gateway (`pnpm build`) in a secretless node:24.22.1 container with the bundled Feishu plugin, pointed at a local HTTPS stand-in for the Feishu Open API that records the multipart `file_name` from `im/v1/files` and serves `im/v1/messages`. A scripted model calls the `message` tool with the reporter's exact args; the turn runs through `openclaw agent --reply-channel feishu --reply-to chat:oc_repro --deliver`.

- Base vs candidate, twice each plus controls (no `filename`, Chinese-named file, image): openclaw#205287 (comment). Base uploads `report_en.pdf`; the candidate uploads `季度报告.pdf`; controls are unchanged.

- Regression test in `extensions/feishu/src/outbound.send-authority.test.ts` drives `handleAction({ action: "send", media, filename })` through the registered adapter and Feishu transport and checks the uploaded multipart body.

## Merge danger

Two-way door: a revert restores the old naming. No config, schema, stored state or public contract changes. Blast radius: Feishu direct `send` / `thread-reply` media uploads that pass `filename`.

Co-authored-by: Claude Code <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 28, 2026
Root cause: extensions/feishu/src/channel.ts:942 (on 81d69df) builds the direct-send `outboundContext` from the action params without `filename`, so `feishuOutbound.sendMedia` calls `sendMediaFeishu` (extensions/feishu/src/outbound.ts:736) with no `fileName` and the upload falls back to the loaded media basename (extensions/feishu/src/media.ts:581).

Fixes #205246

Thanks @Cindypapa for the report, the server-side `im/v1/messages` evidence and the Chinese-name control case, and @erywim for the fix.

## What Problem This Solves

Sending a local file through the `message` tool with an explicit `filename` delivered the Feishu attachment under the media path's basename. For example, `media: "/tmp/repro/report_en.pdf"` with `filename: "季度报告.pdf"` arrived as `report_en.pdf`, and the call still reported success.

## Why This Change Was Made

The Feishu `send` / `thread-reply` action now puts the caller's `filename` on its outbound context, and the plugin's `sendMedia` passes it to the `fileName` parameter `sendMediaFeishu` already supports. The upload already gives an explicit `fileName` precedence over the loaded name. The presentation-fallback media send reuses the same context, so it inherits the override too.

`channel.ts` and `outbound.ts` sit above their line caps and may not grow. Instead of moving the attachment resolver out of `channel.ts`, the plugin now uses the SDK's `jsonResult` in place of its local copy (`jsonActionResult`, same body), and the plugin-only `FeishuOutboundSendMedia` type moves to `outbound-types.ts`.

## User Impact

Agents and operators can set the attachment name recipients see without renaming files on disk. Sends without `filename` keep the media path basename. Images are unchanged. Only the Feishu plugin changes; the shared `message` send path for other channels is untouched.

## Evidence

Built Gateway (`pnpm build`) in a secretless node:24.22.1 container with the bundled Feishu plugin, pointed at a local HTTPS stand-in for the Feishu Open API that records the multipart `file_name` from `im/v1/files` and serves `im/v1/messages`. A scripted model calls the `message` tool with the reporter's exact args; the turn runs through `openclaw agent --reply-channel feishu --reply-to chat:oc_repro --deliver`.

- Base vs candidate, twice each plus controls (no `filename`, Chinese-named file, image): #205287 (comment). Base uploads `report_en.pdf`; the candidate uploads `季度报告.pdf`; controls are unchanged.

- Regression test in `extensions/feishu/src/outbound.send-authority.test.ts` drives `handleAction({ action: "send", media, filename })` through the registered adapter and Feishu transport and checks the uploaded multipart body.

## Merge danger

Two-way door: a revert restores the old naming. No config, schema, stored state or public contract changes. Blast radius: Feishu direct `send` / `thread-reply` media uploads that pass `filename`.

Co-authored-by: Claude Code <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>

(cherry picked from commit 5271519)

Backport adaptation: Preserved the release channel action type import while forwarding the normalized filename and using the source outbound context and JSON result helper.

Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
…chiving (#205026)

* fix(sessions): keep inactive chats eligible for cold storage after archiving

* test(sessions): align archive fixtures and identity baseline

* test(sessions): create a private cold backup restore target

(cherry picked from commit 81d69df)

Follow-ups: 7cb8975 fix: keep forked Claude chats separate after a Gateway crash (#208048) [separately ordered lane row]; ece7a74 improve(workboard): apply the Control UI glossary and style to Workboard copy [not selected for this narrow backport]; b616036 refactor(subagents): simplify ACP spawn relay ownership (#207023) [not selected for this narrow backport]; 93ca762 improve: reduce allocations when preparing session rows (#207109) [not selected for this narrow backport]; 9993328 refactor(subagents): simplify kill claim and ownership handling (#207025) [not selected for this narrow backport]; 97815bd refactor(subagents): consolidate registry cleanup and publication guards (#207064) [not selected for this narrow backport]; e94f799 refactor(subagents): centralize requester turn matching (#206584) [not selected for this narrow backport]; ea77ca3 refactor: report update failures from recorded runs (#206700) [not selected for this narrow backport]; 4d7e00b fix: let started participant runs and requests finish after an access change (#206747) [not selected for this narrow backport]; f89ae43 refactor(subagents): use cleanup and terminal owners in sweeps (#206533) [not selected for this narrow backport]; a882e0f fix(agents): preserve task answers when sessions are reused (#126263) [not selected for this narrow backport]; 81fc833 refactor(subagents): own dormant child Stop decisions (#206479) [not selected for this narrow backport]; 91d4912 fix(update): stop using foreign recovery records as admission (#206295) [not selected for this narrow backport]; be3c73e fix(subagents): finish claimed stops after session rotation (#206405) [not selected for this narrow backport]; ed8b883 fix(update): settle after plugins and share one completion summary (#205987) [not selected for this narrow backport]; 1de306e fix: pause interrupted shell turns when their result is unknown (#205859) [separately ordered lane row]; 16a6aa4 fix(memory): keep a child's memory audience after its parent resets (#205887) [not selected for this narrow backport]; 50a7368 feat: let agents snooze a conversation after replying [not selected for this narrow backport]; 40f3903 fix(ci): remove unused role and workflow exports (#205720) [not selected for this narrow backport]; e43debf refactor(state): migrate in place and remove copy-and-swap (#205165) [not selected for this narrow backport]; 8027293 refactor(plugins): plugin tools take the turn's owner bit; delete the requester-owner continuation (OA2 PR 6j) (#205483) [not selected for this narrow backport]; 13e2ec3 feat: let participants publish through the session's shared GitHub account (#204914) [not selected for this narrow backport]; 5434992 fix: use the configured runtime when switching model providers (#203973) [not selected for this narrow backport]; 5271519 fix(feishu): honor the filename override on sent attachments (#205287) [not selected for this narrow backport]; ca087d4 refactor(admission): drop the replay automationAdmin bit and the R7 source re-check (#205268) [not selected for this narrow backport]

Co-authored-by: RomneyDa <[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 impact:other This issue has meaningful maintainer-visible impact outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S 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 message send ignores the filename override — attachment is delivered under the media path basename

2 participants