You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Gmail OAuth path that landed in #415 is great, but it's still IMAP+XOAUTH2 underneath. That means matcha keeps using IMAP's folder/mailbox model when Gmail is fundamentally label-based, depends on the user keeping IMAP enabled (which Workspace admins can disable), and uses IMAP IDLE for push instead of Gmail's native signals. A few open issues read like symptoms of forcing Gmail's data model through IMAP: #1137 (labels), #509 / #638 / #1130 (threading), #1166 (connection pool), #1169 (UIDVALIDITY).
Describe the solution you'd like
A new backend/gmail/ Provider that talks to Gmail's REST API (google.golang.org/api/gmail/v1) and registers as Protocol: gmail alongside the existing imap, jmap, pop3. The shape mirrors backend/jmap/jmap.go exactly: same init() registration, same string-ID-to-uint32 hashing pattern. Reuses the existing OAuth scaffolding in config/oauth.go and oauth_script.py; the Python helper picks up an --api-mode flag that adds the gmail.modify scope for gmail-protocol accounts and leaves IMAP+OAuth accounts on mail.google.com unchanged.
Send goes through users.messages.send with raw RFC 822, so PGP-signed/encrypted mail flows through the existing composition pipeline byte-for-byte. Watch starts as History API polling; Pub/Sub is a follow-up.
This is additive. The IMAP backend is unchanged. Users who keep Protocol: imap see no difference. The split exists because Workspace policies, IMAP-disabled accounts, and the data-model gap are real for some users but not all.
Describe alternatives you've considered
Replacing the IMAP backend's Gmail handling in-place. Larger blast radius, breaks the principle that Protocol selects backend.
Synthesizing IMAP responses from Gmail API calls under the existing backend. Higher implementation cost, no architectural benefit.
Pre-flight question before writing code: would this be welcome as a new backend, or would you rather see this energy go into the existing OAuth-IMAP path (#635 / #782)?
If welcome, I have a phased delivery in mind:
Phase 1 (read-only): list + fetch + search + scope additions. ~300-400 LOC. Lets the architecture be evaluated without committing to send-path correctness.
Phase 3 (watch): History API polling MVP. ~150 LOC. Pub/Sub is its own follow-up.
Affected packages: new backend/gmail/; small additive changes to tui/login.go, config/oauth_script.py, config/config.go; new docs/docs/setup-guides/gmail-native.md. No changes to backend/imap/, backend/jmap/, backend/pop3/, PGP, or the composition pipeline.
Happy to skip this if it conflicts with where you want the OAuth area to go.
Is your feature request related to a problem?
The Gmail OAuth path that landed in #415 is great, but it's still IMAP+XOAUTH2 underneath. That means matcha keeps using IMAP's folder/mailbox model when Gmail is fundamentally label-based, depends on the user keeping IMAP enabled (which Workspace admins can disable), and uses IMAP IDLE for push instead of Gmail's native signals. A few open issues read like symptoms of forcing Gmail's data model through IMAP: #1137 (labels), #509 / #638 / #1130 (threading), #1166 (connection pool), #1169 (UIDVALIDITY).
Describe the solution you'd like
A new
backend/gmail/Provider that talks to Gmail's REST API (google.golang.org/api/gmail/v1) and registers asProtocol: gmailalongside the existingimap,jmap,pop3. The shape mirrorsbackend/jmap/jmap.goexactly: sameinit()registration, same string-ID-to-uint32 hashing pattern. Reuses the existing OAuth scaffolding inconfig/oauth.goandoauth_script.py; the Python helper picks up an--api-modeflag that adds thegmail.modifyscope forgmail-protocol accounts and leaves IMAP+OAuth accounts onmail.google.comunchanged.Send goes through
users.messages.sendwith raw RFC 822, so PGP-signed/encrypted mail flows through the existing composition pipeline byte-for-byte. Watch starts as History API polling; Pub/Sub is a follow-up.This is additive. The IMAP backend is unchanged. Users who keep
Protocol: imapsee no difference. The split exists because Workspace policies, IMAP-disabled accounts, and the data-model gap are real for some users but not all.Describe alternatives you've considered
Additional context
Pre-flight question before writing code: would this be welcome as a new backend, or would you rather see this energy go into the existing OAuth-IMAP path (#635 / #782)?
If welcome, I have a phased delivery in mind:
Affected packages: new
backend/gmail/; small additive changes totui/login.go,config/oauth_script.py,config/config.go; newdocs/docs/setup-guides/gmail-native.md. No changes tobackend/imap/,backend/jmap/,backend/pop3/, PGP, or the composition pipeline.Happy to skip this if it conflicts with where you want the OAuth area to go.