Skip to content

fix(tray): per-server review sheet, click-time approval decisions, review-bound approvals (#1569) - #1572

Merged
Dumbris merged 4 commits into
mainfrom
fix/1569-tray-review-binding
Oct 11, 2026
Merged

Dumbris merged 4 commits into
mainfrom
fix/1569-tray-review-binding

Conversation

@Dumbris

@Dumbris Dumbris commented Oct 11, 2026

Copy link
Copy Markdown
Member

Summary

Fixes the macOS tray half of the UX-02 review findings (#1569). The changes were written on the now-closed #1555 and are ported here onto main, which has not touched native/ since that branch point.

  • Per-server sheet: ReviewSheet is keyed by server, and review loads are numbered. A late response for server A can no longer fill the sheet while the operator is approving server B.
  • Click-time decisions: server and per-tool approvals capture the block list and hashes when the operator clicks. Only one approval runs at a time. The force confirmation re-sends the attempt that answered "dangerous", and the allow toggles are locked while an approval is in flight.
  • Review-bound approvals: ReviewTool decodes current_hash. securityApproveServer and approveSpecificTools send expected_hashes, the same contract as the CLI and Web on fix: serialize per-server tool-approval writes so baselines and approvals are complete (UX-02) #1555. The request is unbound only when no reviewed tool has a hash, and an empty review binds to the empty snapshot. A 409 "out of date" reloads the review and shows the core's message instead of opening the force dialog.

Compatibility

The binding is inert on today's core. main reports no current_hash, and both approve handlers ignore unknown body fields, so requests behave as before. It takes effect when the backend contract in #1566 lands.

Test plan

  • swift test (native/macos/MCPProxy): 1746 tests, 0 failures. New coverage is in ApproveServerPathTests and ReviewPresentationTests.
  • Checked live against a scratch core on a high port with a scratch config and data dir, running the fix: serialize per-server tool-approval writes so baselines and approvals are complete (UX-02) #1555 backend. A temporary XCTest drove the real APIClient. Security approve and tools approve both returned 409 "out of date" after a definition changed, and nothing was approved. Fresh hashes then approved.

Closes #1569

🤖 Generated with Claude Code

…view-bound approvals (#1569)

The macOS review sheet had the same races as the Web review screen and could
not bind an approval to what the operator reviewed:

- The sheet is keyed by server, so switching servers drops the previous
  review, selection and pending force decision. Review loads are numbered and
  only this server's newest response is shown.
- Server and per-tool approvals capture the block list and expected hashes at
  the click; a review that reloads before the request runs cannot change what
  is sent. One approval runs at a time, the force confirmation re-sends the
  attempt that answered "dangerous", and the allow toggles are locked while an
  approval is in flight.
- Approvals send expected_hashes (tool name -> the review's current_hash) on
  security/approve and tools/approve, unbound only when no reviewed tool has a
  hash. An empty review binds to the empty snapshot. A 409 "out of date"
  reloads the review and shows the core's message instead of the force dialog.

The binding is forward-compatible: today's core reports no current_hash and
ignores expected_hashes, so requests behave as before until the backend
contract (#1566) lands.

Closes #1569
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

…review)

- The server approval attempt is now reserved synchronously in the click
  handler (send), before its Task is scheduled, so the allow toggles and
  approve buttons lock at the click. A selection change can no longer fall
  between the captured decision and the request and then be erased by its
  success. The blind and force confirmations go through the same path, and
  every exit of approve() finishes the reserved attempt.
- Per-tool Approve is reserved per tool at the click (ToolApprovals) and
  disabled while in flight, so repeated clicks cannot send overlapping
  approvals for the same tool.
…der the stale notice (#1569 review)

- ApprovalAttempts.isLocked covers both an in-flight attempt and an
  unanswered force confirmation. The approve buttons, allow toggles and the
  per-tool controls honour it, so a click before the alert presents can no
  longer consume the force candidate and leave "Force Approve" doing nothing.
  Cancel drops the candidate and unlocks the sheet.
- Per-tool Approve/Reject is disabled while a server approval is in flight.
- The "out of date" notice is set before the review reloads, so a newer
  attempt started while the reload is suspended is not shown as stale.
- The capture-at-click test now uses the late review it builds, and comments
  cite the #1566 contract instead of claiming CLI/Web parity this tree does
  not have.
… during approval (#1569 review)

- Per-tool Reject now takes the same per-tool reservation as Approve and is
  disabled while the sheet is locked, so Approve and Reject on one tool can
  no longer race each other or a server approval, and Reject is no longer
  live in the gap before a force confirmation presents.
- "Quarantine to Review Again…" is disabled while an approval is in flight or
  its force confirmation is pending.
@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: fix/1569-tray-review-binding

Available Artifacts

  • archive-darwin-amd64 (31 MB)
  • archive-darwin-arm64 (28 MB)
  • archive-linux-amd64 (19 MB)
  • archive-linux-arm64 (17 MB)
  • archive-windows-amd64 (31 MB)
  • archive-windows-arm64 (27 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (27 MB)
  • installer-dmg-darwin-arm64 (24 MB)
  • smart-mcp-proxymcpproxy-goTK6A51.dockerbuild (0 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 38119981129 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Dumbris
Dumbris merged commit c9c1ad2 into main Oct 11, 2026
42 checks passed
Dumbris added a commit that referenced this pull request Oct 12, 2026
…1566)

The review payload carries a per-tool current_hash (server, tool, definition and the four safety hints; the rug-pull hash is unchanged). security/approve and tools/approve (tools and approve_all) accept expected_hashes; a mismatch returns 409 review_out_of_date and writes nothing. Server approval runs as one config commit under the approval lock (validate, baseline marker, integrity baseline and blocks, promote present pending tools, clear quarantine); tools appearing later stay pending. Coexists with Spec 116 PR2's expected_incarnation (409 server_replaced checked first). Web review screen, CLI review approve (incl. --from-review) and the macOS tray (#1572) send the binding. Live: on main a stale approve activated a definition that had turned destructive; with the fix every stale case returns 409 with 0 upstream calls. OpenCode gpt-6.1-sol VERDICT: PASS at 883b329 (round 4) and resync PASS at c0866fb.

Fixes #1566
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(tray): macOS review sheet keeps state across servers, captures approval late, and sends no expected_hashes

2 participants