Skip to content

delete-staged does not work with IMAP accounts #221

@DominicHolmes

Description

@DominicHolmes

Summary

delete-staged fails for IMAP accounts with Error: OAuth client secrets not configured, because the CLI command only creates Gmail API clients. However, the IMAP client already implements the full gmail.API deletion interface (TrashMessage, DeleteMessage, BatchDeleteMessages with per-message fallback).

Steps to reproduce

  1. Add an IMAP account (e.g. iCloud Mail via add-imap)
  2. Stage messages for deletion (via TUI or MCP stage_deletion tool)
  3. Run msgvault delete-staged <batch-id> --yes
  4. Fails with OAuth error even though the account is IMAP, not Gmail

What I'd expect

delete-staged should detect the account type and instantiate an IMAP client (using stored credentials) instead of always assuming Gmail OAuth.

Analysis

  • internal/imap/client.go already implements TrashMessage (IMAP MOVE), DeleteMessage (UID STORE \Deleted + UID EXPUNGE), and BatchDeleteMessages (graceful fallback to per-message delete)
  • internal/deletion/executor.go accepts any gmail.API interface, which the IMAP client satisfies
  • The gap is in cmd/msgvault/cmd/deletions.go — it calls findGmailSource and sets up OAuth unconditionally, never routing to the IMAP client

This appears to be a small wiring change rather than a fundamental limitation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions