Repository navigation
fix(ui): suppress duplicate pairing actions while one is in flight - #167607
SunnyShu0925 wants to merge 1 commit into
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. |
|
Codex review: needs real behavior proof before merge. What this changesThe PR tracks pending pairing actions in the Devices page to suppress repeated clicks and disable matching controls until settlement. Example: An operator clicks Approve twice for device request pending-req-1.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Blocked before merge - 3 items remain This PR addresses a verified current-main bug and merits retention, but conflicting pairing actions remain possible and the node browser test still targets a removed menu component. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Devices page translates operator actions into Gateway pairing RPCs, then renders authoritative inventory and operation errors. flowchart TD
A[Operator clicks pairing control] --> B[Devices page controller]
B --> C[Pending action set]
B --> D[Confirmation dialog]
B --> E[Gateway pairing RPC]
D --> E
E --> F[Inventory refresh]
F --> G[Devices view]
Technical reviewBest possible solution: Use one pending owner for conflicting actions on each pairing request, preserve the existing confirmation and Gateway authority checks, and repair the native-menu regression test. Do we have a high-confidence way to reproduce the issue? Current-main dispatch, mutation error handling, backend unknown-request responses, and the canonical report establish the failure path from source; this read-only review executed no target code. Is this the best way to solve the issue? Page-owned pending state fits the existing architecture, but action-specific keys only prevent identical repeats and leave conflicting mutations able to reproduce the reported failure. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 21b0c8b04255. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +115, Tests +324. Total +439 across 9 files. Added test files: 2. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (10 earlier review cycles; latest 8 shown)
Reviewed October 13, 2026, 7:04 AM ET / 11:04 UTC (Revision 11). |
4f38c8f to
2e00b7b
Compare
|
🦞👀 Re-review progress:
|
4b6d7a5 to
c9a9e89
Compare
|
🦞👀 Re-review progress:
|
c9a9e89 to
8e016ad
Compare
2613ee4 to
ac75f5d
Compare
|
@clawsweeper re-review. |
|
🦞👀 Re-review progress:
|
e15f21e to
0e74945
Compare
Device and node approve/reject buttons and token rotate/revoke buttons in the Devices page only checked pairing permission, not whether an action for that target was already pending. A rapid double-click sent two RPCs; the first succeeded and deleted the pending record, the second returned "unknown requestId", and that error was shown to the operator despite the approval succeeding. Track in-flight pairing mutations in a keyed Set on DevicesPageController. Approve, reject, rotate, and revoke callbacks check the Set before dispatching and clear the key in a finally block with a publish to re-render. Buttons and dropdown items gain a disabled state while their action is pending. Fixes openclaw#127580
0e74945 to
225be04
Compare
Fixes #127580
What Problem This Solves
Rapidly double-clicking a device/node Approve/Reject button or a token Rotate/Revoke button sends two RPCs; the first succeeds and deletes the pending record, the second returns "unknown requestId", and that error is shown to the operator despite the action succeeding. This fix tracks in-flight pairing actions and disables the button until the operation settles.
SetonDevicesPageController, keyed bykind:requestId:action. Callbacks check the Set before dispatching and clear the key in afinallyblock that callspublish()to re-render. Buttons and dropdown items gain adisabledstate while their action is pending.devices-page.tsx(pending state + dedup for all 6 callbacks),view-pending-devices.tsx(approve/reject button disabled),view-inventory.tsx(rotate/revoke button disabled),entry-menu.tsx(dropdown approve/reject item disabled),view.types.ts+devices-fixtures.ts(prop),view.pairing-actions.test.tsx(3 renderer tests),view.devices.test.ts(1 renderer test),device-pairing-dedup.e2e.test.ts(2 served-browser E2E tests).page-operations.ts, dialog confirmation flow indevices-dialogs.ts, or any backend pairing logic.Why This Change Was Made
The page layer owns UI state, so pending-mutation tracking belongs there rather than in the operation functions that only handle RPC + reload.
runPageTask, but that would require changing the operation function signatures for a purely UI-level concern.User Impact
Operators can rapid-click Approve/Reject/Rotate/Revoke without seeing a misleading failure message. The button visually disables during the in-flight operation, giving clear feedback that the click was registered.
Evidence
Served-browser E2E (
device-pairing-dedup.e2e.test.ts) — launches real Chromium, serves Control UI via Vite, installs a mock Gateway, and drives the actual Devices page:Device approve dedup + failure recovery:
device.pair.approveRPCNode-menu approve dedup:
approvalState: "pending-reapproval"node.pair.approveRPCRenderer tests (
view.pairing-actions.test.tsx+view.devices.test.ts): 4 tests pass — approve disables when pending (reject stays enabled), reject disables when pending (approve stays enabled), different action pending does not disable, and rotate disables when pending (revoke stays enabled).Pre-fix verification (dedup reverted): the renderer test fails — approve button is not disabled when
pendingPairingActionscontains the matching key.Existing tests:
view.devices.test.ts(26 tests),devices-page.test.tsx+view-pairing.test.tsx(46 tests) all pass, no regression.AI Assistance
This PR is AI-assisted. Used source inspection to analyze issue #127580, locate the root cause in the Devices page controller, and implement the fix. Per review, re-implemented on the Solid architecture after main migrated from Lit to Solid (.ts → .tsx) and expanded to cover all pairing mutation paths (approve, reject, rotate, revoke). The E2E tests prove dedup through real browser dispatch covering device-button and node-menu approval plus failure recovery, with pre-fix verification confirming the tests guard the actual defect.