Repository navigation
fix(ui): prevent stale copies after text changes - #154259
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
@clawsweeper review Please review the current head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: blocked before merge. Reviewed September 21, 2026, 12:05 AM ET / 04:05 UTC (Revision 6). ClawSweeper reviewWhat this changesThe PR refreshes copy controls when their text changes, extracts usage-row rendering, and adds bounded test-failure diagnostics and a rail-test setup correction. Merge readiness⛔ Blocked before merge - 2 items remain The fix remains necessary on current main and v2026.9.5. No introduced correctness defect was found, but the acknowledged test stalls still lack diagnosed causes and owning fixes. Priority: P2 Review scores
Verification
How this fits togetherControl UI copy controls turn displayed text into clipboard requests and visible feedback. The test helpers separately collect child-process and browser facts when validation fails. flowchart TD
A[Displayed text] --> B[Copy control lifetime]
B --> C{Text changed?}
C -->|Yes| D[Retire old control]
C -->|No| E[Preserve current control]
D --> F[Fresh copy control]
E --> G[Clipboard request and feedback]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +34, Tests +725, Other 0. Total +759 across 18 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep payload lifetime in the shared copy renderer and resolve the test failures at their existing fixture or browser owner. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the path: start a pending copy, replace the displayed text, then reject the first write. Current main retains the old control; this review did not execute that scenario. Is this the best way to solve the issue? Yes. Keying controls by their exact payload reuses the existing retirement guard and preserves unchanged-text state without adding another clipboard owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against eba0b02b49d2. LabelsLabel 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
HistoryReview history (5 earlier review cycles)
|
|
@clawsweeper re-review Please review the current head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Please review the current head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Please review the current head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Please review the current head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Please review the current head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* commit 'f76d38a4ac5e5f4e6c5a5320436db169e33d5c8a': (49 commits) fix(ci): remove duplicate database worker test entry fix(voice): keep audio flowing while the Gateway is busy (openclaw#154119) docs: reserve Team live updates for Night Watch (openclaw#154425) test(meeting-bot): control browser retry fixture clocks (openclaw#149174) fix(ui): use remote defaults for manual worktree creation (openclaw#154364) fix(proxy): keep WebChat and Codex loopback calls direct (openclaw#154013) fix(pr): revalidate head reads and reuse repository locators (openclaw#154212) fix(browser): start control when the Gateway has activated the plugin (openclaw#154255) improve: publish CI dependencies promptly and warm hosted JavaScript caches (openclaw#154156) improve: speed up streaming text with inline brackets (openclaw#154398) test: isolate historical Node runner policy from CI fix: refresh stale Gateway shutdown budgets during updates and Doctor (openclaw#153636) ci: use four Windows workers on the 16 class (openclaw#154261) feat: verify GitHub credit from trusted OIDC claims (openclaw#153940) feat(sessions): support explicit local placement for child sessions (openclaw#153912) fix(ui): prevent stale copies after text changes (openclaw#154259) perf(gateway): reuse session list candidates across viewers (openclaw#154003) perf(codex): bound progressive local catalog waits (openclaw#154362) docs: keep update requests owned through acceptance (openclaw#154111) perf(state): reduce main-thread coordinator waits (openclaw#154244) ...
* commit 'f76d38a4ac5e5f4e6c5a5320436db169e33d5c8a': (58 commits) fix(ci): remove duplicate database worker test entry fix(voice): keep audio flowing while the Gateway is busy (#154119) docs: reserve Team live updates for Night Watch (#154425) test(meeting-bot): control browser retry fixture clocks (#149174) fix(ui): use remote defaults for manual worktree creation (#154364) fix(proxy): keep WebChat and Codex loopback calls direct (#154013) fix(pr): revalidate head reads and reuse repository locators (#154212) fix(browser): start control when the Gateway has activated the plugin (#154255) improve: publish CI dependencies promptly and warm hosted JavaScript caches (#154156) improve: speed up streaming text with inline brackets (#154398) test: isolate historical Node runner policy from CI fix: refresh stale Gateway shutdown budgets during updates and Doctor (#153636) ci: use four Windows workers on the 16 class (#154261) feat: verify GitHub credit from trusted OIDC claims (#153940) feat(sessions): support explicit local placement for child sessions (#153912) fix(ui): prevent stale copies after text changes (#154259) perf(gateway): reuse session list candidates across viewers (#154003) perf(codex): bound progressive local catalog waits (#154362) docs: keep update requests owned through acceptance (#154111) perf(state): reduce main-thread coordinator waits (#154244) ...
* commit 'f76d38a4ac5e5f4e6c5a5320436db169e33d5c8a': (58 commits) fix(ci): remove duplicate database worker test entry fix(voice): keep audio flowing while the Gateway is busy (#154119) docs: reserve Team live updates for Night Watch (#154425) test(meeting-bot): control browser retry fixture clocks (#149174) fix(ui): use remote defaults for manual worktree creation (#154364) fix(proxy): keep WebChat and Codex loopback calls direct (#154013) fix(pr): revalidate head reads and reuse repository locators (#154212) fix(browser): start control when the Gateway has activated the plugin (#154255) improve: publish CI dependencies promptly and warm hosted JavaScript caches (#154156) improve: speed up streaming text with inline brackets (#154398) test: isolate historical Node runner policy from CI fix: refresh stale Gateway shutdown budgets during updates and Doctor (#153636) ci: use four Windows workers on the 16 class (#154261) feat: verify GitHub credit from trusted OIDC claims (#153940) feat(sessions): support explicit local placement for child sessions (#153912) fix(ui): prevent stale copies after text changes (#154259) perf(gateway): reuse session list candidates across viewers (#154003) perf(codex): bound progressive local catalog waits (#154362) docs: keep update requests owned through acceptance (#154111) perf(state): reduce main-thread coordinator waits (#154244) ...
* commit 'f76d38a4ac5e5f4e6c5a5320436db169e33d5c8a': (44 commits) fix(ci): remove duplicate database worker test entry fix(voice): keep audio flowing while the Gateway is busy (openclaw#154119) docs: reserve Team live updates for Night Watch (openclaw#154425) test(meeting-bot): control browser retry fixture clocks (openclaw#149174) fix(ui): use remote defaults for manual worktree creation (openclaw#154364) fix(proxy): keep WebChat and Codex loopback calls direct (openclaw#154013) fix(pr): revalidate head reads and reuse repository locators (openclaw#154212) fix(browser): start control when the Gateway has activated the plugin (openclaw#154255) improve: publish CI dependencies promptly and warm hosted JavaScript caches (openclaw#154156) improve: speed up streaming text with inline brackets (openclaw#154398) test: isolate historical Node runner policy from CI fix: refresh stale Gateway shutdown budgets during updates and Doctor (openclaw#153636) ci: use four Windows workers on the 16 class (openclaw#154261) feat: verify GitHub credit from trusted OIDC claims (openclaw#153940) feat(sessions): support explicit local placement for child sessions (openclaw#153912) fix(ui): prevent stale copies after text changes (openclaw#154259) perf(gateway): reuse session list candidates across viewers (openclaw#154003) perf(codex): bound progressive local catalog waits (openclaw#154362) docs: keep update requests owned through acceptance (openclaw#154111) perf(state): reduce main-thread coordinator waits (openclaw#154244) ...
* fix(ui): retire stale copy actions when text changes * refactor(ui): isolate usage session row rendering * fix(ui): narrow session row event targets safely * test: record bounded lifecycle diagnostics for stalled fixtures * test: stabilize rail setup and cover staging failure diagnostics * test: retain host facts for stalled browser diagnostics
What Problem This Solves
Fixes: copying updated text can stay disabled and later copy the previous text when an earlier clipboard request is still pending.
User Impact
User impact: changed text is immediately available to copy, and an old request cannot apply legacy clipboard fallback or copy feedback to its replacement. Native clipboard writes already submitted to the browser cannot be cancelled.
Why This Change Was Made
The copy affordance now owns the lifetime of its exact text payload. Changed text retires the old control; unchanged text preserves focus, pending state, and translated feedback. The five mutable custom copy renderers follow the same boundary. A redundant tool-output key is removed; attachment-load and agent-identity boundaries remain intact. The usage session row has its own small rendering module so the already-oversized overview does not grow; sorting, filtering, formatting, and selection ordering stay with the card.
Related: #153815
Evidence
The first hosted run caught growth in the grandfathered usage overview: 811 → 815 counted lines. The row extraction fixes that violation; its subsequent hosted line-cap gate passes all nine changed source files. The next assertion-safety gate caught a moved legacy type cast: the row now narrows the event target with
instanceof Element, and the former owner's grandfathered count decreases from three to two. No allowance or rule was expanded.Hosted test-stall observability
An earlier head had two undetermined CI failures: the recurring outer 120-second timeout in release-check, and an inner managed-command 30-second timeout in crabbox-staging. Test-only diagnostic observability does not fix those timeouts or establish a common cause. Production release tooling, runner policy, deadlines, retries, assertions, and test-file inventory are unchanged.
The affected release-check case and the file-local staging fixtures use a shared bounded recorder: at most 48 lifecycle records and 96-character fixed labels, plus the last-started child snapshot (not an all-active-process snapshot). It records stages, elapsed times, PID, byte counts, exit/signal state, and pipe closure, never command arguments, environment, output payloads, or paths. Reports occur once on actual failure or original cancellation; staging reports only when its existing scenario/cleanup owner observes failure. Passing tests, expected nonzero exits, and deliberate SIGKILL remain silent. Existing readers, awaits, and cancellation ownership are preserved; observational callbacks and bounded bookkeeping still have a small measurement cost.
The staging recorder covers observed inner 30-second rejections. Setup failures and outer test timeouts can produce no diagnostic, including when an uncancelled scenario later succeeds; this does not add a cancellation owner to close that separate gap. A prior instrumented replay passed but does not explain the hosted failure.
On the diagnostic head, the original release case passed in 10.987 seconds and the original staging callback case passed in 10.939 seconds. The original group 8 → 9 and group 11 → 12 descriptor pairs/order were preserved, with Node 24.19.0 and recorded cache provenance; cache contents are not claimed identical. The latter job instead hit a 30-second command timeout in the FIFO/unsupported-fsync sibling, which was outside the original opt-in. Staging observability now covers that file-local fixture boundary and records fixed FIFO/fsync stage labels. The earlier stalls' root causes remain unknown; a later passing run is not a diagnosis. Fresh exact-head hosted results remain required.
Final diagnostic proof: all 36 cases across the existing command-fixture, release-check, and crabbox-staging files pass (61.19 seconds Vitest; 62.10 seconds including runner), including success silence, failure-only output, buffer/privacy bounds, and existing drain/cancellation coverage. Scoped lint, root-test types, and task-base line-cap/assertion ratchets pass. Independent source review and final full-candidate autoreview are clean. Diagnostic delta: production 0; test support +138/-2 and tests +185/-10. These focused results are not a substitute for fresh exact-head hosted CI.
Rail test setup and final focused proof
The same hosted run caught a bottom-docked rail test setup failure: its raw
scrollTop = 0assignment did not establish that initial end-follow had settled or that reader input had taken over. The test now uses the existing idle/end-readiness checks and real upward wheel input, matching the first test in the file and explicitly handing control to the reader. The exact zero-position poll, later 200-pixel position, rail geometry, and pointer/keyboard preview assertions remain unchanged. This repairs a missing test precondition; the historical writer of the observed offset was not recorded, so it is not evidence of a fixed production scroll defect.Final focused proof: all 22 command-fixture/staging cases pass with success silence (81.91 seconds Vitest), then all 8 rail E2E cases pass in their original whole-file order (88.58 seconds Vitest; bottom-docked case 5.121 seconds), and all 50 scroll-policy cases pass. The UI build, scoped lint, root-test and UI-E2E types, and formatting pass. Independent exact-byte review and final full-candidate autoreview are clean. This final test-only adjustment adds 14/removes 8 lines; production delta remains unchanged. Fresh hosted CI and exact-head review still govern landing.
Browser host-state observability
On the next hosted head, the release case passed in 12.692 seconds, all staging cases passed, and all rail cases passed. The canonical planner regrouped the tooling files, so these are not original-order replay claims. That run instead stopped at a question-collapse click timeout; the available public diagnostic only reported unavailable renderer state, without distinguishing a rejected read from its diagnostic deadline. Its root cause remains unknown.
The existing test-diagnostic owner now samples cached page/browser flags before reading the renderer, reports
completed,rejected, ordeadlinefor that read, and retains fixed first crash/close/browser-disconnect timestamps through page close. Events are observed only since diagnostic registration; absent timestamps do not rule out earlier events, and unregistered pages explicitly report no lifecycle record. Browser listeners detach on page close, repeated installation does not reattach them, and initially closed/disconnected state does not invent an event. This adds no renderer calls, waits, retries, timeout changes, normal-path logs, or public raw errors/URLs/payloads. It is observability, not a question interaction or timeout fix.Focused diagnostic proof: the unchanged owner fails 14 intended diagnostic assertions with 5 cases passing (1.37 seconds); the repaired owner passes all 19 cases (1.02 seconds), including stalled/late replies, privacy, first-event retention, and listener cleanup. Scoped lint, UI-other/UI-E2E test types, and formatting pass; independent exact-byte review and final full-candidate autoreview are clean. Delta: production 0; test support +49/-1 and tests +137. A first shell-quoting setup attempt ran no tests and is not counted as proof. Fresh first-attempt hosted CI remains the integration and landing gate.
Current landing decision
Exact head
a9db5c46238346bf0b0c413c36d52804d617da99passed fresh first-attempt CI, including all 13 ordinary UI-E2E shards and real-Gateway E2E. The previously failing question case passed in 1.744 seconds, release case in 14.169 seconds, and staging callback/FIFO cases in 13.280/3.339 seconds. The actual hosted merge wasc30ef912311c59e2e8945560868124a7a5d35d46, with main parentac638483c7803d8043990eb040d0385e9196f740; that parent separately includes #154307 and its Node shutdown-policy propagation. This runtime difference and changed cache provenance prevent causal attribution to these diagnostics. Normal protected CI/security gates remain required.The exact-head ClawSweeper review reports no code or security findings and accepts the payload-lifetime repair. Its historical-cause requirement and matching Rank-up move are explicitly deferred to historical CI stall attribution, not treated as a current landing blocker: the native-admission test-failure policy permits normal gated landing after bounded investigation when the original failure, attempted reproductions, evidence, and uncertainty are recorded. Those records are above. Same-order release replay and subsequent hosted runs did not establish the historical release, staging, or question-click causes; no owning fix is invented, no passing replay is called a cure, and no retry, assertion, timeout, review label, or protected gate is overridden. Further causal work belongs to that named follow-up if new failure evidence makes it actionable.
The screenshots use the real file-preview component in isolated Chromium, with synthetic files and an in-page clipboard transport. Copy the first file, select the second while the first request is pending, then copy the second. Before: the second copy remains disabled; rejecting the old request falls back to the first file. After: the second copy succeeds immediately and rejecting the retired request triggers no fallback. These are source-level browser proofs, not live deployment, OS clipboard, or heap-profile claims.
Before
After