Skip to content

fix(whatsapp): preserve outbound document filenames#15594

Merged
steipete merged 4 commits intoopenclaw:mainfrom
TsekaLuk:codex/fix-whatsapp-doc-filename-15560
Feb 13, 2026
Merged

fix(whatsapp): preserve outbound document filenames#15594
steipete merged 4 commits intoopenclaw:mainfrom
TsekaLuk:codex/fix-whatsapp-doc-filename-15560

Conversation

@TsekaLuk
Copy link
Contributor

@TsekaLuk TsekaLuk commented Feb 13, 2026

Summary

  • pass the resolved media filename through WhatsApp outbound send options
  • use sendOptions.fileName for document payloads instead of hardcoding "file"
  • keep backward compatibility by falling back to "file" when filename is absent

Why

Outbound WhatsApp documents currently always appear as file on the receiver side because filename is hardcoded in createWebSendApi().

Changes

  • src/web/outbound.ts: capture document media.fileName and include it in ActiveWebSendOptions
  • src/web/active-listener.ts: add optional fileName to ActiveWebSendOptions
  • src/web/inbound/send-api.ts: use sendOptions?.fileName?.trim() || "file" for document payloads
  • src/web/outbound.test.ts: assert filename is propagated for document sends
  • src/web/inbound/send-api.test.ts (new): verify both propagated filename and default fallback behavior

Fixes #15560

Validation

  • pnpm check
  • pnpm build
  • pnpm vitest run src/web/outbound.test.ts src/web/inbound/send-api.test.ts
  • pnpm test:fast (fails on existing unrelated src/security/audit.test.ts assertion in local skill-scan fixture; unchanged by this PR)

Greptile Overview

Greptile Summary

This PR threads a resolved media filename from WhatsApp outbound media loading into the active web send options, and updates the inbound send API to use that filename for document payloads (falling back to "file" when absent). Tests were updated/added to assert filename propagation and default behavior.

One blocking issue: the new src/web/inbound/send-api.test.ts mocks recordChannelActivity using an incorrect relative path, so the mock won’t apply (and may fail module resolution). Fixing the mock path should make the new tests reliable.

Confidence Score: 4/5

  • Mostly safe to merge once the new test’s broken mock path is fixed.
  • The runtime change is small and well-covered by tests, but the added test currently mocks a non-existent module path and won’t reliably stub the dependency used by the code under test, which is a merge blocker for CI.
  • src/web/inbound/send-api.test.ts

Last reviewed commit: e1f7784

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +4 to +6
vi.mock("../../infra/channel-activity.js", () => ({
recordChannelActivity: (...args: unknown[]) => recordChannelActivity(...args),
}));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken mock import path

send-api.ts imports recordChannelActivity from "../../infra/channel-activity.js" (relative to src/web/inbound/send-api.ts), but this test mocks "../../infra/channel-activity.js" relative to src/web/inbound/send-api.test.ts, which resolves to src/web/infra/channel-activity.js (non-existent) and won’t stub the real dependency. This will either throw during module resolution or cause the real recordChannelActivity to run.

Suggested change
vi.mock("../../infra/channel-activity.js", () => ({
recordChannelActivity: (...args: unknown[]) => recordChannelActivity(...args),
}));
vi.mock("../../../infra/channel-activity.js", () => ({
recordChannelActivity: (...args: unknown[]) => recordChannelActivity(...args),
}));
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/web/inbound/send-api.test.ts
Line: 4:6

Comment:
**Broken mock import path**

`send-api.ts` imports `recordChannelActivity` from `"../../infra/channel-activity.js"` (relative to `src/web/inbound/send-api.ts`), but this test mocks `"../../infra/channel-activity.js"` relative to `src/web/inbound/send-api.test.ts`, which resolves to `src/web/infra/channel-activity.js` (non-existent) and won’t stub the real dependency. This will either throw during module resolution or cause the real `recordChannelActivity` to run.

```suggestion
vi.mock("../../../infra/channel-activity.js", () => ({
  recordChannelActivity: (...args: unknown[]) => recordChannelActivity(...args),
}));
```

How can I resolve this? If you propose a fix, please make it concise.

@TsekaLuk
Copy link
Contributor Author

Addressed, thanks. Updated the mock path to in and pushed commit f34019f.

@TsekaLuk
Copy link
Contributor Author

Follow-up with exact details:

  • Updated mock path to ../../../infra/channel-activity.js
  • File: src/web/inbound/send-api.test.ts
  • Commit: f34019f

@TsekaLuk
Copy link
Contributor Author

I investigated the current check failure on this PR.

The failing error is:

  • eslint(no-control-regex) at src/gateway/server/ws-connection.ts:22

I reproduced it by running pnpm check on refs/pull/15594/merge. This file is from the current base branch merge result, not from the WhatsApp filename changes in this PR.

I will re-run/refresh once the base-branch lint issue is resolved, and keep this PR branch updated.

@steipete steipete self-assigned this Feb 13, 2026
@TsekaLuk
Copy link
Contributor Author

Follow-up: I opened a focused base-fix PR for the lint regression here: #15610.\n\nIf that merges, this PR's should stop failing for the external blocker.

@TsekaLuk
Copy link
Contributor Author

Correction with exact text:

  • external blocker is CI check
  • failing lint: eslint(no-control-regex)
  • file path: src/gateway/server/ws-connection.ts

Tracked/fixed in #15610.

@openclaw-barnacle openclaw-barnacle bot added channel: whatsapp-web Channel integration: whatsapp-web size: S labels Feb 13, 2026
@TsekaLuk
Copy link
Contributor Author

Applied the baseline lint fix directly to this branch.

New commit: 6a427c857

  • fixes eslint(no-control-regex) in src/gateway/server/ws-connection.ts
  • keeps branch pnpm check green locally

This should unblock the check job from the shared base-branch failure mode.

@TsekaLuk TsekaLuk force-pushed the codex/fix-whatsapp-doc-filename-15560 branch from 6a427c8 to 63912bd Compare February 13, 2026 17:34
@TsekaLuk
Copy link
Contributor Author

Rebased this branch onto latest main and force-pushed to clear merge conflicts.

Current head: 63912bd76
Status now shows mergeable=MERGEABLE; CI has restarted.

@openclaw-barnacle openclaw-barnacle bot added the gateway Gateway runtime label Feb 13, 2026
steipete added a commit to TsekaLuk/openclaw that referenced this pull request Feb 13, 2026
steipete added a commit to TsekaLuk/openclaw that referenced this pull request Feb 13, 2026
@steipete steipete force-pushed the codex/fix-whatsapp-doc-filename-15560 branch from 63912bd to bd81694 Compare February 13, 2026 17:42
@TsekaLuk
Copy link
Contributor Author

Hey! 👋 CI is all green on this one. Would you have time to take a look? Happy to make changes if needed. Thanks!

steipete added a commit to TsekaLuk/openclaw that referenced this pull request Feb 13, 2026
steipete added a commit to TsekaLuk/openclaw that referenced this pull request Feb 13, 2026
@steipete steipete force-pushed the codex/fix-whatsapp-doc-filename-15560 branch from bd81694 to 78e45bd Compare February 13, 2026 17:53
@steipete steipete force-pushed the codex/fix-whatsapp-doc-filename-15560 branch from 78e45bd to 8e0d765 Compare February 13, 2026 17:53
@steipete steipete merged commit c544811 into openclaw:main Feb 13, 2026
9 checks passed
@steipete
Copy link
Contributor

Merged via squash.

Thanks @TsekaLuk!

zhangyang-crazy-one pushed a commit to zhangyang-crazy-one/openclaw that referenced this pull request Feb 13, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 8e0d765
Co-authored-by: TsekaLuk <[email protected]>
Co-authored-by: steipete <[email protected]>
Reviewed-by: @steipete
steipete added a commit to azade-c/openclaw that referenced this pull request Feb 14, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 8e0d765
Co-authored-by: TsekaLuk <[email protected]>
Co-authored-by: steipete <[email protected]>
Reviewed-by: @steipete
GwonHyeok pushed a commit to learners-superpumped/openclaw that referenced this pull request Feb 15, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 8e0d765
Co-authored-by: TsekaLuk <[email protected]>
Co-authored-by: steipete <[email protected]>
Reviewed-by: @steipete
SahilSahu731 added a commit to SahilSahu731/openclaw that referenced this pull request Feb 15, 2026
- Extends fix from openclaw#15594 to preserve filenames for outbound documents
- Propagates fileName through the delivery pipeline (infra, adapters, and web)
- Resolves issue where PDFs/docs display as 'file' on the recipient device
- Added unit test to verify custom filename priority
Fixes openclaw#15594
Twynzen pushed a commit to Twynzen/sendell-clawd that referenced this pull request Feb 15, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 8e0d765
Co-authored-by: TsekaLuk <[email protected]>
Co-authored-by: steipete <[email protected]>
Reviewed-by: @steipete
cloud-neutral pushed a commit to cloud-neutral-toolkit/openclawbot.svc.plus that referenced this pull request Feb 15, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 8e0d765
Co-authored-by: TsekaLuk <[email protected]>
Co-authored-by: steipete <[email protected]>
Reviewed-by: @steipete
jiulingyun added a commit to jiulingyun/openclaw-cn that referenced this pull request Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: whatsapp-web Channel integration: whatsapp-web gateway Gateway runtime size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: WhatsApp outbound documents always show as "file" — fileName hardcoded in sendMessage handler

2 participants

Comments