Skip to content

fix(approvals): acknowledge verdicts before delivery notices finish - #166396

Merged
steipete merged 1 commit into
mainfrom
fix/w10-l2
Oct 7, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/w10-l2

Conversation

@steipete

@steipete steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolving an exec or plugin approval could time out even though the decision had already been made. The approval was durably committed and the waiting tool call correctly got its verdict. But the approve or deny RPC that resolved it, used by the Control UI's exec and plugin approval actions, did not reply until best-effort channel delivery notices had finished. When a notice was slow, the operator's click hit the 30-second CLIENT_TIMEOUT and looked like it failed, after the decision had already taken effect.

Why This Change Was Made

The shared resolution owner, src/gateway/server-methods/approval-shared.ts, awaited delivery notices before acknowledging the resolving request (introduced in bb01e49192d; this predates the #166050 worker-dispatch refactor). It now acknowledges as soon as the decision is durably committed and published, then completes the notices on their own lifecycle. Notice failures are still logged, and the commit/publish ordering is unchanged.

User Impact

Approving or denying from the Control UI returns immediately, even when a channel delivery notice is slow.

Evidence

  • Two new regressions resolve an exec approval and a plugin approval through the native dispatcher while the channel notice is held pending. Both failed before the fix with CLIENT_TIMEOUT and pass after, using virtual deadlines (555 ms and 31 ms).
  • On a Blacksmith Testbox: 623 selected tests across 35 files, the full pnpm build, and all 34 check-changed gates passed.
  • The run also covered real CLI and isolated-Gateway approval flows: allow-once, deny, expiry, replay, concurrent first-answer-wins, restart, real exec effects, and allow-always scope and cron grants surviving a restart. It also ran 14 Control UI Chromium E2E tests and 54 controller and page tests.
  • Production +6/-6 (net 0); tests +63/-2; docs +3.

Related, not changed here: an approval card still in delivery when its approval expires can be left stale. Open PR #159524 already carries that exact fix and regression.

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime labels Oct 7, 2026
@steipete
steipete marked this pull request as ready for review October 7, 2026 02:25
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Oct 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 6, 2026, 10:30 PM ET / October 7, 2026, 02:30 UTC.

ClawSweeper review

What this changes

Exec and plugin approval requests acknowledge the committed verdict before channel and push notifications finish, with dispatcher regressions and protocol documentation.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: pinned main and the latest release still delay legacy approval replies behind notification delivery. No actionable introduced defect was found.

Likely related people: steipete and stevenlee-oai are routing candidates based on prior merged approval work.

Priority: P2
Reviewed head: 08acb293e55dcc9f82c3a7ba0b94ce03150ff49a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful dispatcher regressions and no identified correctness or security blocker.
Proof confidence 🌊 off-meta tidepool Not applicable: The repository-state MEMBER classification exempts this PR from ordinary external-contributor proof. The body reports real isolated-Gateway approval runs; the changed pending-notice path is directly covered by dispatcher regressions with an injected callback. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository-state MEMBER classification exempts this PR from ordinary external-contributor proof. The body reports real isolated-Gateway approval runs; the changed pending-notice path is directly covered by dispatcher regressions with an injected callback. No stored-data contract changes.
Evidence reviewed 9 items Pinned introduced change: The introduced production change moves the existing authority-checked response ahead of the existing notification loop. Durable resolution, publication, callback ordering, and callback error logging remain intact.
Real Control UI caller: The Control UI uses exec.approval.resolve and plugin.approval.resolve for these approval kinds. The already-asynchronous canonical approval.resolve path therefore does not eliminate the defect in these supported adapters.
Notification lifecycle remains tracked: In-process dispatch tracks the handler execution separately from its first response. Returning the response does not end the handler or abandon its awaited notification tail.
Findings None None.
Security None None.

How this fits together

The Gateway approval subsystem receives operator decisions from the Control UI and other clients, records them, and releases waiting actions. It also publishes verdict events and sends notification updates through channel and push adapters.

flowchart TD
  A[Operator decision] --> B[Approval authority checks]
  B --> C[Durable verdict]
  C --> D[Waiting action settles]
  C --> E[Verdict publication]
  E --> F[RPC acknowledgement]
  F --> G[Channel and push notices]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source 0, Tests +61, Docs +3. Total +64 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 6 0
Tests 1 63 2 +61
Docs 1 3 0 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 72 8 +64

Review metrics

None.

Technical review

Best possible solution:

Keep acknowledgement tied to the durable, published verdict while retaining notification completion and failure logging under the existing handler lifecycle.

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

Yes, from source: hold a resolution notification pending beyond the 30-second RPC deadline after committing an exec or plugin verdict. The new dispatcher tests encode that path; this reviewer did not execute it.

Is this the best way to solve the issue?

Yes. Moving the existing response preserves commit and publication ordering, avoids a second notification owner, and repairs the supported legacy methods still used by the Control UI.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against af716af2a545.

Labels

Label changes:

  • add P2: Slow notifications can make an already-applied operator decision appear to fail, but the verdict and waiting action remain correct.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository-state MEMBER classification exempts this PR from ordinary external-contributor proof. The body reports real isolated-Gateway approval runs; the changed pending-notice path is directly covered by dispatcher regressions with an injected callback. No stored-data contract changes.

Label justifications:

  • P2: Slow notifications can make an already-applied operator decision appear to fail, but the verdict and waiting action remain correct.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository-state MEMBER classification exempts this PR from ordinary external-contributor proof. The body reports real isolated-Gateway approval runs; the changed pending-notice path is directly covered by dispatcher regressions with an injected callback. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: The introduced production change moves the existing authority-checked response ahead of the existing notification loop. Durable resolution, publication, callback ordering, and callback error logging remain intact. (src/gateway/server-methods/approval-shared.ts:680, 08acb293e55d)
  • Real Control UI caller: The Control UI uses exec.approval.resolve and plugin.approval.resolve for these approval kinds. The already-asynchronous canonical approval.resolve path therefore does not eliminate the defect in these supported adapters. (ui/src/app/exec-approval.ts:263, 08acb293e55d)
  • Notification lifecycle remains tracked: In-process dispatch tracks the handler execution separately from its first response. Returning the response does not end the handler or abandon its awaited notification tail. (src/gateway/server-in-process-dispatch.ts, 08acb293e55d)
  • Meaningful dispatcher regressions: The two parameterized cases register real durable approvals, resolve through the native dispatcher, hold the injected notification callback pending, verify the waiting verdict, advance a virtual deadline, and require a successful RPC response before releasing notification delivery. These are supplemental boundary tests, not live channel proof. (src/gateway/server-instance-runtime.approvals.test.ts:143, 08acb293e55d)
  • Latest release still has the old ordering: The v2026.9.8 source awaits every follow-up before sending the authority-checked reply. The pinned main-to-head diff independently establishes that pinned main retains this ordering too. (src/gateway/server-methods/approval-shared.ts, fc23bc864e45)
  • Existing authority boundary preserved: The resolution guard still checks current requester authority, live record identity, visibility, and channel custody before the durable operation. This patch changes acknowledgement timing without creating, transferring, or widening approval authority. (src/gateway/server-methods/approval-shared.ts:594, 08acb293e55d)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • stevenlee-oai: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@steipete
steipete merged commit f462f36 into main Oct 7, 2026
190 of 193 checks passed
@steipete
steipete deleted the fix/w10-l2 branch October 7, 2026 02:49
@steipete

steipete commented Oct 7, 2026

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

docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

1 participant