Skip to content

feat(email-core): add bcc to create_draft and update_draft - #215

Merged
stevenobiajulu merged 1 commit into
mainfrom
feat/draft-bcc
Oct 15, 2026
Merged

stevenobiajulu merged 1 commit into
mainfrom
feat/draft-bcc

Conversation

@stevenobiajulu

Copy link
Copy Markdown
Member

Closes #214.

What

create_draft and update_draft now accept bcc: string[] (bare or name-address form), on new drafts and on the reply path. Microsoft Graph writes bccRecipients; Gmail writes a Bcc header. bcc is also a recognized body-file frontmatter key. Providers, ComposeMessage/ReplyOptions, the draft preview, and the send_draft allowlist gate already carried bcc, so most of this is the input surface.

Behavior choices worth reviewing

  • Reply path: Bcc wins over derived To/Cc. The motivating case is "moving you to bcc" on a reply-all. Without this, Graph's createReplyAll (and Gmail's derived recipients) would keep the introducer on To/Cc and add them to Bcc, so they'd stay visible. Both providers now remove Bcc addresses (case-insensitive) from the To/Cc they derive. Gmail omits the To: header if that empties it. Graph only patches toRecipients/ccRecipients when something actually has to come off, so the no-bcc path sends the same PATCH as before.
  • Explicit conflict is rejected. The same address on bcc and to/cc in one call returns BCC_RECIPIENT_CONFLICT (recoverable).
  • update_draft read-back warning. update_draft with only bcc can't see the draft's existing To/Cc. If the persisted preview still shows a Bcc address on To/Cc, the response carries a BCC_RECIPIENT_ALSO_VISIBLE warning. bcc replaces the Bcc line, [] clears it, and omitting it keeps it.
  • send_email refuses bcc frontmatter (BCC_NOT_SUPPORTED). It shares resolveComposeFields, has no bcc input, and its allowlist covers only to/cc. Without the refusal, a body file meant for create_draft would send with no Bcc and no error.
  • Allowlist unchanged. Drafts stay allowlist-exempt. send_draft already gates stored To/Cc/Bcc. New tests cover bcc set through both create_draft and update_draft being blocked at send time.

Tests

  • Core (draft.test.ts, new Draft Bcc Recipients (issue #214) block): new draft, omitted bcc, reply-all move-to-bcc, derived-recipient removal, conflict, invalid address, frontmatter, the send_email refusal, update set/keep/clear, the visibility warning, and the send_draft allowlist for both create and update paths.
  • frontmatter.test.ts: bcc list and single-value parsing.
  • Gmail: Bcc header emitted and removed from derived To/Cc; empty To omitted.
  • Graph: derived To/Cc filtering, Cc cleared to [] when needed, explicit to + bcc keeps the displaced participant off Cc.

npm run build, npm run lint, the full workspace test:run (all green), check:spec-coverage (290/290), and openspec validate add-draft-bcc --strict all pass.

OpenSpec change: openspec/changes/add-draft-bcc.

Not done

No live real-mailbox smoke yet. This touches both providers' reply-draft recipient handling, so it's worth creating a reply-all draft with bcc against a real Graph and Gmail mailbox (draft only, no send) and checking it in the client before release.

Accept bcc: string[] on create_draft and update_draft (new drafts and the
reply path) and as a body-file frontmatter key. On reply drafts, providers
drop Bcc addresses from the derived To/Cc so a participant can be moved to
Bcc. send_draft keeps gating bcc against the allowlist.

Refs #214
@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.64865% with 1 line in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ackages/provider-gmail/src/email-gmail-provider.ts 87.50% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@stevenobiajulu
stevenobiajulu merged commit 49b7ee2 into main Oct 15, 2026
14 checks passed
@stevenobiajulu
stevenobiajulu deleted the feat/draft-bcc branch October 15, 2026 17:22
stevenobiajulu added a commit that referenced this pull request Oct 16, 2026
Releases #215 (bcc on create_draft and update_draft), which landed on main
after the 0.3.3 tag. Agents run the installed server, not main, so bcc stays
unavailable until this ships.
stevenobiajulu added a commit that referenced this pull request Oct 16, 2026
The change shipped in #215. Archiving folds its Draft Bcc Recipients
requirement into the email-write spec.
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.

create_draft / update_draft: no way to set Bcc recipients

1 participant