Skip to content

Noodle Mail: let bots read the mailboxes assigned to them - #164

Open
borekfri wants to merge 4 commits into
pdparchitect:mainfrom
borekfri:noodle-mail
Open

borekfri wants to merge 4 commits into
pdparchitect:mainfrom
borekfri:noodle-mail

Conversation

@borekfri

Copy link
Copy Markdown

Summary

Implements part 1 of #7 (read-only mail). Today a Noodle bot can't use e-mail at all. This PR adds Noodle Mail, a companion app like Browser and Computer:

  • A person adds IMAP mailboxes in Noodle Mail. Find Servers fills in the servers from the address: first the domain's own settings, then Mozilla's public list of providers. Only the domain is sent. Passwords go into the login Keychain and nowhere else.
  • In Edit Bot → Mail (and New Bot), the person assigns mailboxes to a bot, the same way as browsers and computers.
  • An assigned bot gets messenger tool mail with mailboxes, folders, list, search, read and attachment (saves to a workspace file). Results are short JSON. A bot never sees a password and can't send mail. read marks a message as read only if the bot asks, and Noodle checks the assignment again right before that change.

One commit per layer, so it can be read commit by commit:

  1. Engine (Mail/Sources/MailEngine): IMAP and SMTP on SwiftMail 1.13.0, pinned exactly. Sending exists in the engine but nothing calls it yet; it is for a later PR with approved sends.
  2. Bridge protocol (Mail/MailProtocol): the versioned package Noodle links.
  3. App and bot tools (Mail/, Tools/Mail): the tool extension only forwards calls that Noodle's broker already authorized, over Noodle Mail's socket.
  4. Noodle wiring: MailController, mailbox assignments in the store and checkpoint, the Mail tab in Edit Bot and New Bot, and a test-mail CI job shaped like test-browser.

Left to you on purpose, because they are release or app-identity decisions:

  • No CompanionApp case, so no install entry in Settings or the Window menu, no downloads and no Sparkle feed.
  • No CompanionAppVisibility, menu-bar extra, About or Help yet. Each background launch shows a Dock icon.
  • No app icon (no new LFS files).
  • Noodle Hub: Hub bots don't get mailboxes yet, and the Mail tab says so.

Known limits:

  • Find Servers has no overall time limit, only one per step.
  • Non-ASCII (IDN) domains aren't converted.
  • Providers that allow only OAuth sign-in, such as Outlook.com, don't work. Password and app-password sign-in do.
  • Attachments over 20 MB are refused, but only after they are downloaded. A check on the server-reported size first would be a small follow-up.
  • If mail.json can't be read or comes from a newer version, New Bot fails with "One of the selected mailboxes is unavailable." even when none is selected. BrowserController.validate behaves the same way.

New dependencies, in the Noodle Mail package only: SwiftMail (BSD-2-Clause), swift-nio-imap, swift-nio-ssl (bundles BoringSSL) and swift-se0270-range-set (Apache-2.0), SwiftCross and swift-dotenv (MIT). The IMAP and SMTP test servers in Mail/Tests/MailEngineTests/Support are adapted from SwiftMail and keep its notice.

This is a big PR (about 8,900 added lines, most of them in Mail/). I'm happy to split it into one PR per commit if that is easier to review.

Verification

On this branch (upstream b4eee9a + 4 commits), macOS 26.7.1, Xcode 27.0:

  • Mail package: 178 tests (NoodleMailTests 6, MailEngineTests 114, MailCoreTests 58), 1 skipped: the opt-in live lookup. No test talks to a real mail server or the network.
  • MailProtocol 19. MailToolProviderTests 15. MailAccessTests 4. MailBrokerTests 3, StoreAgentTests 24, BotEditorTabPickerTests 1. Tests/ReleaseAutomation/test_workflows.py 21.
  • Root build with tests: no warnings in the changed files.
  • scripts/xcode-build.sh Mail and Noodle, then scripts/verify-tool-extensions.sh: verified (5).
  • By hand on this build: added and removed mailboxes, assigned two to a bot in Edit Bot → Mail (screenshots below).
  • By hand on the same code before the rebase onto b4eee9a (10–11 Oct): signed in to a real Seznam mailbox. A restricted test bot with one of two mailboxes assigned listed and read only that one. Unassigning removed the mail tool from messenger tool. The Keychain held one item per mailbox. Find Servers found the servers for a custom domain hosted at Seznam and for a gmail.com address.

Not tested:

  • The new test-mail CI job hasn't run yet (actionlint wasn't available offline).
  • CompanionAssignmentPickerTests.testBrowserAndComputerAssignmentPreviews fails locally. It also failed on c733034 without these changes; I didn't re-check it on b4eee9a.

Visual changes

Visual changes require before and after screenshots before the PR is ready
for review. See the visual review requirements.

  • No visual changes
  • Visual changes: before and after screenshots included below

Before

Noodle 0.69.1: Edit Bot has no Mail tab (bot name and backstory blurred). Noodle Mail is a new app, so it has no before.

before-edit-bot-light

After

PR build, macOS 26.7.1, light and dark. The sample mailboxes use example.com. The blurred row is a real test mailbox.

Edit Bot → Mail:
after-edit-bot-mail-light-cropped after-edit-bot-mail-dark-cropped

Noodle Mail, mailbox list:
after-mail-window-light after-mail-window-dark

Removing a mailbox:
after-remove-confirm-light after-remove-confirm-dark

No recording yet. Find Servers fills in the IMAP and SMTP fields a second or two after you click it. I can add a short recording if you want one.

Checklist

  • I tested the affected user flow
  • I added an Unreleased changelog entry for user-visible changes, or this does not apply (root CHANGELOG.md and Mail/CHANGELOG.md)
  • I considered both default and custom conversation backgrounds where relevant (not relevant: no conversation UI changes)
  • I checked single-line and multiline layouts where relevant (not relevant)
  • I checked the macOS 15 fallback when using newer macOS APIs (not relevant: Noodle and Noodle Mail target macOS 26)

🤖 Generated with Claude Code

borekfri and others added 4 commits October 23, 2026 19:30
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pdparchitect

Copy link
Copy Markdown
Owner

Very interesting. I need to review it more closely. My only concern is that this is a full email client while the browser is a thin wrapper over WebKit.

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.

2 participants