From e1f65e0a1881c7d4ee0556ab9b5c45223dd5abda Mon Sep 17 00:00:00 2001 From: bcbetterninja <327058824+bcbetterninja@users.noreply.github.com> Date: Sun, 13 Sep 2026 20:32:44 +0000 Subject: [PATCH] Automatically recover stale mail action IDs and retry once --- docs/mcp-content-actions.md | 11 +- src/BetterMail.App/MainWindow.axaml | 2 + .../MainWindowViewModel.Actions.cs | 41 ++++++- src/BetterMail.App/MainWindowViewModel.cs | 1 + .../McpMailTools.Capabilities.cs | 2 +- .../McpMailTools.MailActions.cs | 11 ++ .../EncryptedMailStore.ActionRecovery.cs | 69 +++++++++++ src/BetterMail.Core/MailAction.cs | 9 +- src/BetterMail.Core/MailActionDiagnostics.cs | 59 +++++++++- .../EncryptedMailStoreTests.cs | 110 +++++++++++++++++- .../MainWindowViewModelTests.cs | 63 ++++++++++ tests/BetterMail.Tests/McpContentTests.cs | 2 + tests/BetterMail.Tests/McpTests.cs | 2 +- 13 files changed, 371 insertions(+), 11 deletions(-) create mode 100644 src/BetterMail.Core/EncryptedMailStore.ActionRecovery.cs diff --git a/docs/mcp-content-actions.md b/docs/mcp-content-actions.md index 64dbbe6..f92012b 100644 --- a/docs/mcp-content-actions.md +++ b/docs/mcp-content-actions.md @@ -43,5 +43,12 @@ that requires the exact Internet Message-ID within the same mailbox. A missing o is not evidence of deletion or delivery. `retry_mail_action` explicitly authorizes another attempt without erasing history; a subsequent failure pauses again. Fix the reported cause first. Unconfirmed sends cannot be retried through this tool. Earlier pending actions for the same message must be resolved -first. A changed server ID is reported, not automatically rebound; verify and perform the intended -operation in the provider before cancelling the obsolete local action. +first. `recover_mail_action` rechecks a unique same-mailbox Internet Message-ID match, fetches the current +message, then atomically repairs the queued ID and authorizes a retry. A move already at its +destination is confirmed without repeating it. Changed queue state, ambiguous searches and +unconfirmed sends are never repaired. The app exposes the same operation as **Recover and retry**. + +Missing-object failures on moves/state actions automatically attempt identity recovery once per +queued action, including legacy paused actions. A verified recovery is retried in the same Busy +processing pass. The attempt marker survives restart; uncertainty or failure of the repaired +attempt leaves it paused with details. Sends and drafts are excluded from automatic recovery. diff --git a/src/BetterMail.App/MainWindow.axaml b/src/BetterMail.App/MainWindow.axaml index 928c1a4..2a5bd7b 100644 --- a/src/BetterMail.App/MainWindow.axaml +++ b/src/BetterMail.App/MainWindow.axaml @@ -840,10 +840,12 @@ +