Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@hopyky
Copy link

@hopyky hopyky commented Jan 22, 2026

The message tool accepts path and filePath parameters in its schema, but these were never converted to mediaUrl, causing local files to be ignored when sending messages.

Changes:

  • src/agents/tools/message-tool.ts: Convert path/filePath to media with file:// URL
  • src/infra/outbound/message-action-runner.ts: Allow hydrateSendAttachmentParams for "send" action

Fixes issue where local audio files (and other media) couldn't be sent via the message tool with the path parameter.

Users can now use:
message({ path: "/tmp/file.ogg" })
message({ filePath: "/tmp/file.ogg" })

The message tool accepts path and filePath parameters in its schema,
but these were never converted to mediaUrl, causing local files to
be ignored when sending messages.

Changes:
- src/agents/tools/message-tool.ts: Convert path/filePath to media with file:// URL
- src/infra/outbound/message-action-runner.ts: Allow hydrateSendAttachmentParams for "send" action

Fixes issue where local audio files (and other media) couldn't be sent
via the message tool with the path parameter.

Users can now use:
  message({ path: "/tmp/file.ogg" })
  message({ filePath: "/tmp/file.ogg" })
@hopyky hopyky force-pushed the fix-message-path-parameter branch from c2daf08 to 57e81d3 Compare January 22, 2026 12:15
@steipete steipete self-assigned this Jan 23, 2026
@steipete
Copy link
Contributor

  • High: src/agents/tools/message-tool.ts:340 new file:// conversion breaks ~ and relative paths (and Windows paths). loadWebMedia expands ~ only for raw paths; file:// ~ will fail fileURLToPath. file://./foo becomes a host/UNC path. Suggest: keep raw path, or use pathToFileURL(resolveUserPath(path)).toString() after path.resolve, and only for absolute paths.
  • Medium: src/infra/outbound/message-action-runner.ts:346 hydrate for "send" now eagerly loads media + enforces attachment size. Send already handles mediaUrl downstream; this adds double IO and can fail large/remote media before channel handling. Suggest: keep sendAttachment-only or gate on explicit buffer intent.
  • Medium: no tests for send with path/filePath (incl. ~, relative). Add coverage if behavior changes.

Thanks, taking over and fixing things up.

@steipete steipete merged commit 542cf01 into openclaw:main Jan 23, 2026
19 of 22 checks passed
@steipete
Copy link
Contributor

Landed via temp rebase onto main.\n\n- Gate: pnpm lint && pnpm build && pnpm test\n- Land commit: 9cf4fc3\n- Merge commit: 542cf01\n\nThanks @hopyky!

@steipete
Copy link
Contributor

Follow-up fix landed on main after merge (PR head was forked).\n\n- Gate: pnpm lint && pnpm build && pnpm test\n- Fix commit: 837749d

@hopyky
Copy link
Author

hopyky commented Jan 23, 2026

Hi @steipete,

Thanks for the merge and the credit but i noticed commit 837749d removes the conversion logic I added (path/filePath → file:// media URL) and reverts hydrateSendAttachmentParams to "sendAttachment" only.
The tests added seem to assert that path/filePath should not be converted ; which is the opposite of what this PR was
trying to fix.

I understand you had concerns about tilde expansion, relative paths, and double I/O, i would have been happy to iterate on those points if you want.

Could you clarify:

  1. What's the expected behavior now for message({ path: "/tmp/file.ogg" })?
  2. Should I open a new PR with a different approach?

Thanks!

@steipete
Copy link
Contributor

Yeah - why would we want that? binary only when absolutely necessary? Or did I misunderstand something?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants