Commit 01e7b3c
committed
fix(message-tool): hydrate attachments[] on reply/sendAttachment/setGroupIcon/upload-file
The message-tool schema (src/agents/tools/message-tool.ts:194) advertises a
structured `attachments: [{path, mimeType, name, …}]` array as a peer of the
top-level `media|mediaUrl|path|filePath` slots. The `send` action consumed it
via `collectMessageAttachmentMediaHints` in the runner, but the single-attachment
hydration path used by `reply`, `sendAttachment`, `setGroupIcon`, and
`upload-file` (`hydrateAttachmentActionPayload` in message-action-params.ts) only
looked at top-level keys. Agents that followed the published schema and passed
`attachments: [{path: "/abs/pic.png", mimeType: "image/png", name: "pic.png"}]`
to `action: "reply"` had hydration find no hint, no buffer was loaded, and the
channel handler shipped text-only with the attachment silently dropped. No
error was raised because `extractReplyAttachment` only throws on a *bypass*
shape (top-level path with no buffer), not on absence — and `attachments[]`
left every top-level slot empty.
Fix: lift the first attachment's path / mimeType / filename into the
top-level slots inside `hydrateAttachmentActionPayload` before reading hints.
Backward-compatible (only fills empty slots; explicit top-level hints win) and
preserves all existing sandbox / localRoots / size enforcement, since the
loaded `mediaSource` still flows through `loadWebMedia` with the resolved
policy.
Bug surface: every channel's `reply` action (iMessage, Telegram, WhatsApp,
Discord, BlueBubbles, …), since they all share the same core hydration step.1 parent c04c03f commit 01e7b3c
2 files changed
Lines changed: 104 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
117 | 169 | | |
118 | 170 | | |
119 | 171 | | |
| |||
361 | 413 | | |
362 | 414 | | |
363 | 415 | | |
| 416 | + | |
364 | 417 | | |
365 | 418 | | |
366 | 419 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
774 | 774 | | |
775 | 775 | | |
776 | 776 | | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
777 | 828 | | |
778 | 829 | | |
779 | 830 | | |
| |||
0 commit comments