Skip to content

Fix stale approval prompts in Control UI - #86270

Merged
jesse-merhi merged 6 commits into
mainfrom
jesse/fix-stale-approval-modal
May 27, 2026
Merged

jesse-merhi merged 6 commits into
mainfrom
jesse/fix-stale-approval-modal

Conversation

@jesse-merhi

@jesse-merhi jesse-merhi commented May 25, 2026 •

Copy link
Copy Markdown
Member

Summary:

  • Harden Control UI approval prompts when the UI acts on an approval that has already been resolved elsewhere or no longer exists.
  • Treat stale resolve responses as terminal UI cleanup signals: APPROVAL_ALREADY_RESOLVED, APPROVAL_NOT_FOUND, and unknown or expired approval id now remove the prompt and refresh pending approvals.
  • Keep exec approval Escape/backdrop mapped to Deny; stale Deny now dismisses the stale prompt through the same cleanup path instead of leaving the modal stuck.

Bug summary:
An exec approval can be shown in Discord and in the OpenClaw Control UI at the same time. If Discord resolves it first and the web UI misses or delays the resolved event, the web modal can keep a stale approval id. On main, clicking Deny on that stale modal reports a backend error and leaves the modal open.

A_B.testing.approval.not.closing.mp4

Root cause:
Current main removes a prompt when the web client receives exec.approval.resolved or plugin.approval.resolved, so normal event delivery is fine. The broken path is stale local UI state: handleExecApprovalDecision catches every resolve error as execApprovalError and does not treat stale backend responses as terminal cleanup. Main also maps modal cancel to Deny, so Escape/backdrop can hit the same stale backend error path.

Fix summary:
OpenClawApp now treats known stale approval resolve errors as terminal UI cleanup. Success removes the active prompt. Stale backend errors remove it, refresh exec.approval.list and plugin.approval.list, and keep only still-pending approvals. exec.approval.resolved and plugin.approval.resolved remove matching queue entries and clear the active prompt error. The exec approval view keeps Escape/backdrop wired to Deny; stale Deny is now safe because stale resolve errors dismiss and refresh.

Main behavior checked:

  • The bug exists on current main. In Chrome on main, I forced a stale modal id and clicked Deny. The UI showed Approval failed: GatewayRequestError: unknown or expired approval id, and the modal stayed open.
  • Discord-resolved events do reach the web UI when delivered. In the live Discord path, denying externally emitted exec.approval.resolved and the connected Control UI modal disappeared.
  • The confusing case where Deny appears to work on main is usually not the stale failure path: same-decision duplicate Deny is backend success, and clicking a still-pending approval is normal success.

Verification:

  • Rebased branch on current origin/main at e96cde7e14.
  • node scripts/run-vitest.mjs ui/src/ui/controllers/exec-approval.test.ts ui/src/ui/app-gateway.node.test.ts ui/src/ui/views/exec-approval.test.ts ui/src/ui/app.exec-approval.test.ts ui/src/ui/app-gateway-chat-load.node.test.ts ui/src/ui/app-gateway.sessions.node.test.ts --run passed, 6 files / 114 tests.
  • node_modules/.bin/oxfmt --check --threads=1 ui/src/ui/app-gateway-chat-load.node.test.ts ui/src/ui/app-gateway.node.test.ts ui/src/ui/app-gateway.sessions.node.test.ts ui/src/ui/app-gateway.ts ui/src/ui/app.ts ui/src/ui/app.exec-approval.test.ts ui/src/ui/controllers/exec-approval.test.ts ui/src/ui/controllers/exec-approval.ts ui/src/ui/views/exec-approval.test.ts ui/src/ui/views/exec-approval.ts passed.
  • git diff --check passed.
  • Earlier manual A/B with Computer Use: main/Chrome stayed stuck after stale Deny; PR/Safari dismissed stale externally-resolved approvals after stale Deny and refreshed pending approvals.

Behavior addressed: stale Control UI exec/plugin approval modals when local UI state outlives backend approval state.
Real environment tested: local Control UI against two local Gateway instances, Discord-triggered approvals, focused Vitest coverage, oxfmt, and UI typecheck.
Exact steps or command run after this patch: opened PR UI at localhost:19010, opened main/control UI at localhost:19170, resolved approvals externally through Discord or forced a stale id, then clicked Deny in the web modal.
Evidence after fix: PR UI removed the stale modal after stale Deny; main UI kept the modal open with unknown or expired approval id; focused tests cover resolved events, stale resolve errors, success cleanup, unrelated-error behavior, and refresh behavior.
Observed result after fix: stale externally-resolved approvals no longer leave the modal stuck, stale Deny removes the prompt, resolved events clear active prompt errors, and Escape/backdrop continue to submit Deny.
What was not tested: a fresh Slack-specific stale approval flow after the final rebase.

Agent Transcript

Redacted, condensed transcript from about 10 local agent sessions for PR #86270
source: about 10 local agent sessions related to PR #86270
format: condensed transcript, grouped by work phase rather than copied verbatim
redaction: local paths, emails, phone-shaped strings, token-shaped strings, auth headers, auth query params
omitted: raw tool outputs, system/developer prompts, local paths, secrets, browser/session/auth details, unrelated detours, repeated status chatter, and heated wording
scope: Control UI stale approval prompt fix, manual proof, review questions, implementation corrections, and final verification
note: This is intentionally a substantial condensed transcript. It keeps the useful questions, implementation decisions, review pressure, manual testing, and proof from the related local sessions without including every turn from all logs.

--- Session group: initial bug report, investigation goals, and first implementation ---

[user]
Asked the agent to triage and fix a Control UI exec approval modal bug, then open a PR. The bug report was specific: an exec approval prompt could appear in both Discord and the OpenClaw web UI; if Discord resolved it first, the web UI modal could remain open with a stale approval id. Clicking Deny or trying to close the stale web UI modal could then leave the modal stuck.

[user]
Set the first-pass requirements: confirm whether the bug exists on current main, locate the web UI approval modal/state code, verify how the UI handles approval requested/resolved events, inspect approve/deny mutation results, inspect modal close/dismiss state, and handle stale approval errors from the backend with evidence.

[assistant]
Started from fresh main in an isolated branch/worktree and traced the relevant Control UI paths. The agent identified the approval flow through gateway event handling, the app-level approval queue, and the modal renderer:
- requested events add entries to the approval queue
- resolved events remove matching entries
- the modal renders the active queue entry
- the app sends user decisions through the gateway client

[assistant]
Found that current main already had normal event handlers for resolved approvals, so the main question was not whether resolved events exist. The broken path was stale local UI state: if the UI still had an approval id after it was already resolved elsewhere, a later Deny/Allow from the web UI could get a stale backend response and show it as a normal error while leaving the modal open.

[user]
Asked whether the web UI also needed a way to close the modal so the user would not get trapped.

[assistant]
Initially explored a local close/suppress path. That design kept the approval in state but hid the modal locally, so closing the web modal would not send a hidden backend decision. This was implemented and tested briefly, but it later turned out to be the wrong product behavior for Escape/backdrop.

[assistant]
The better fix became stale-state cleanup rather than local suppression. Known stale backend responses should be treated as terminal for the active modal: remove the stale prompt, clear the active prompt error, refresh pending exec/plugin approvals, and leave normal unrelated backend errors visible.

[assistant]
Added focused helpers around the approval state:
- parse exec approval requested/resolved payloads
- parse plugin approval requested payloads
- add and remove approvals from the queue
- detect stale approval resolution errors
- dismiss stale prompts
- refresh pending approval lists after stale cleanup

[assistant]
Kept the key invariant that the modal is derived from the queue. If the active queue entry is removed, the modal disappears or the next queued approval becomes active. This kept the UI behavior tied to the actual approval queue rather than a separate hidden dismissal layer.

--- Session group: manual testing setup and real behavior proof ---

[user]
Asked for a local instance to test the fix manually. The first proposed test was two OpenClaw instances connected to the same Slack account so both UIs would see an approval. Then resolving one approval externally should show whether the other UI got stuck.

[assistant]
Used the local OpenClaw testing workflow and started checking the PR worktree rather than a different checkout. The agent noticed an existing local Gateway was from a different PR worktree, so it was not valid proof for this fix.

[assistant]
Evaluated the two-instance idea and found a problem with the test design. Two separate Gateways sharing one channel token would usually create separate backend approval records, so resolving one Gateway's approval would not necessarily resolve the other Gateway's modal. That would make the test noisy and could prove the wrong thing.

[assistant]
Shifted the test plan toward proving the stale UI state directly: use local main-vs-PR comparison, external resolution, and stale ids. The useful question was whether the web UI responds correctly when its active local approval no longer exists in the backend.

[user]
Asked to switch away from the double-client idea and instead use separate local channel setups, such as one Slack bot and one Discord bot, to avoid adding an awkward client parameter just for testing.

[assistant]
Prepared isolated local Gateway/UI state for channel testing. The goal was to trigger an approval from a real external channel, see the modal in the web UI, resolve the approval externally, and then verify whether the web UI modal disappeared or stayed stale.

[assistant]
Had to repair local helper/proxy state during manual testing. Some route/proxy and event-loop stalls were local-environment issues rather than PR behavior. The agent avoided counting that as product proof and kept pushing the test back toward the actual approval state path.

[user]
Asked what to type and what was being tested.

[assistant]
Gave a concrete test script: trigger a command that needs approval through Discord, confirm the web UI also shows the approval modal, approve or deny in Discord, then watch whether the web UI modal disappears. If it stayed open, clicking Deny in the web UI should dismiss on the PR because stale backend responses now clean up the prompt.

[verification]
Manual proof included local main-vs-PR comparison. On main, forcing a stale modal id and clicking Deny could leave the modal open with an unknown/expired approval id. On the PR, stale Deny removed the stale prompt and refreshed pending approvals.

[verification]
Manual proof also checked the normal event path. When a resolved event reaches the Control UI, the matching prompt is removed without relying on the stale-error fallback.

[verification]
The manual test work did not become extra product scope. The PR stayed focused on Control UI stale approval handling rather than adding special test-only client routing behavior.

--- Session group: review loop, race discussion, and state model questions ---

[user]
Started a code-review pass for PR #86270.

[assistant]
Ran the PR review workflow in an isolated worktree and mapped the diff as a Control UI approval-state change. The review focused on the approval controller, gateway event handling, modal rendering, app-level decision flow, and tests.

[assistant]
A review pass found a stale refresh race. If the UI starts refreshing pending approvals, then an approval is removed while that refresh is in flight, the late refresh result could still contain the removed approval. Without a guard, the UI could put that stale approval back into the queue.

[assistant]
Added a removed-during-refresh guard. The refresh captures the queue at the start, tracks ids removed during the in-flight refresh, and excludes those ids when merging the refresh result back into the current queue.

[assistant]
Another review pass found an error-state issue. If an active prompt had an error and then expired or was removed, the next queued approval could inherit that old error text. The fix clears the active prompt error when the active prompt changes or is removed.

[user]
Asked the agent to explain what had been fixed locally and why.

[assistant]
Explained the first fix as a race: the UI asks the backend for the list of pending approvals, the answer takes time, and the local queue can change before the answer returns. The UI needs to avoid trusting stale list data for ids that were already removed during that same refresh.

[user]
Asked for analogies to explain what was going on. Also asked whether removing the changelog entry was correct, since bug fixes are often added to changelogs in this repo.

[assistant]
Explained that this repository's current instructions say normal PRs should not edit `CHANGELOG.md`; release tooling or maintainers own changelog generation. The bug-fix context should live in the PR body and final commit/merge metadata.

[user]
Pushed on the model: if approval A appears but has already been handled somewhere else, pressing any button should dismiss the modal because the backend already knows the approval was resolved. Asked whether this is a front-end bug or a back-end bug.

[assistant]
Answered that the backend is allowed to reject a stale decision as already resolved or not found. The Control UI bug is treating those known stale responses as normal visible failures. The frontend should recognize those stale responses as terminal for the current modal and dismiss/refresh.

[user]
Asked what “safe cleanup behavior” meant, especially for the exec approval prompt queue.

[assistant]
Explained that safe cleanup means only removing the prompt that the UI has learned is stale, then refreshing current pending approvals. It should not silently approve/deny another prompt, hide unrelated prompts, or swallow unknown backend failures.

[user]
Asked whether the refresh was a poll. Asked whether the same path that updates approval modals could clear stale error state. Asked what happened when the live event path had a delay and then the approval disappeared.

[assistant]
Checked the call sites and clarified that this is not continuous polling. The refresh is an on-demand resync after the UI learns the active approval is stale, usually from a stale decision response. Most normal updates still arrive through approval requested/resolved events.

[assistant]
Explained the refresh path: after a stale response, the UI dismisses the active prompt, then asks for the current exec approval list and current plugin approval list. It merges those lists with approvals that arrived locally during the refresh, while excluding ids removed during the refresh.

[user]
Asked to see the refresh code again with comments, and asked whether `removeExecApproval` simply despawns the modal.

[assistant]
Explained that the modal is derived from `execApprovalQueue[0]`. Removing the active entry changes what the UI renders. If another approval remains, that one becomes active; if the queue is empty, the modal disappears. `removeExecApproval` is a queue operation; assigning the new queue to Lit state causes the UI rerender.

[user]
Asked what the `state` object was, why helper functions could mutate it, and what actually adds ids to the removed-during-refresh list.

[assistant]
Clarified that `state` is not a global object. In production, it is the `OpenClawApp` Lit component instance passed into helper functions. The relevant fields are component state fields: `execApprovalQueue`, `execApprovalBusy`, `execApprovalError`, and the temporary removed-during-refresh set.

[assistant]
Explained that Lit `@state()` fields are mutable component fields. Updating them on the app instance tells Lit that the component may need to render again. During an in-flight refresh, dismissal/resolved-event helpers add removed ids to the temporary set so late refresh results cannot reinsert those ids.

[user]
Restated the mental model: refresh starts, local state may change while it is running, and the helper needs to remember which approvals were removed so stale list data does not put them back.

[assistant]
Confirmed that model. The refresh snapshots queue ids at start, tracks removed ids while requests are in flight, then merges backend list data with current local queue state while excluding ids that were removed during the refresh window.

--- Session group: direct review findings and test-contract corrections ---

[user]
Asked for a direct code review against the PR diff and requested prioritized actionable findings.

[assistant]
Found a concrete test-contract failure. Some tests mocked `./controllers/exec-approval.ts`, but `app-gateway.ts` now imported a new helper export. The mocks did not provide `enqueueExecApprovalPrompt`, so affected Vitest files would fail during module loading.

[assistant]
Fixed the test mocks and reran the focused approval checks before pushing. This kept the PR's behavior change aligned with test setup rather than leaving green assertions behind a broken module mock.

[user]
Asked the agent to push the fixes and link the PR when done.

[assistant]
Committed only the intended test mock fixes, checked that the remote PR head had not moved, pushed through the writable PR remote, and verified the PR branch updated.

[user]
Asked to open the PR worktree in VS Code for review.

[assistant]
Opened the dedicated PR review worktree so the user could inspect the exact branch state.

[user]
Questioned the removal of the modal cancel handler:
`handleCancel = () => { if (!state.execApprovalBusy) { void state.handleExecApprovalDecision("deny"); } }`

[assistant]
Inspected the diff and explained that removing the handler changed native modal cancel from submitting Deny to doing nothing. The modal's cancel event fires for Escape/backdrop-style cancellation. Before the change, Escape called `handleExecApprovalDecision("deny")`.

[user]
Confirmed that Escape/backdrop should remain Deny and asked to remove the no-op cancel behavior.

[assistant]
Restored the `modal-cancel` handler so Escape/backdrop submits Deny when the UI is not busy. Added focused view coverage so the behavior stays explicit.

[assistant]
Reran the affected UI test set, formatting, and whitespace checks before committing and pushing that correction.

[user]
Questioned moving `handleExecApprovalDecision` out of `OpenClawApp`. The concern was that the method owns the active prompt, client call, busy flag, and error handling, so moving it into a controller helper felt like the wrong ownership boundary.

[assistant]
Treated that as a behavior/ownership correction. The final shape keeps `handleExecApprovalDecision` on `OpenClawApp`, where the user decision request, busy flag, error text, and active queue state are owned.

[assistant]
Left smaller reusable approval concepts in the controller helper: parse payloads, detect stale resolution errors, mutate the queue, dismiss prompts, clear resolved prompts, and refresh pending approvals. This kept the ownership split narrower and easier to review.

[assistant]
Moved the relevant decision tests with the behavior so tests now cover the app-level decision path instead of proving a hidden controller delegate.

--- Session group: repeated review passes and final correctness checks ---

[user]
Requested more review against `origin/main...HEAD`, including flow mapping, entrypoints, contracts, side effects, state transitions, and validation targets. The user also asked for UI, React/state, architecture/ownership, cognitive-load, and test-contract lenses where relevant.

[assistant]
Mapped the runtime flow as narrow and Control-UI-specific:
- gateway events parse approval request/resolution payloads
- requested approvals enter one queue
- resolved events remove matching queue entries and clear active prompt errors when needed
- the modal renders the active queue entry
- `OpenClawApp.handleExecApprovalDecision` sends the user decision
- stale backend responses dismiss and refresh
- unrelated backend errors remain visible

[assistant]
Checked the server/gateway-side contract enough to confirm the front end should not change the backend protocol for this PR. The frontend can treat known stale response shapes as terminal UI cleanup without changing gateway semantics.

[assistant]
Reviewed the queue transitions and refresh merge behavior to make sure it handles three cases: existing pending approvals from the backend, approvals that arrived locally while refresh was running, and approvals removed locally while refresh was running.

[assistant]
Reviewed the view behavior to make sure Escape/backdrop still submits Deny, buttons respect the busy state, and stale Deny no longer leaves a modal trapped.

[assistant]
A later review pass found no actionable correctness issues in the final diff. The changed approval controller, gateway event handling, app decision flow, and focused tests were consistent with the stale-approval handling behavior.

--- Session group: solution-quality check and PR body cleanup ---

[user]
Asked whether this was the best solution for PR #86270.

[assistant]
Reviewed the PR as a maintainer-side OpenClaw change. The conclusion was that the solution shape was appropriate because it fixes stale state at the Control UI boundary, treats known stale backend responses as terminal cleanup signals, keeps ordinary backend errors visible, and preserves Escape/backdrop as Deny.

[assistant]
Noted two remaining PR-state issues: the PR body had stale language from the earlier no-op cancel idea, and checks were red from branch/current-main mismatch.

[user]
Asked the agent to fix those two issues.

[assistant]
Updated the PR text to match the final behavior: Escape/backdrop still submit Deny, and stale Deny is safe because stale backend responses dismiss and refresh.

[assistant]
Briefly over-scoped by adding unrelated check-fix work from other current-main drift. That work touched surfaces outside the Control UI approval fix.

[user]
Objected to unrelated GitHub Actions changes being added to the PR.

[assistant]
Acknowledged the scope problem and began removing the unrelated change.

[user]
Also objected to unrelated transcript/tool-display changes being added to the PR.

[assistant]
Dropped the unrelated commit entirely and restored the branch to the approval-only diff. The PR branch was pushed back to only the Control UI approval files, and the PR body no longer referenced unrelated CI/transcript/tool-display changes.

[assistant]
Confirmed the PR head matched the expected approval-fix SHA after cleanup. The diff against main contained only approval UI files and tests.

--- Session group: agent transcript workflow and curation ---

[user]
Asked whether the repo's `agent-transcript` workflow should be used.

[assistant]
Loaded the `agent-transcript` workflow. The workflow requires local-only discovery, sanitized rendering, a local HTML preview before insertion, and explicit approval before adding any transcript section to a GitHub PR body.

[user]
Asked for a local HTML preview and noted there were many local sessions for this PR, with much more discussion than the current chat.

