Skip to content

fix(extensions): synthesize mediaLocalRoots propagation across sendMedia adapters#33799

Merged
Takhoffman merged 8 commits intomainfrom
task/media-root-synthesis-ws3
Mar 4, 2026
Merged

fix(extensions): synthesize mediaLocalRoots propagation across sendMedia adapters#33799
Takhoffman merged 8 commits intomainfrom
task/media-root-synthesis-ws3

Conversation

@Takhoffman
Copy link
Copy Markdown
Contributor

Summary

This PR synthesizes overlapping fixes to restore deterministic mediaLocalRoots propagation through extension sendMedia adapters, so local media paths resolve from configured roots instead of silently dropping roots at extension boundaries.

Synthesis Scope

What changed

  • Google Chat: sendMedia now uses local-capable media loading and passes roots to localRoots.
  • Slack: forwards mediaLocalRoots through outbound sendMedia.
  • iMessage: forwards mediaLocalRoots through helper + outbound sendMedia path.
  • Signal: forwards mediaLocalRoots through helper + outbound sendMedia path.
  • WhatsApp: forwards mediaLocalRoots through outbound sendMedia.
  • Added local-path fixture coverage for each affected extension send path.
  • Added a single changelog fix entry with synthesis attribution.

Invariant

  • For local media paths, roots are propagated unchanged to the downstream loader/sender.
  • For non-local media URLs, existing behavior remains unchanged.

Verification

  • pnpm install --frozen-lockfile
  • pnpm build
  • pnpm check
  • pnpm test:macmini
  • pnpm test extensions/googlechat/src/channel.outbound.test.ts extensions/slack/src/channel.test.ts extensions/imessage/src/channel.outbound.test.ts extensions/signal/src/channel.test.ts extensions/whatsapp/src/channel.test.ts

Notes

This synthesis supersedes the extension-level root propagation deltas from #33581, #33545, #33540, #33536, and #33528.

@openclaw-barnacle openclaw-barnacle Bot added channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: signal Channel integration: signal channel: slack Channel integration: slack channel: whatsapp-web Channel integration: whatsapp-web size: M maintainer Maintainer-authored PR labels Mar 4, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 4, 2026

Greptile Summary

This PR synthesizes mediaLocalRoots propagation fixes across five extension sendMedia adapters (Google Chat, Slack, iMessage, Signal, WhatsApp), ensuring local media paths resolve from configured roots instead of silently dropping them at extension boundaries. The implementation is correct and well-tested, with each affected adapter receiving a focused new test case.

Key changes:

  • Google Chat: Replaces runtime.channel.media.fetchRemoteMedia with runtime.media.loadWebMedia, passing localRoots when mediaLocalRoots is provided. The WebMediaOptions type confirms localRoots is a supported field, making the API usage valid.
  • Slack & WhatsApp: Destructure mediaLocalRoots and pass it directly (possibly undefined) to the downstream send function — slightly inconsistent with the conditional-spread pattern used in Signal and iMessage, but functionally correct since downstream functions handle absent/undefined roots gracefully.
  • iMessage & Signal: Use a conditional spread (...(params.mediaLocalRoots?.length ? { mediaLocalRoots: params.mediaLocalRoots } : {})) through the internal outbound helper, which is the safer pattern.
  • The Google Chat channel.outbound.test.ts only covers the new local-path case; there is no test covering the remote URL path, which changed from fetchRemoteMedia to loadWebMedia and was previously untested.

Confidence Score: 4/5

  • PR is safe to merge; changes are narrowly scoped to forwarding an existing field through adapter call chains with correct type usage throughout.
  • The implementation is correct: WebMediaOptions.localRoots is a valid field, the Google Chat API switch from fetchRemoteMedia to loadWebMedia is type-safe, and the new tests confirm the propagation invariant for each adapter. Score is 4 rather than 5 because the Google Chat outbound test only exercises the local-path branch, leaving the remote-URL behavioral change (fetchRemoteMedia → loadWebMedia) without any test coverage in the test suite.
  • extensions/googlechat/src/channel.outbound.test.ts — missing a remote-URL test case to cover the change from fetchRemoteMedia to loadWebMedia.

Last reviewed commit: 621ed20

Comment thread extensions/googlechat/src/channel.outbound.test.ts
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 621ed20b9a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread extensions/googlechat/src/channel.ts Outdated
@Takhoffman
Copy link
Copy Markdown
Contributor Author

Addressed the review findings in commit 725dc05:

  • Google Chat sendMedia now preserves the prior remote URL path (fetchRemoteMedia) with the configured maxBytes cap, while still using loadWebMedia + localRoots for local paths.
  • Added remote URL regression coverage in extensions/googlechat/src/channel.outbound.test.ts to verify:
    • remote URLs use fetchRemoteMedia with capped bytes
    • loadWebMedia is not used for remote URLs
    • upload + send still complete successfully

Re-ran:

  • pnpm test extensions/googlechat/src/channel.outbound.test.ts

@openclaw-barnacle openclaw-barnacle Bot added the extensions: memory-core Extension: memory-core label Mar 4, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3921440f3a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

maxBytes: maxBytes ?? (account.config.mediaMaxMb ?? 20) * 1024 * 1024,
});
const effectiveMaxBytes = maxBytes ?? (account.config.mediaMaxMb ?? 20) * 1024 * 1024;
const loaded = /^https?:\/\//i.test(mediaUrl)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Trim mediaUrl before checking HTTP scheme

googlechatPlugin.outbound.sendMedia now branches on /^https?:\/\// using the raw mediaUrl, but the previous code path always sent the URL to fetchRemoteMedia, whose URL parsing tolerates surrounding whitespace. This means inputs like " https://example.com/image.png " are now misclassified as local paths and sent to loadWebMedia, which fails with local-path allowlist errors instead of downloading the remote media. Normalizing/trimming the URL before the scheme check preserves the prior remote behavior for whitespace-padded URLs.

Useful? React with 👍 / 👎.

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

Labels

channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: signal Channel integration: signal channel: slack Channel integration: slack channel: whatsapp-web Channel integration: whatsapp-web maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants