Skip to content

Add verified Gmail drafts and agent-guided self-hosted OAuth setup - #1

Open
soleil-colza wants to merge 3 commits into
mainfrom
codex/gmail-raw-drafts
Open

soleil-colza wants to merge 3 commits into
mainfrom
codex/gmail-raw-drafts

Conversation

@soleil-colza

@soleil-colza soleil-colza commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Some Gmail connectors strip tracking images from HTML input, so a successful draft creation is not proof that the pixel was saved. Add a draft-only TypeScript CLI that registers the message, embeds its pixel in raw MIME, creates the Gmail draft directly, and verifies the saved HTML. Human review and Send stay in Gmail.

The supported self-hosted setup uses the owner's Google Cloud project and Desktop OAuth client, Google's official OAuth SDK with PKCE/state, and OS credential storage. Google credentials stay local. English/Japanese agent setup guides and cf/Wrangler prompts cover project creation, consent, safe credential handling, recovery, testing, quotas, and costs without enabling GCP billing or paid services. A compatible existing MIME-capable Gmail connector remains an optional shortcut that avoids separate OAuth setup.

The CLI has no send command. It retains operation journals and draft IDs to avoid blindly repeating uncertain Gmail writes. Worker behavior, APIs and SQL schema are unchanged. Standard CLI drafts are unarmed until human send confirmation; immediate tracking is an explicit option with owner-preview risks. Native Gmail compose insertion and automatic Sent detection are not implemented, and future Managed hosting alone would not provide them. Architecture notes distinguish a future Sent watcher from a Workspace-specific SMTP gateway.

Validation:

  • 56 automated tests passed (28 Worker, 28 Node), strict type checks and formatting passed, and cf/Wrangler dry runs plus bundle/binding parity passed before the documentation-only follow-up.
  • Real CLI trial: Desktop OAuth, macOS Keychain persistence/refresh, and two saved raw drafts passed. After human sending and arming, separate recipient Gmail Web/iOS trials each added one eligible event and a matching signature-verified webhook (HTTP 204).
  • Existing Codex Gmail connector: an unsent draft created with text/html and base64_url_content preserved the exact HTML including the pixel in Gmail raw read-back. That separate connector trial did not verify sending or recipient opens.
  • Documentation follow-up: repository-wide Prettier check, Git whitespace checks, and all 109 local links/heading anchors across the nine changed documents passed. Google quota/pricing and OAuth lifecycle claims link to official sources.

Limits: proxy caches, MPP and sender views still prevent reliable human-read attribution. The gmail.compose grant includes send permission even though the CLI cannot send. Windows/Linux credential stores and a public managed OAuth application have not been verified in live trials.

@soleil-colza soleil-colza changed the title Add Gmail raw-MIME draft CLI with secure OAuth Add verified Gmail connector workflows and optional raw-MIME CLI Oct 16, 2026
@soleil-colza soleil-colza changed the title Add verified Gmail connector workflows and optional raw-MIME CLI Add verified Gmail drafts and agent-guided self-hosted OAuth setup Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant