Skip to content

fix(webchat): unblock backend exec approvals#77672

Closed
vincentkoc wants to merge 1 commit into
mainfrom
fix/webchat-exec-approvals
Closed

fix(webchat): unblock backend exec approvals#77672
vincentkoc wants to merge 1 commit into
mainfrom
fix/webchat-exec-approvals

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Summary

  • Let WebChat send /approve ... through the existing backend command path immediately while a run is blocked on approval.
  • Hydrate pending exec/plugin approval cards after Control UI reconnects.
  • Add CLI inspection affordances: openclaw approvals list --gateway and openclaw sessions list --json.
  • Update docs and changelog.

Verification

  • pnpm test:serial ui/src/ui/app-chat.test.ts ui/src/ui/app-gateway.node.test.ts ui/src/ui/chat/slash-commands.node.test.ts src/cli/exec-approvals-cli.test.ts src/cli/program/register.status-health-sessions.test.ts src/cli/program/routes.test.ts
  • OPENCLAW_TESTBOX=1 pnpm testbox:run --id tbx_01kqv4sxe6errn6fe682v70p51 -- "pnpm check:changed"
  • node dist/index.js sessions list --json --limit 1

Security note

  • WebChat does not call exec.approval.resolve directly. /approve ... is still sent to backend chat.send, preserving the existing command authorization and gateway scope checks.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui cli CLI command changes size: M maintainer Maintainer-authored PR labels May 5, 2026
@clawsweeper

clawsweeper Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed July 3, 2026, 5:06 PM ET / 21:06 UTC.

Summary
The branch routes WebChat /approve through backend chat.send, hydrates pending approval cards after reconnect, adds openclaw approvals list --gateway and openclaw sessions list --json, and updates docs plus changelog text.

PR surface: Source +228, Tests +137, Docs +6. Total +371 across 17 files.

Reproducibility: yes. at source level. Current main leaves non-local /approve on normal chat submission, and normal submission is queued when isChatBusy(host) is true for the run waiting on approval.

Review metrics: 1 noteworthy metric.

  • Public CLI Surfaces: 2 changed: approvals list and sessions list alias/route. The PR changes approval inspection and sessions command behavior, so compatibility and ownership need maintainer review before merge.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🌊 off-meta tidepool
Patch quality: 🧂 unranked krab
Result: blocked by patch quality or review findings.

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

Rank-up moves:

  • Rebase onto current main and remove superseded sessions/changelog edits.
  • Use approval-runtime authority or a maintainer-approved limitation for pending approval listing.
  • Reuse the current approval refresh helper or defer reconnect hydration to the narrower linked PR.

Mantis proof suggestion
A browser-visible WebChat approval flow would materially help verify immediate /approve sending and reconnect approval hydration after rebase. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis visual task: verify WebChat sends /approve immediately while an exec run waits, then reconnect and confirm pending approval cards hydrate.

Risk before merge

  • [P1] The new openclaw approvals list --gateway path can hide requester-bound pending approvals unless it uses the trusted approval-runtime authority path or maintainers explicitly choose requester-bound semantics.
  • [P1] The PR changes public CLI behavior while overlapping the canonical pending approvals CLI issue and a separate open implementation PR, so command ownership and authorization semantics need maintainer coordination.
  • [P1] The branch is draft, conflicting, and not maintainer-modifiable, so reviewers cannot validate the exact merge result without author action or a replacement branch.
  • [P1] The reconnect hydration portion overlaps the current-main approval refresh helper and a narrower open hydration candidate, so keeping a parallel loader risks UI approval queue drift.
  • [P1] The branch carries release-owned CHANGELOG.md churn that should be dropped or reconciled during rebase.

Maintainer options:

  1. Rebase And Narrow The WebChat Fix (recommended)
    Rebase onto current main, keep immediate WebChat /approve routing, reuse the existing approval refresh helper or the narrower hydration PR, and drop superseded sessions and changelog edits.
  2. Make This PR Own Approval CLI Semantics
    Maintainers can keep the pending-approval CLI work here only after choosing the authority contract and aligning it with the canonical CLI issue and open CLI PR.
  3. Replace With Smaller Current-Main Work
    If the stale draft is too costly to reconcile, open a smaller replacement that preserves credit while carrying only the current-main WebChat approval routing and approved follow-up work.

Next step before merge

  • [P2] Protected maintainer draft needs human review for approval security-boundary and public CLI ownership decisions; this is not a safe cleanup close or automated repair lane.

Security
Needs attention: The approval-inspection CLI path must preserve approval-runtime visibility semantics before merge.

Review findings

  • [P1] Route approval listing through approval-runtime authority — src/cli/exec-approvals-cli.ts:414-415
  • [P2] Reuse the existing approval refresh helper — ui/src/ui/app-gateway.ts:155-174
  • [P2] Drop the stale sessions list alias change — src/cli/program/register.status-health-sessions.ts:195-216
Review details

Best possible solution:

Land a rebased, narrower patch that keeps backend WebChat /approve routing, settles or drops the approval CLI work through the canonical CLI thread, reuses current approval refresh behavior, and removes stale sessions/changelog churn.

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

Yes, at source level. Current main leaves non-local /approve on normal chat submission, and normal submission is queued when isChatBusy(host) is true for the run waiting on approval.

Is this the best way to solve the issue?

No, not as submitted. Sending /approve through backend chat.send is the right owner boundary, but the approval CLI authority path, reconnect hydration, sessions alias, and changelog pieces need current-main reconciliation and maintainer approval.

Full review comments:

  • [P1] Route approval listing through approval-runtime authority — src/cli/exec-approvals-cli.ts:414-415
    listPendingApprovals calls exec.approval.list through the generic CLI gateway helper, but broad pending-approval visibility is gated on admin or trusted approval-runtime clients. For an operator recovery command this can falsely hide requester-bound approvals, so use the existing approval-runtime client or document and test a maintainer-approved narrower contract.
    Confidence: 0.9
  • [P2] Reuse the existing approval refresh helper — ui/src/ui/app-gateway.ts:155-174
    Current main already has refreshPendingApprovalQueue, which preserves partial-list fallback semantics, removed prompt IDs, sorting, and expiry pruning. This parallel hello-time loader reimplements those rules and can drift after rebase.
    Confidence: 0.88
  • [P2] Drop the stale sessions list alias change — src/cli/program/register.status-health-sessions.ts:195-216
    Current main already registers sessions list through shared option helpers and tests parent/list-side option forwarding. Reintroducing this copied alias and route after rebase creates another public CLI path that can drift from canonical option handling.
    Confidence: 0.82

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P1: The central WebChat exec approval workflow can block real users when /approve is queued behind the run waiting for that approval.
  • merge-risk: 🚨 compatibility: The PR changes public CLI command surfaces while overlapping current sessions list behavior and a separate pending-approval CLI implementation path.
  • merge-risk: 🚨 security-boundary: The PR exposes pending exec approval command details through a new CLI path that must preserve approval visibility boundaries.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🌊 off-meta tidepool and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The external-contributor proof gate does not apply to this member-authored, maintainer-labeled draft; the body lists tests/Testbox validation, but live WebChat proof after rebase would still reduce risk.
Evidence reviewed

PR surface:

Source +228, Tests +137, Docs +6. Total +371 across 17 files.

View PR surface stats
Area Files Added Removed Net
Source 7 243 15 +228
Tests 6 157 20 +137
Docs 4 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 406 35 +371

Security concerns:

  • [medium] Approval list uses generic CLI authority — src/cli/exec-approvals-cli.ts:414
    Pending approval records are filtered by requester, reviewer device, admin, or trusted approval-runtime authority; the new CLI list path uses the generic gateway RPC helper and can give operators incomplete visibility at an exec approval boundary.
    Confidence: 0.9

