[PR #12909] fix: clipboard image paste on Linux (WebKitGTK) #14430

Closed
opened 2026-02-16 18:19:13 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/12909

State: closed
Merged: No


Summary

  • Fix clipboard image paste not working on Linux desktop (WebKitGTK)
  • Fix unregistered tools (MCP tools, background tasks) showing no expandable output
  • Fix edit tool diff not rendering: correct filediff.path → filediff.file (matches FileDiff schema)
  • Add ErrorBoundary + text fallback around diff component for when @pierre/diffs fails
  • Add try-catch with console.warn in Diff component render effect
  • Fix task agent showing empty content when child session data is unavailable — show output text as fallback
  • Add error logging for clipboard read failures to aid debugging

Details

Clipboard paste (Linux/WebKitGTK)

WebKitGTK Bug #218519: clipboardData.items returns empty for images. The native readClipboardImage() fallback was gated behind !plainText, preventing it from running when clipboard also contained text (common with screenshot tools). Moved native clipboard attempt before plainText check.

Edit tool diff

  • <Show when={props.metadata.filediff?.path}> referenced nonexistent path field — FileDiff schema uses file. Fixed to filediff?.file.
  • Added ErrorBoundary around the Dynamic diff component with a text-based fallback when the shadow DOM / web worker based diff rendering fails.
  • Added try-catch in the Diff component's createEffect render loop so FileDiff.render() failures don't silently swallow errors.

Task agent empty state

Task tool always rendered wrapper divs even when childToolParts() was empty (child session data not in store). Now conditionally renders: shows tool list when parts exist, falls back to props.output text when empty.

GenericTool output

GenericTool (fallback for unregistered tools) was ignoring the output prop entirely. Now passes through output, hideDetails, defaultOpen, forceOpen, locked and renders output in a collapsible pre block.

Test plan

  • Screenshot tool (Spectacle/Flameshot) → copy image → Ctrl+V in prompt → image attaches
  • Copy text with image in clipboard → Ctrl+V → image attaches (not just text)
  • Edit tool shows diff content when expanded
  • Task agent shows output when child session data is unavailable
  • MCP/unregistered tools show expandable output
  • Verify no TypeScript errors across all packages
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12909 **State:** closed **Merged:** No --- ## Summary - Fix clipboard image paste not working on Linux desktop (WebKitGTK) - Fix unregistered tools (MCP tools, background tasks) showing no expandable output - Fix edit tool diff not rendering: correct filediff.path → filediff.file (matches FileDiff schema) - Add ErrorBoundary + text fallback around diff component for when @pierre/diffs fails - Add try-catch with console.warn in Diff component render effect - Fix task agent showing empty content when child session data is unavailable — show output text as fallback - Add error logging for clipboard read failures to aid debugging ## Details ### Clipboard paste (Linux/WebKitGTK) WebKitGTK Bug #218519: `clipboardData.items` returns empty for images. The native `readClipboardImage()` fallback was gated behind `!plainText`, preventing it from running when clipboard also contained text (common with screenshot tools). Moved native clipboard attempt before plainText check. ### Edit tool diff - `<Show when={props.metadata.filediff?.path}>` referenced nonexistent `path` field — FileDiff schema uses `file`. Fixed to `filediff?.file`. - Added `ErrorBoundary` around the Dynamic diff component with a text-based fallback when the shadow DOM / web worker based diff rendering fails. - Added try-catch in the Diff component's `createEffect` render loop so `FileDiff.render()` failures don't silently swallow errors. ### Task agent empty state Task tool always rendered wrapper divs even when `childToolParts()` was empty (child session data not in store). Now conditionally renders: shows tool list when parts exist, falls back to `props.output` text when empty. ### GenericTool output `GenericTool` (fallback for unregistered tools) was ignoring the `output` prop entirely. Now passes through `output`, `hideDetails`, `defaultOpen`, `forceOpen`, `locked` and renders output in a collapsible pre block. ## Test plan - [ ] Screenshot tool (Spectacle/Flameshot) → copy image → Ctrl+V in prompt → image attaches - [ ] Copy text with image in clipboard → Ctrl+V → image attaches (not just text) - [ ] Edit tool shows diff content when expanded - [ ] Task agent shows output when child session data is unavailable - [ ] MCP/unregistered tools show expandable output - [ ] Verify no TypeScript errors across all packages
yindo added the pull-request label 2026-02-16 18:19:13 -05:00
yindo closed this issue 2026-02-16 18:19:13 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14430