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
- Add an IMAP account (e.g. iCloud Mail via
add-imap)
- Stage messages for deletion (via TUI or MCP
stage_deletion tool)
- Run
msgvault delete-staged <batch-id> --yes
- 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.
Summary
delete-stagedfails for IMAP accounts withError: OAuth client secrets not configured, because the CLI command only creates Gmail API clients. However, the IMAP client already implements the fullgmail.APIdeletion interface (TrashMessage,DeleteMessage,BatchDeleteMessageswith per-message fallback).Steps to reproduce
add-imap)stage_deletiontool)msgvault delete-staged <batch-id> --yesWhat I'd expect
delete-stagedshould detect the account type and instantiate an IMAP client (using stored credentials) instead of always assuming Gmail OAuth.Analysis
internal/imap/client.goalready implementsTrashMessage(IMAP MOVE),DeleteMessage(UID STORE \Deleted + UID EXPUNGE), andBatchDeleteMessages(graceful fallback to per-message delete)internal/deletion/executor.goaccepts anygmail.APIinterface, which the IMAP client satisfiescmd/msgvault/cmd/deletions.go— it callsfindGmailSourceand sets up OAuth unconditionally, never routing to the IMAP clientThis appears to be a small wiring change rather than a fundamental limitation.