What I checked:

  • Repository policy read: Root AGENTS.md and the relevant docs/UI scoped AGENTS.md were read; protected maintainer items, approval security boundaries, CLI compatibility, and release-owned changelog guidance affected this review. (AGENTS.md:1, 010b61746379)
  • Live protected PR state: Live GitHub metadata shows the PR is open, draft, author-associated as MEMBER, labeled maintainer, conflicting, and not maintainer-modifiable at head 4f062d6. (4f062d6c8906)
  • Current-main WebChat approval gap: Current main defines /approve as a non-local command, so WebChat falls through to normal chat submission; that path queues when isChatBusy(host) is true for the run waiting on approval. (ui/src/ui/app-chat.ts:1940, 010b61746379)
  • Approval listing authority risk: The PR's new listPendingApprovals calls exec.approval.list through the generic CLI gateway helper, while current main grants broad approval visibility only to admin or trusted approval-runtime clients. (src/cli/exec-approvals-cli.ts:414, 4f062d6c8906)
  • Reconnect hydration overlap: Current main already has refreshPendingApprovalQueue, which preserves partial refresh behavior, dismissed/resolved IDs, sorting, and expiry pruning; the PR adds a separate hello-time loader instead of reusing it. (ui/src/ui/controllers/exec-approval.ts:327, 010b61746379)
  • Sessions alias already on main: Current main already registers and tests sessions list through shared option helpers, while the PR carries an older copied alias implementation and a new fast-route change. (src/cli/program/register.status-health-sessions.ts:214, 010b61746379)

Likely related people:

  • vincentkoc: Recent history extracted shared visible approval list mapping, and this PR also touches the approval-list and WebChat approval surfaces. (role: recent approval backend and current PR area contributor; confidence: high; commits: 6464f8d1d924; files: src/gateway/server-methods/approval-shared.ts, src/gateway/server-methods/exec-approval.ts, src/cli/exec-approvals-cli.ts)
  • steipete: History shows the original exec approvals CLI tooling and service status work on the CLI/docs surface this PR changes. (role: primary approvals CLI history contributor; confidence: high; commits: 3686bde783fd; files: src/cli/exec-approvals-cli.ts, src/cli/exec-approvals-cli.test.ts, docs/cli/approvals.md)
  • jesse-merhi: Recent Control UI approval prompt work is adjacent to the reconnect hydration and approval queue behavior touched here. (role: recent Control UI approval prompt contributor; confidence: medium; commits: 5297eebe8837; files: ui/src/ui/controllers/exec-approval.ts, ui/src/ui/app-gateway.ts)
  • fuller-stack-dev: Recent local approval resolution work touches the trusted approval-runtime authority model implicated by the new CLI listing path. (role: approval-runtime authority contributor; confidence: medium; commits: 13cfb77c10f9; files: src/gateway/operator-approvals-client.ts, src/gateway/server-methods/approval-shared.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.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jun 14, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jun 18, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jun 20, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jun 21, 2026
@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

The useful part of this PR has landed via #101532 in commit 395fbb8e, with Vincent's co-authorship and changelog credit preserved. Thank you, @vincentkoc.

The original branch could not be updated by maintainers and had accumulated several unrelated/stale changes. The landed replay keeps the needed behavior narrowly at the owning boundary: a busy Control UI sends /approve immediately instead of trapping it behind the active chat run. It includes focused unit and browser/WebSocket regression coverage plus exact-head CI.

The other pieces were deliberately not replayed: reconnect loading is already owned by #98524/current helpers, the session alias is already on main, and the requester-filtered CLI approval listing would incorrectly narrow an operator-authorized approval surface. For future contributions, enabling Allow edits by maintainers lets us improve the original branch in place.

@steipete steipete closed this Jul 7, 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 cli CLI command changes docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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.

2 participants