Skip to content

Approve MCP and CLI Trash plans without a blocking wait (M01-04d slice 4, PR 2) - #55

Open
WahdanZ wants to merge 2 commits into
mainfrom
m01-04d-4-2-approve-trash-async
Open

WahdanZ wants to merge 2 commits into
mainfrom
m01-04d-4-2-approve-trash-async

Conversation

@WahdanZ

@WahdanZ WahdanZ commented Nov 18, 2026

Copy link
Copy Markdown
Owner

What

PR 2 of M01-04d slice 4 (0 ✅ → 1a ✅ → 1b ✅ → 2 → 3 → 4). Removes bridge 2 (the semaphore in ToolConfirmation.approveTrash). No change to MCP JSON, CLI output, exit codes, refusal texts or the approval order. User approval: SAFETY-CRITICAL APPROVED for exactly this scope.

  • approveTrash and ToolConfirmation.moveToTrash are async; ApprovalSlot, Task.detached and the semaphore are gone. move_to_trash awaits AppCleanup.moveToTrash directly. The engines (AppEngine.uninstall, SDKEngine.remove, SystemDataEngine.remove) still take a ready approval and keep bridge 1 until PR 3.
  • MCPServer.call/handle and CLI.run are async. The single stdin consumer awaits handle before taking the next line, so requests still run one at a time, in order; the person's dialog stays synchronous on the main actor.
  • uninstall_app: approve → quit check → await approveTrash → engine (unchanged order). ConfirmedPreview: Sendable.
  • --cli bench runs through CLI.bench on its own sync path (never inside the main loop); CLI.run's unreachable bench case fails closed (64), like mcp.
  • Self-test: MCP calls go through wait; a timeout records a failed check.
  • D-018 and the run() comment state the updated invariant.

Proof

  • Negative control (not committed): approving before the quit check fails exactly the PR 0 check "…no executor approval was issued (outstanding approvals unchanged)" (544/1).
  • All PR 0 / 1a / 1b checks green (re-entrancy, EOF during a dialog / an approved move, ordering, main-thread probe, run-loop fingerprint).

Checks (local)

  • Build OK; warning budget OK (4, baselined)
  • Package 146; check-approval-sites.sh pass; check-no-test-hooks.sh pass
  • Self-test Release 494/0; test-hooks 545/0; CI smoke by hand incl. bench and --cli mcp

Before merge

  • mc-reviewer and mc-safety-architect (Opus) clean
  • Manual dialog checks in a logged-in session on the final build

🤖 Generated with Claude Code

…e 4, PR 2)

Removes bridge 2 (the semaphore in ToolConfirmation.approveTrash). No change
to MCP JSON, CLI output, exit codes, refusal texts or the approval order.
- approveTrash and ToolConfirmation.moveToTrash are async; ApprovalSlot,
  Task.detached and the semaphore are gone. move_to_trash awaits
  AppCleanup.moveToTrash directly (the engines keep their bridge until PR 3).
- MCPServer.call/handle and CLI.run are async. The single stdin consumer
  awaits handle before taking the next line, so requests still run one at a
  time in order; the person's dialog stays synchronous on the main actor.
- uninstall_app keeps approve -> quit check -> approveTrash -> engine.
- --cli bench runs Bench through CLI.bench on its own sync path.
- Self-test: MCP calls go through wait; a timeout records a failed check.
- D-018 and the run() comment state the updated invariant.
Negative control: approving before the quit check fails the PR 0
'no executor approval issued' check.
…n inheritance

- A timed-out MCP call keeps running and could act during later checks, so
  the self-test now stops (exit 1) after recording the failed check.
- D-018: the executor's cancellation check now sees the caller's task
  (never cancelled today); a future cancel stops between items.

This branch has not been deployed

No deployments
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.

1 participant