Repository navigation
Conversation
…switch)
The Inbox Agent routed every typed question through phrase rules into one of
four fixed flows and refused anything that fell between them ("review my
uncategorized unread emails, mark read if not business" was refused although
every step exists). This adds the agent described in
docs/INBOX_AGENT_HARNESS.md: the model decides which tool to call next, the
host runs it and decides what is allowed.
- core: multi-turn tool calls (ai-chat.ts) for OpenAI-compatible providers and
Gemini, built on the same request code as the single-prompt calls, now shared
(postOpenAICompatibleChat, postGeminiGenerate, withAIRetry). A reasoning model
that spends its whole budget thinking gets one retry with twice the budget.
- desktop: the loop (14 turns, 40 tool calls) and read-only tools: search_mail,
count_mail, read_message, read_thread, read_attachment, deep_search (the
existing tuned search as a tool), classify_messages and the list_* tools.
- Answers are grounded facts: every email or tool result shown gets an id, and
verifyInboxAssistantFacts (extracted from the one-shot answer, shared) keeps a
fact only when its quotes appear in what was shown under the cited ids.
- Providers that refuse tools are retried with reasoning off (gpt-6-luna takes
tools on Chat Completions only that way), then with a JSON protocol; what
worked is remembered per provider.
- Diagnostics: route "agent", outcome "answered", and a content-free agent
record in the run, the app.log line, the copied report and the activity panel.
Off unless the app starts with SARVINBOX_AGENT_HARNESS=1. Review cards keep
their own path. No pre-existing test was changed.
CodeQL js/incomplete-sanitization on list_folders: replace('\\', '')
removes only the first backslash. trimCharsStart strips the leading run.
…se 2) The agent can now mark read or unread, star, archive, move to Trash, restore, move to a folder and set categories. It never writes directly: change_mail stages a change set over messages it was shown in this run, and the host applies it on the user's approval card or, under "Approve for me", up to 200 emails per request. Undo puts back only rows still as the set left them. - Provenance: ids the model was not shown are refused for the whole call. - Protections: starred, important and the unread review's content gates start unticked; only the user's tick applies them. - Each row applies at most once; a retry runs only failed rows; a row moved or deleted since staging is skipped. - Writes reuse the review cards' durable paths. changeAssistantMailLocation now also moves to any folder by id, and changeAssistantStarFlags joins the read helper. Both keep their existing receipts. - Card, inboxAssistant:changeSet IPC, and change counts in diagnostics. No existing test changed in behaviour; new tests cover the paths above. Design: docs/INBOX_AGENT_HARNESS.md, "Phase 2 as built".
…Agent (phase 3) The Inbox Agent can now change settings that keep acting after the chat, and do more to mail, always through cards the user approves. - Mail actions: add/remove a label (created on approve if missing, removed again on Undo when unused), snooze until a local time and unsnooze, report spam / not spam. Spam and label-creating sets are standing and never auto-apply under "Approve for me". - Setting changes (R cards): create, update and delete filters; block, unblock, VIP, trust a sender. They always ask. Applying a filter to existing mail, or moving a blocked sender's mail to Spam, is a separate box offered unticked with the match count. Undo reverts only what is still as the change left it; a stale filter is refused. - A sender may only be changed if the user typed the address or it is the sender of a message shown in the run. - Change journal in the encrypted core DB: cards keep Approve/Undo across a restart; an unreadable journal is never overwritten. - "Undo that" in a later message: change labels count up through the chat and earlier held changes are listed to the model. - New lookups: list_filters, list_labels, list_snoozed, find_contact, sender_profile, search by label. - "Tools · Preview" switch in the Inbox Agent header (app setting sarvinbox-inbox-agent, mirrored to the core DB); the env var still forces it on. - AI service: an empty reply cut off by the token limit is retried once with double the budget, and the warning no longer logs model text. - Shared helpers: setEmailLabel, filter-matching (moved out of filter-handlers), revertUserSpamVerdict; the Filters and Labels handlers use them. Existing tests changed on purpose: - Restart tests now expect cards to keep their buttons (journal); an unreadable journal still shows them as expired. - Change labels are per chat, so the second message's set is C2. - undo_change's unknown-label message says "from this chat".
The agent from phases 1-3 now answers every Inbox Agent request. The phrase router and the review flow it fed are removed. - Evaluation: assistant-eval drives the agent. Questions go through deep_search (floor and ceiling) and agent-tasks.ts; review safety runs with the weakest model; live-provider runs record the agent's turns for replay. Gate met: the same retrieval gaps and the same four keep-mail cases as the old review. - Removed: the router, capabilities, the unread and uncategorized review and the automatic review, the "mark as read" command, one-shot answers, the review card, the applyReview IPC, and the "Tools · Preview" switch with its app setting (inbox-agent-switch, inbox-agent-settings). - Protection: createConversationGuard, and changeProtection also covers VIP senders, conversations with the user's own recent reply or a colleague, calendar invitations, encrypted mail, user categories and mail the provider marks important. - deep_search records its plan and account diagnostics, reads dates in the user's time zone, and carries follow-up context (source refs, topic), which closes the follow-up gaps. - app-identity.ts sets app.name before any other main-process module loads, so a module that reads the core database while it loads can no longer tie a dev run to the installed app's data and keychain item (seen on 2026-11-19). Known gap: search_mail misses terms that appear only in a raw body. Tests deleted with the code they tested: inbox-agent-switch, the action service, actions, auto-review, behavior integration, capabilities, the recommendation cache, review behavior, the Inbox Agent app-settings sync and the review card. Review safety is covered by the ported evaluation (review-safety.test.ts); app-identity.test.ts is new.
A release-readiness check of phase 3b found ways the agent could change more than the user approved. Each is closed here with tests, and the CHANGELOG now describes the agent as it ships. - Approve for me: conversations that had it on start on Ask for approval after this update, because it now covers archive, Trash, moves, labels, snooze and stars, not only read/unread. Turning it back on shows what it covers. A backstop refuses an auto-apply the mode does not allow, and the mode cannot change while a request runs. - Snooze, and an unstar followed by an archive in one request, go through the same protection as other changes. An email stays protected for the rest of a request, and in the chat's later requests while the agent's own change can still be undone. - Filters and block sets linked to existing mail go through the conversation guard. undo_change needs approval where the original did; an undo that would hide mail again always waits for a click. - The approval window starts when the answer arrives, not when the set is staged, and every target is re-checked at approval. An email the user starred or marked important after the card was prepared is left alone. - VIP comes from sender_stats.is_vip. Mail with no downloaded body or with attachments is protected again. - Sets applied on their own are journaled as they are applied, so Undo survives a quit mid-request. - include_conversation skips the user's drafts and leaves their own sent replies in Sent. - CHANGELOG [Unreleased]: Added, Changed and Removed entries for the agent. - docs/INBOX_AGENT_HARNESS.md describes the safety rules.
Conflicts and how they were resolved: - Phase 3b removed the review cards and their actions. #131 (newer review, one-hour review lifetime) changed that code on main, so its files are removed here deliberately: inbox-assistant-actions.ts, AssistantReviewCard.tsx and its test, inbox-assistant-newer-review.ts and its test, inbox-assistant-review-lifetime.test.ts. InboxAssistant.tsx keeps this branch's version. - The project conventions file, ai-service.ts and InboxAssistant.test.tsx: resolved as in the rehearsal merge of 2026-11-22. - spam-verdict-actions.test.ts: keeps main's log capture import and this branch's revertUserSpamVerdict import. - CHANGELOG.md: main's text, with this branch's entries under [Unreleased]. The [1.4.12] section is as released.
The policy never mentioned the Inbox Agent. It now says: - how it changes mail (the same way as the user's own changes; only after approval, except reversible changes under Approve for me, up to 200 emails per request with Undo for 24 hours; what always waits); - that it is one of the AI features sending mail to the provider the user chose, and exactly what it sends for a request; - that it sends nothing until asked, and only from the accounts selected for the conversation and the shared contacts; - what it keeps on the device: conversations in the encrypted core database until deleted (not deleted with an account), and the change record only while a change can still be approved (30 minutes) or undone (24 hours). Effective date 24 November 2026. Move it to the release date when this reaches main, since the policy publishes from there.
feat(agent): the Inbox Agent as the only path, with its safety fixes (phase 3b)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings
devintomainfor the next release.devismainat 1.4.12 plus the merge of #138, which carries all four Inbox Agent phases (#128, #130, #132, #138). 110 files, 9 commits;mainhas nothingdevlacks.What it changes for users
From
## [Unreleased]inCHANGELOG.md:Added
Changed
Removed
Checks
On #138 at the same head (
94602628): type-check, lint, unit and integration tests, the Windows unit tests, the renderer bundle guard, the dependency scan and the extension sandbox escape test on all three platforms passed.CodeQL will report one high-severity alert here, as it did on #138. It is not new code: it is the keyed SHA-256 digest of the AI provider settings in
apps/desktop/electron/ipc/inbox-assistant-handlers.ts, already open onmainas alert 178 since 2026-11-12 and shipped in 1.4.11 and 1.4.12. This change moves the function and renames its key, so it is counted again (alert 188). The digest is an in-memory change detector keyed with a random per-process key that is never stored.🤖 Generated with Claude Code