Repository navigation
fix(ui): surface sidebar clipboard failures across reconnects - #118632
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 3, 2026, 7:16 AM ET / 11:16 UTC. ClawSweeper reviewWhat this changesThe PR makes file-sidebar path and contents copy failures visible and accessible, while preventing stale success or failure feedback after a sidebar reconnect or file change. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 3 items remain Keep open. Current main silently discards failed clipboard outcomes in the file sidebar; this patch gives the owning custom element per-action feedback and invalidates stale completions across file changes and reconnects. I found no concrete patch defect, but the PR body supplies jsdom-based regression claims rather than after-fix browser/runtime evidence, so real behavior proof remains required before merge. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI file sidebar receives a selected workspace file and offers copy-path and copy-contents actions. Those actions call the shared browser clipboard helper, and the sidebar must turn its boolean outcome into independent button feedback and a visible alert without letting old asynchronous results affect a new view. flowchart LR
A[Selected workspace file] --> B[File sidebar custom element]
B --> C[Copy path or contents action]
C --> D[Clipboard helper]
D --> E[Browser Clipboard API or legacy fallback]
E --> F{Copy outcome current?}
F -->|yes| G[Accessible button feedback]
F -->|yes on failure| H[Visible failure alert]
F -->|stale| I[Ignore obsolete completion]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +34, Tests +277. Total +311 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the per-action sidebar-owned state machine and land it after a redacted real-browser Control UI run demonstrates a denied copy, visible alert, recovery to the idle label, and no stale feedback after reconnect. Do we have a high-confidence way to reproduce the issue? Yes, from source: make either shared clipboard route return false while using the current file sidebar; current main leaves the action at its idle label with no alert. I did not execute contributor code locally because this is an external PR and the checkout is read-only. Is this the best way to solve the issue? Yes. Moving the result handling into the file-sidebar owner is the narrowest maintainable repair: the shared helper remains a generic boolean provider, while the UI owner controls visible feedback, timers, and lifecycle invalidation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e87fb689b533. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…aw#118632) * fix(ui): surface sidebar clipboard failures across reconnects * test(ui): type sidebar clipboard lifecycle fixtures correctly
Summary
Actual user-visible owner behavior
The real sidebar custom element and actual clipboard helper previously ignored failures from both navigator.clipboard and document.execCommand. Both
Copy pathandCopy file contentssilently remained at their idle icon/accessible label.The repaired owner displays a localized visible
role=alertfailure and matching accessible button feedback for both actions, preserves successful copies, and restores the correct idle labels independently.A fresh security/lifecycle review additionally identified that detaching and reconnecting the same custom element could preserve obsolete success/failure feedback or allow a pre-detach clipboard promise to publish into a new connection. Four actual custom-element regressions reproduced those failures before the owner fix. Connection-scoped monotonic action generations now invalidate every obsolete completion without resetting counters or triggering reactive updates from disconnected lifecycle cleanup.
The tests run the real custom element, real clipboard helper, real user-visible DOM and accessibility attributes; only the unrelated browser-only CodeMirror editor initialization is replaced on the individual test instance because it cannot run in jsdom.
Verification
Exact-head actual Chromium after-fix proof
Reviewed head: bfc701c. A real headless Chromium browser loaded the actual reviewed Control UI through the actual Vite source server and a local mock Gateway. Both changed file-sidebar buttons were clicked, both real browser clipboard mechanisms were denied, visible alert and accessible feedback were observed, each action reset, and the exact same custom element was disconnected/reconnected while an older promise completed. No provider calls or external traffic.
{"result":"PASS","head":"bfc701cbd42bbf6f6ad63c5f250ea00a3fb49818","browser":"chromium","actualBrowser":true,"actualViteSourceUi":true,"mockGateway":"local","actions":[{"action":"path","modernClipboardDenied":true,"legacyCopyDenied":true,"visibleAlert":"Copy failed","failedAriaLabel":"Copy failed","idleAriaLabel":"Copy path","resetAlertCleared":true},{"action":"contents","modernClipboardDenied":true,"legacyCopyDenied":true,"visibleAlert":"Copy failed","failedAriaLabel":"Copy failed","idleAriaLabel":"Copy file contents","resetAlertCleared":true}],"reconnect":{"sameElement":true,"connected":true,"staleCompletionIgnored":true,"idleAriaLabel":"Copy file contents","alertAbsent":true},"fileRequests":1,"providerCalls":0,"screenshots":["sidebar-path-denied.png","sidebar-contents-denied.png","sidebar-reconnect-stale-completion.png"]}Browser and Vite server shut down cleanly; both reviewed source overlays were restored. Actual browser run exited zero in 8.81 seconds. All four exact-head hosted Chromium shards and the required CI gate also passed.