[assistant]
Searched local agent sessions across the relevant date range and found about ten high-confidence sessions for PR #86270. These included the initial implementation/manual-testing session, review sessions, focused correction sessions, and the final PR cleanup/transcript session.

[assistant]
Rendered local-only sanitized previews. The first preview showed candidate sessions separately. Later previews compressed the useful questions, implementation decisions, testing proof, review corrections, and cleanup into one proposed PR-body transcript section.

[user]
Explained that the point of adding the transcript is partly to show the effort behind the PR: multiple local sessions, real testing, repeated review, and refinement. Asked for an extended but condensed version that includes more of the user's questions and thinking without including full logs or heated wording.

[assistant]
Expanded the candidate transcript to better represent the work across the sessions. The new version keeps a substantial chunk of the meaningful transcript while still trimming repeated confusion-only turns, raw tool output, local setup noise, and heated language.

--- Verification captured in the local sessions ---

[verification]
Focused approval tests passed after the final approval-only branch state:
`node scripts/run-vitest.mjs ui/src/ui/controllers/exec-approval.test.ts ui/src/ui/app-gateway.node.test.ts ui/src/ui/views/exec-approval.test.ts ui/src/ui/app.exec-approval.test.ts ui/src/ui/app-gateway-chat-load.node.test.ts ui/src/ui/app-gateway.sessions.node.test.ts --run`
Result: 6 files / 114 tests passed.

[verification]
Formatting passed for the changed approval UI files:
`node_modules/.bin/oxfmt --check --threads=1 ...approval UI files...`

[verification]
Patch hygiene passed:
`git diff --check`

[verification]
Final PR branch scope was checked after removing unrelated work. The diff contains only Control UI approval files:
- `ui/src/ui/app-gateway-chat-load.node.test.ts`
- `ui/src/ui/app-gateway.node.test.ts`
- `ui/src/ui/app-gateway.sessions.node.test.ts`
- `ui/src/ui/app-gateway.ts`
- `ui/src/ui/app.exec-approval.test.ts`
- `ui/src/ui/app.ts`
- `ui/src/ui/controllers/exec-approval.test.ts`
- `ui/src/ui/controllers/exec-approval.ts`
- `ui/src/ui/views/exec-approval.test.ts`

Copilot AI review requested due to automatic review settings May 25, 2026 01:31
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels May 25, 2026
@clawsweeper

clawsweeper Bot commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed May 26, 2026, 11:35 PM ET / 03:35 UTC.

Summary
The PR updates Control UI exec/plugin approval prompt state so stale already-resolved or not-found resolve responses dismiss the active prompt, refresh pending approvals, and keep unrelated errors visible with focused tests.

PR surface: Source +179, Tests +483. Total +662 across 9 files.

Reproducibility: yes. Source inspection and the attached recording give a high-confidence path: make the Control UI hold a stale approval id after external resolution, then click Deny; current main catches the backend error and keeps the modal open.

Review metrics: none identified.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster ✨ media proof bonus
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • This changes operator approval semantics by treating known stale backend responses as terminal UI cleanup; maintainers should confirm that is desired across Control UI and channel approval paths, especially because the PR body notes no fresh Slack-specific stale flow was retested after the final rebase.

Maintainer options:

  1. Approve stale cleanup semantics (recommended)
    Merge after a maintainer signs off that not-found/already-resolved approval responses should dismiss the stale prompt and refresh pending approvals in the Control UI.
  2. Hold for a narrower approval-state design
    Pause the PR if maintainers want stale backend errors to remain visible or want a different Control UI recovery contract for Slack/plugin approvals.

Next step before merge
No automated repair is queued because review found no blocking defect; maintainer approval should decide the compatibility-sensitive approval cleanup behavior.

Security
Cleared: The diff is limited to Control UI approval state and tests, with no dependency, lockfile, script, permission, credential, or package-resolution changes; no concrete security or supply-chain concern was found.

Review details

Best possible solution:

Land after maintainer approval of the stale-error-as-cleanup behavior, keeping the focused regression tests and real behavior proof; if maintainers want stale backend errors to remain visible, ask for a narrower follow-up design.

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

Yes. Source inspection and the attached recording give a high-confidence path: make the Control UI hold a stale approval id after external resolution, then click Deny; current main catches the backend error and keeps the modal open.

Is this the best way to solve the issue?

Yes, with maintainer sign-off. The diff handles stale responses at the Control UI state boundary, keeps unrelated errors visible, refreshes pending exec/plugin lists, and adds focused race/expiry coverage.

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against acbb06e2660b.

Label changes

Label justifications:

  • P2: This is a normal user-facing Control UI bug fix for stale approval modals with limited blast radius and focused coverage.
  • merge-risk: 🚨 compatibility: Approval prompt cleanup semantics affect existing operator approval workflows across Control UI, gateway, and channel-delivered approvals, which green unit tests do not fully settle.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (recording): The PR body includes the required real behavior proof fields, and the inspected MP4 recording directly shows the Discord/Control UI approval modal flow after the fix.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes the required real behavior proof fields, and the inspected MP4 recording directly shows the Discord/Control UI approval modal flow after the fix.
  • proof: 🎥 video: Contributor real behavior proof includes video or recording evidence. The PR body includes the required real behavior proof fields, and the inspected MP4 recording directly shows the Discord/Control UI approval modal flow after the fix.
Evidence reviewed

PR surface:

Source +179, Tests +483. Total +662 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 3 190 11 +179
Tests 6 504 21 +483
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 694 32 +662

What I checked:

  • Current main stale-error behavior: Current main sends the approval decision, removes the prompt only on success, and turns every caught resolve error into execApprovalError, which leaves a stale modal open after backend not-found/already-resolved responses. (ui/src/ui/app.ts:1216, acbb06e2660b)
  • Current main normal resolved-event behavior: Current main already removes exec/plugin approval prompts when resolved events arrive, so the PR targets the stale-local-state path where that event was missed or delayed. (ui/src/ui/app-gateway.ts:1053, acbb06e2660b)
  • Gateway stale approval error contract: The gateway emits unknown or expired approval id with APPROVAL_NOT_FOUND details for missing approvals and approval already resolved with APPROVAL_ALREADY_RESOLVED details for conflicting duplicate resolutions. (src/gateway/server-methods/approval-shared.ts:55, acbb06e2660b)
  • PR stale cleanup implementation: The PR branch detects the known stale resolve errors, removes the active prompt, refreshes both exec and plugin pending approval lists, and preserves unrelated errors for the user. (ui/src/ui/controllers/exec-approval.ts:223, ea3a4de91583)
  • PR app integration: The PR branch routes stale resolve errors through dismissal and pending-list refresh while keeping ordinary failures attached to the still-active prompt. (ui/src/ui/app.ts:1221, ea3a4de91583)
  • Focused regression coverage: The PR adds app/controller/gateway-view tests for stale error detection, active prompt cleanup, refresh races, expiry pruning, and preserving unrelated errors. (ui/src/ui/controllers/exec-approval.test.ts:189, ea3a4de91583)

Likely related people:

  • steipete: The sampled current-main Control UI approval app, gateway, controller, and view files all trace through local blame/log history to commit 9754117 by Peter Steinberger; the history appears compressed, so this is the best routing signal rather than a full authorship trail. (role: current implementation author and recent area contributor; confidence: medium; commits: 97541170cab1; files: ui/src/ui/app.ts, ui/src/ui/app-gateway.ts, ui/src/ui/controllers/exec-approval.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a Control UI issue where exec/plugin approval modals could remain open (and show errors) after the same approval was resolved from another client (e.g., Discord). It centralizes “resolve” cleanup behavior so stale-resolution responses are treated as terminal cleanup signals (dismiss + refresh), and resolved events clear active prompt errors while preserving any in-flight local resolve state.

Changes:

  • Added exec-approval controller utilities to detect stale resolve errors, dismiss prompts, refresh pending approvals, and prune approvals after expiry.
  • Updated Control UI app + gateway event handling to use the new controller cleanup functions and preserve local busy state on external resolves.
  • Expanded unit test coverage for stale-error detection, resolve cleanup behavior, and refreshed-approval expiry pruning.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ui/src/ui/views/exec-approval.test.ts Minor import formatting change for modal dialog helpers.
ui/src/ui/controllers/exec-approval.ts Adds stale-resolution detection, queue refresh, prompt dismissal/cleanup helpers, and centralized resolve logic.
ui/src/ui/controllers/exec-approval.test.ts Adds tests for stale error detection, resolve behavior (dismiss vs error), and refresh expiry pruning.
ui/src/ui/app.ts Routes approval decisions through the controller’s centralized resolve handler.
ui/src/ui/app-gateway.ts Clears active modal error on resolved events via clearResolvedExecApprovalPrompt.
ui/src/ui/app-gateway.sessions.node.test.ts Updates exec-approval module mocks for new imports/behavior.
ui/src/ui/app-gateway.node.test.ts Adds host state for execApprovalBusy and regression test ensuring external resolves clear errors without touching busy.
ui/src/ui/app-gateway-chat-load.node.test.ts Updates exec-approval mocks to include clearResolvedExecApprovalPrompt.

Comment thread ui/src/ui/controllers/exec-approval.ts Outdated
Comment on lines +292 to +296
const refreshed = sortApprovalsNewestFirst([...execApprovals, ...pluginApprovals]);
state.execApprovalQueue = refreshed;
for (const entry of refreshed) {
scheduleApprovalExpiryPrune(state, entry);
}
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels May 25, 2026
@clawsweeper

clawsweeper Bot commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🥚 common Cosmic Patch Peep

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🥚 common.
Trait: stacks clean commits.
Image traits: location workflow harbor; accessory tiny test log scroll; palette sunrise gold and clean white; mood proud; pose sitting proudly on a smooth stone; shell translucent glimmer shell; lighting subtle sparkle highlights; background tiny artifact crates.
Share on X: post this hatch
Copy: My PR egg hatched a 🥚 common Cosmic Patch Peep in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@jesse-merhi
jesse-merhi force-pushed the jesse/fix-stale-approval-modal branch from 4c85031 to cae7692 Compare May 25, 2026 02:28
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. P2 Normal backlog priority with limited blast radius. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels May 25, 2026
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: XL and removed size: L labels May 25, 2026
@jesse-merhi
jesse-merhi force-pushed the jesse/fix-stale-approval-modal branch from 36af196 to fe6e9e1 Compare May 25, 2026 18:00
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels May 25, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: XL and removed size: L labels May 26, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels May 26, 2026
@jesse-merhi
jesse-merhi force-pushed the jesse/fix-stale-approval-modal branch from 82ff44e to 65daff6 Compare May 26, 2026 05:40
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels May 26, 2026
@jesse-merhi
jesse-merhi force-pushed the jesse/fix-stale-approval-modal branch from 65daff6 to 3f6ba99 Compare May 26, 2026 06:35
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 26, 2026
@jesse-merhi jesse-merhi self-assigned this May 26, 2026
@clawsweeper clawsweeper Bot added the proof: 🎥 video Contributor real behavior proof includes video or recording evidence. label May 26, 2026
@jesse-merhi
jesse-merhi force-pushed the jesse/fix-stale-approval-modal branch from 534483a to b886ab1 Compare May 26, 2026 15:48
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label May 26, 2026
@jesse-merhi
jesse-merhi force-pushed the jesse/fix-stale-approval-modal branch from b886ab1 to 1b5e8f1 Compare May 26, 2026 15:55
@openclaw-barnacle openclaw-barnacle Bot removed the agents Agent runtime and tooling label May 26, 2026
@jesse-merhi
jesse-merhi force-pushed the jesse/fix-stale-approval-modal branch from 1b5e8f1 to 73949ba Compare May 27, 2026 02:49
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels May 27, 2026
@openclaw-barnacle openclaw-barnacle Bot added the cli CLI command changes label May 27, 2026
@jesse-merhi
jesse-merhi force-pushed the jesse/fix-stale-approval-modal branch from 310eb9b to 5a848d4 Compare May 27, 2026 03:18
@openclaw-barnacle openclaw-barnacle Bot removed the cli CLI command changes label May 27, 2026
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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants