Skip to content

Add Allow writes per service and a shared send confirmation - #377

Merged
mattt merged 3 commits into
mattt:mainfrom
oliverames:pr/allow-writes-and-approvals
Nov 24, 2026
Merged

mattt merged 3 commits into
mattt:mainfrom
oliverames:pr/allow-writes-and-approvals

Conversation

@oliverames

@oliverames oliverames commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

This adds one "Allow writes" switch per service and a shared window that asks before an outbound send. It is cut directly from main as one change so it can merge on its own.

Why

Today a connected client can use every tool of an enabled service, writes included, and the only control is a switch per tool. People want to let a client read Calendar or Mail without letting it change them.

What changed

Allow writes (per service)

  • Each service with tools that change things gets an "Allow writes" switch on its Settings page. While it is off, those tools are not listed to clients and a direct call is refused before anything runs. Deletes count as writes, and tools that only read are never affected.
  • Services that already write (Calendar, Contacts, Home, Mail, Music, Phone, Reminders, Shortcuts) default to on, so an update changes nothing for them. A service whose write tools are new can default to off through writesEnabledByDefault.

Shared confirmation window

  • A small reusable window for outbound sends. It shows the client, the recipient and the full text, waits 50 seconds, shows one request at a time, and has no "always allow". It is meant to back tools that send to another person, so each one does not need its own window. Nothing in this PR uses it yet.

Review fixes

  • This is the two-commit cut Mattt asked for: the Allow writes switch and the shared confirmation window, without the approval modes (1014bee). The test target entries and the README section are in the first commit.
  • approve calls try Task.checkCancellation() before it acts on the answer, so a task cancelled while the confirmation is decided can't still send, and the cancellation is reported as a cancellation rather than as the person declining. Tests cover both.

Testing

  • swift format lint --strict -r . is clean.
  • Debug build of the iMCP scheme succeeds.
  • imcp-serverTests: 215 tests run, 1 skipped (pre-existing, in HomeProxyTests), 0 failures. New tests are in ServiceWritesTests and OutboundConfirmationTests.
  • CI: both jobs pass.

Not verified

  • The Allow writes switch has not been exercised live on the other services.
  • The confirmation window has not been driven from a real client against a running app; it is covered by unit tests.

Replaces #342 and #354.

@mattt

mattt commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Following up from #364, on why I'd like to leave out 1014bee: the default mode makes every existing write tool prompt after an upgrade, and two of the others override a service's own switch. When you cut this down to the first two commits, please move the test target entries and README section into the first.

@oliverames
oliverames force-pushed the pr/allow-writes-and-approvals branch from 1014bee to 541bba9 Compare November 20, 2026 15:09
@oliverames oliverames changed the title Add Allow writes per service, four approval modes, and a shared send confirmation Add Allow writes per service and a shared send confirmation Nov 20, 2026
@oliverames

oliverames commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

@mattt Trimmed this down to the Allow writes switch and the shared confirmation window, and moved the ServiceWrites test target entries and README section into the first commit. Ready for another look.

@mattt

mattt commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Thanks for trimming this down, @oliverames. Two things before I merge:

  • approve calls perform right after an approval comes back. Could you add try Task.checkCancellation() before it, with a test where the caller is cancelled before the approval returns? As it is, a cancelled call can still send.
  • This conflicts with main in project.pbxproj now that Add Notes smart folders, tags and note links #351 is merged. Could you rebase? Both sides stay: your two models and their tests, and the NotesInline files, TopoText dependency, and macOS 15.1 test target from main.

Oliver Ames added 2 commits November 20, 2026 16:57
One switch per service hides its write tools from clients and refuses direct
calls to them. Deletes count as writes; read-only tools stay available.
Services that already write default to on, so existing setups don't change.
A reusable window shows the client, the recipient, and the full text, waits 50 seconds, shows one request at a time, and has no "always allow". It is for tools that send something to another person.
@oliverames
oliverames force-pushed the pr/allow-writes-and-approvals branch from f023a47 to 70fa96e Compare November 20, 2026 22:00
oliverames pushed a commit to oliverames/iMCP that referenced this pull request Nov 20, 2026
Mattt's mattt#377 review: a cancelled call could still send because approve
ran perform immediately after the person approved. Add
Task.checkCancellation() before perform, with a test where the caller is
cancelled while the confirmation is still being decided.
oliverames pushed a commit to oliverames/iMCP that referenced this pull request Nov 20, 2026
@oliverames

oliverames commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks @mattt. This is the two-commit cut you asked for now: the Allow writes switch with the test-target entries and README section in the first commit, and the shared confirmation window in the second. The approval modes are gone.

approve checks cancellation before it runs perform too, so a task that gets cancelled while the confirmation is being decided can't still send. There's a test that cancels the task before the approval comes back and checks the action never runs.

imcp-serverTests is at 206 tests with 1 skipped (the pre-existing one) and no failures, and swift format lint --strict is clean.

@oliverames

oliverames commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

@mattt The macOS 26 job is failing on the stale Helper module cache described in #393, which is the runner image moving to Xcode 26.0.1. The macOS 27 job passes, and #393's macOS 26 job is green. Once #393 lands I'll rebase onto main and this job should go green.

Cancelling the caller closes the window as declined, which surfaced as
"The user declined". Check cancellation before acting on any answer.
@oliverames

Copy link
Copy Markdown
Contributor Author

@mattt One more small fix while this waits. When a caller was cancelled while the window was up, the window closed as declined, so the error said "The user declined" even though nobody did. approve now checks cancellation before it acts on any answer, so a cancelled call reports a cancellation, with a test for it. Nothing else changed, and imcp-serverTests is at 215 with 1 skipped and no failures.

@mattt
mattt merged commit 62f42c2 into mattt:main Nov 24, 2026
2 checks passed
oliverames pushed a commit to oliverames/iMCP that referenced this pull request Nov 24, 2026
oliverames pushed a commit to oliverames/iMCP that referenced this pull request Nov 24, 2026
oliverames pushed a commit to oliverames/iMCP that referenced this pull request Nov 24, 2026
@oliverames
oliverames deleted the pr/allow-writes-and-approvals branch November 25, 2026 15:12
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.

2 participants