fix(opencode): report clipboard copy failures#27861
Conversation
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Manual validation details for the clipboard failure path: Environment used for reproduction/verification:
Validation performed:
Local checks run:
The required GitHub checks ( |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
I've just tested this and I think that the code works well but it doesn't show up entirely in front end (an error message). It seems to just be a red box showing. The underlying issue still doesn't seem to be entirely fixed, and perhaps I need to test with OSC-52 compatible term but there should also be a message to notify users if that doesn't work. #4283 isn't entirely fixed by this, I'm also running 24.04. |
Issue for this PR
Closes #4283
Type of change
What does this PR do?
Clipboard copy operations in the TUI could report success even when the selected backend failed. That made mouse selection copy show
Copied to clipboardwhile the clipboard was unchanged.This changes clipboard writes so backend failures propagate instead of being swallowed:
osascriptwrite failures now rejectclipboardy.write()failures now rejectThe existing toast/error handlers can then show the real clipboard failure instead of a false success message.
How did you verify your code works?
bun test --timeout 30000 test/cli/cmd/tui/clipboard.test.ts.bun run typecheckfrompackages/opencode.bun turbo typecheck.DISPLAY=:1, noWAYLAND_DISPLAY). Withxclip,xsel, andwl-copyabsent andDISPLAY=set, the patched TUI surfaces the Linux clipboard backend error instead of showingCopied to clipboard.Screenshots / recordings
N/A. This is a terminal clipboard error-handling change; the relevant behavior is covered by the regression test and manual verification above.
Checklist