Skip to content

fix(ui): report failed copies and retire stale clipboard actions - #130612

Merged
steipete merged 2 commits into
mainfrom
codex/qa-ui-copy-feedback-20260827
Aug 27, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/qa-ui-copy-feedback-20260827

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #130611

Additional instructions

Maintainers can edit this repository-owned branch.

What Problem This Solves

Fixes an issue where users copying a tool diff, selected transcript text, or an Agent ID would get no failure feedback when both browser clipboard methods failed. The selection menu even disappeared as though the copy had succeeded.

Why This Change Was Made

All three controls now use the existing copy-button outcome and retry behavior. Selection copying dismisses its menu only on current success. Agent controls retire their pending copy state when the selected agent changes, and the shared owner cancels an obsolete legacy fallback before it can overwrite a newer copy.

This removes duplicate tool-copy markup and reuses the existing clipboard cancellation seam, without adding a timer, transport, controller, configuration, or persisted state. The five net production lines provide the visible-label/result handoff and asynchronous resource-identity boundary; tests are counted separately.

User Impact

Failed copies are visible and retryable. Pending double-clicks do not duplicate work. A late result from a previous agent or dismissed selection menu cannot relabel the current control or overwrite the newer clipboard through the legacy fallback. Successful selection copying still closes the menu.

Evidence

  • Actual Chromium Control UI with synthetic Gateway data: all three original failure cases reproduced before editing, with both clipboard methods attempted once and no failure feedback.
  • Lifecycle challenge reproduced an old pending agent copy overwriting a newer successful copy after delayed rejection; the repaired sequence passes for both delayed success and rejection.
  • 19 Chromium tests passed across clipboard and existing message-action flows: failure/retry/success, rapid double-click, agent switching, and late selection completion after Escape, outside click, replacement, navigation, and reconnect followed by dismissal.
  • 599 focused owner/sibling tests passed across ten files, including plain-HTTP fallback, locale rerenders, workspace/session diff actions, usage, and channel setup copying.
  • Independent verification on the exact final bytes passed the same 19 Chromium tests and 249 additional focused tests across six files, including device pairing and the shared clipboard owner. These counts overlap the author's runs and are not additive coverage totals.
  • A fresh source-blind validator passed all five behavior clauses across 29 recorded, partly overlapping variants against the built UI. It changed the payloads and agent IDs, checked actual transport results separately from labels, exercised working legacy fallback and retired fallback, and verified reconnect outcomes. No findings or blockers.
  • Full changed-file gate passed: types, lint/style, formatting, i18n catalog, dead exports, and repository guards. Initial lint findings were corrected before the clean gate.
  • Authenticated Codex review of the final patch: no actionable findings. AI-assisted implementation; no agent transcript included.

Commands:

OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-flow.clipboard.e2e.test.ts ui/src/e2e/chat-message-actions.e2e.test.ts
OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs ui/src/pages/chat/components/chat-tool-cards.test.ts ui/src/pages/chat/chat-view.test.ts ui/src/pages/agents/view.test.ts ui/src/pages/chat/components/chat-message.test.ts ui/src/pages/chat/components/session-diff-panel.test.ts ui/src/pages/chat/components/chat-session-workspace-rail.test.ts ui/src/lib/clipboard.test.ts ui/src/pages/channels/wizard-view.test.ts ui/src/pages/usage/view-overview.test.ts ui/src/pages/chat/components/chat-workspace-conflict.test.ts
node scripts/check-changed.mjs -- ui/src/components/copy-button.ts ui/src/e2e/chat-flow.clipboard.e2e.test.ts ui/src/pages/agents/view.ts ui/src/pages/chat/components/chat-thread-interactions.ts ui/src/pages/chat/components/chat-tool-cards.ts

Production LOC: +38/-33 (net +5). Tests: +311/-1 (net +310).

Before/after screenshots (synthetic Gateway data; both copy methods fail):

Surface Before After
Tool diff Tool diff copy silently fails Tool diff copy shows its red error state
Selected transcript text Selection menu disappears after failed copy Selection menu stays open with Copy failed
Agent ID Agent ID copy provides no failure feedback Agent ID copy shows Copy failed

Provenance: tool-diff copying introduced clearly by #125240 (code/PR author and merger @vyctorbrzezowski, 2026-08-18). Selection copying was carried forward by #122420 and Agent ID copying by #106003 (code/PR author and merger @steipete, 2026-08-12 and 2026-07-13 respectively); those refactors are not claimed as the original introduction. No stable-release reachability claim.

Named follow-up: native WebKit link-menu Copy uses a Web Awesome menu item that is dismissed before its callback, rather than the shared HTML-button lifetime. It needs a native menu-owner repair and actual native-container proof; this PR does not claim to fix all clipboard consumers. Browser clipboard failures here are controlled external-boundary fixtures, not a claim of native OS permission-denial testing.

An asynchronous native write that was already issued cannot be physically canceled. The blind validator observed an old successful native write completing after a newer one; the current control kept its own feedback and remained usable. This repair prevents obsolete legacy fallback and stale UI feedback, not already-issued successful native writes.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Aug 27, 2026
@steipete
steipete marked this pull request as ready for review August 27, 2026 02:35
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 26, 2026, 11:19 PM ET / August 27, 2026, 03:19 UTC.

ClawSweeper review

What this changes

The PR routes tool-diff, transcript-selection, and agent-ID copying through shared feedback-aware clipboard handling, including stale-attempt cancellation.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open: the shared copy behavior is sound, but the tool-diff caller drops its established tool-card action class and therefore regresses its 40px hit target and hover styling.

Priority: P2
Reviewed head: 5b4ffdcf20f88700d89df323ab07cd529f2db9fc

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The PR has strong stated behavioral coverage, but the concrete tool-card presentation regression blocks a higher rating.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable: the repository context identifies this as a member-authored, maintainer-labeled PR, which is exempt from the external-contributor proof gate; the supplied Chromium screenshot evidence is supplementary.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable: the repository context identifies this as a member-authored, maintainer-labeled PR, which is exempt from the external-contributor proof gate; the supplied Chromium screenshot evidence is supplementary.
Evidence reviewed 4 items Tool-card style regression: The changed tool-diff action now calls the generic copy-button renderer, whose button classes are btn btn--xs chat-copy-btn; it no longer has the tool-card-specific action class.
Established tool-card contract: The existing stylesheet gives only .chat-tool-card__action-btn a 40px square hit target, transparent presentation, and hover/focus treatment; the generic copy-button class does not match that selector.
Behavior coverage does not cover layout: The new Chromium scenario verifies clipboard attempts and accessible labels for tool-diff copying, but not the retained tool-card action dimensions or hover treatment.
Findings 1 actionable finding [P2] Preserve the tool-card action styling
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-flow.clipboard.e2e.test.ts

Result: FAIL (failed) — step 1 run node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-flow.clipboard.e2e.test.ts: previous terminal command was still running after 30 seconds: "node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-flow.clipboard.e2e.test.ts"

RUN  v4.1.11 /tmp/clawsweeper-live-proof-130612-3OUuNj/target

[vitest] still running with no output for 30000ms.

Assertions:

  • FAIL expect_output: reports clipboard failure from the tool-diff action

How this fits together

Control UI copy controls call a shared browser clipboard helper that tries the async API and then a legacy fallback. The result updates the active chat, transcript, or agent-settings control with visible success or failure feedback.

flowchart LR
  A[User copy action] --> B[Control UI button]
  B --> C[Shared copy handler]
  C --> D[Browser clipboard API]
  C --> E[Legacy copy fallback]
  D --> F[Copy outcome]
  E --> F
  F --> G[Current control feedback]
Loading

Before merge

  • Preserve the tool-card action styling (P2) - renderCopyButton produces btn btn--xs chat-copy-btn, but this replacement removes the prior chat-tool-card__action-btn class. The tool-card stylesheet assigns that class the 40px action target plus transparent hover/focus treatment, so this copy control becomes a smaller bordered button and changes the card header layout. Keep the tool-card styling on this shared-feedback instance (or make it an explicit supported renderer variant).
  • Resolve merge risk (P1) - The stated production delta is +5 lines for a bug fix; the final repair should retain the shared ownership boundary while avoiding avoidable additional production surface.
  • Resolve merge risk (P1) - The partial clone could not retrieve current-main/base objects or screenshot attachments because its configured GitHub host could not resolve; this is a reviewer infrastructure gap, not missing contributor proof.
  • Complete next step (P2) - A narrow mechanical repair can preserve the established tool-card presentation while retaining the shared clipboard fix.

Findings

  • [P2] Preserve the tool-card action styling — ui/src/pages/chat/components/chat-tool-cards.ts:980
Agent review details

Security

None.

PR surface

Source +5, Tests +310. Total +315 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 4 38 33 +5
Tests 1 311 1 +310
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 349 34 +315

Review metrics

Metric Value Why it matters
Production versus test delta production +38/-33 (net +5); tests +311/-1 (net +310) The small positive production delta is tied to shared result and stale-attempt handling, but the tool-card style regression needs correction without unnecessary growth.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the shared copy outcome and stale-attempt logic, but preserve the tool-card action’s existing class-level layout contract and add a focused rendered-style assertion before merge.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the shared copy outcome and stale-attempt logic, but preserve the tool-card action’s existing class-level layout contract and add a focused rendered-style assertion before merge.

Do we have a high-confidence way to reproduce the issue?

Yes—source-reproducible: the checked-in Chromium scenario exercises the three copy controls and the changed tool-card source deterministically selects the generic class set. This read-only review did not execute the browser harness.

Is this the best way to solve the issue?

No—the shared outcome handling is the right owner boundary, but applying its generic renderer without retaining the tool-card action presentation changes an existing UI contract.

Full review comments:

  • [P2] Preserve the tool-card action styling — ui/src/pages/chat/components/chat-tool-cards.ts:980
    renderCopyButton produces btn btn--xs chat-copy-btn, but this replacement removes the prior chat-tool-card__action-btn class. The tool-card stylesheet assigns that class the 40px action target plus transparent hover/focus treatment, so this copy control becomes a smaller bordered button and changes the card header layout. Keep the tool-card styling on this shared-feedback instance (or make it an explicit supported renderer variant).
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b05938bac101.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Not applicable: the repository context identifies this as a member-authored, maintainer-labeled PR, which is exempt from the external-contributor proof gate; the supplied Chromium screenshot evidence is supplementary.
  • remove proof: sufficient: Current real behavior proof status is not_applicable, not sufficient.
  • remove rating: 🦞 diamond lobster: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P2: The patch introduces a visible Control UI action-layout regression while repairing otherwise retryable clipboard feedback.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Not applicable: the repository context identifies this as a member-authored, maintainer-labeled PR, which is exempt from the external-contributor proof gate; the supplied Chromium screenshot evidence is supplementary.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Not applicable: the repository context identifies this as a member-authored, maintainer-labeled PR, which is exempt from the external-contributor proof gate; the supplied Chromium screenshot evidence is supplementary.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-flow.clipboard.e2e.test.ts.
  • [P1] node scripts/run-vitest.mjs ui/src/pages/chat/components/chat-tool-cards.test.ts ui/src/lib/clipboard.test.ts.
  • [P1] node scripts/check-changed.mjs -- ui/src/components/copy-button.ts ui/src/e2e/chat-flow.clipboard.e2e.test.ts ui/src/pages/chat/components/chat-tool-cards.ts.

What I checked:

  • Tool-card style regression: The changed tool-diff action now calls the generic copy-button renderer, whose button classes are btn btn--xs chat-copy-btn; it no longer has the tool-card-specific action class. (ui/src/pages/chat/components/chat-tool-cards.ts:980, 5b4ffdcf20f8)
  • Established tool-card contract: The existing stylesheet gives only .chat-tool-card__action-btn a 40px square hit target, transparent presentation, and hover/focus treatment; the generic copy-button class does not match that selector. (ui/src/styles/chat/tool-cards.css:692, 5b4ffdcf20f8)
  • Behavior coverage does not cover layout: The new Chromium scenario verifies clipboard attempts and accessible labels for tool-diff copying, but not the retained tool-card action dimensions or hover treatment. (ui/src/e2e/chat-flow.clipboard.e2e.test.ts:146, 5b4ffdcf20f8)
  • Current-main inspection limitation: This partial checkout lacks the advertised current-main and PR-base commit objects; Git attempted its configured promisor remote but DNS resolution failed, so a direct current-main comparison and release provenance check could not be completed.

Likely related people:

  • steipete: Git blame attributes the shared handler’s current implementation to this contributor, and the exact PR head is their merge commit. (role: current shared-owner contributor; confidence: high; commits: 5b4ffdcf20f8, 62bf7f6e0cb2; files: ui/src/components/copy-button.ts, ui/src/pages/agents/view.ts)
  • vyctorbrzezowski: The supplied merged feature history identifies this contributor with the tool-card surface that owns the displaced action presentation. (role: tool-card feature contributor; confidence: medium; commits: 540ea124e09a; files: ui/src/pages/chat/components/chat-tool-cards.ts, ui/src/styles/chat/tool-cards.css)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Retain the tool-card action styling while using the shared copy outcome handler.
  • Add a focused rendered-style or Chromium assertion for the tool-diff action’s retained target and interaction treatment.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-27T02:43:23.592Z sha 62bf7f6 :: needs maintainer review before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

The failed CI run was traced to the existing mobile session-header test resolving a retained boot-pane button before the requested session became active. I reproduced the original desktop→mobile sequence locally: desktop passed, then the mobile pointer click timed out behind the replacement pane.

Current main already contains the exact readiness repair in #129933 (51b2665). This branch now incorporates that main commit; no forced click, keyboard substitution, retry, timeout increase, or duplicate repair was added. The effective PR still changes the original five clipboard files.

After refresh, the original header sequence and clipboard/action checks passed: 21 Chromium tests, plus 603 owner/sibling tests across 10 files. The full changed-file gate also passed, including core/UI typechecks, lint, style, i18n, and dead-export checks. A fresh authenticated Codex review of the authoritative final candidate reported no actionable findings. The earlier independent 19 Chromium/249 sibling tests and source-blind five-clause/29-variant report remain recorded above; those counts overlap and are not additive unique coverage.

ClawSweeper's production-LOC item is accepted as justified: the net +5 lines bind the returned copy outcome and existing fallback predicate to the current control/agent identity. The duplicated tool-diff copy path was deleted; separate caller-specific feedback or a new lifecycle abstraction would be larger. Its live-proof attempt stopped waiting after 30 seconds while the test command was still running, without a terminal assertion result; the completed browser runs above supply that evidence. The refreshed exact-head CI must still finish green before merge. The native WebKit menu follow-up and already-issued native-write cancellation limitation remain unchanged.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 27, 2026
@steipete
steipete merged commit 4152b26 into main Aug 27, 2026
117 checks passed
@steipete
steipete deleted the codex/qa-ui-copy-feedback-20260827 branch August 27, 2026 03:36
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Control UI copy actions silently ignore clipboard failures

1 participant