Skip to content

A local reply leaves out the people the answered message blind copied - #609

Merged
jeremy merged 3 commits into
mainfrom
reply-fallback-leaves-out-bcc
Nov 1, 2026
Merged

jeremy merged 3 commits into
mainfrom
reply-fallback-leaves-out-bcc

Conversation

@jeremy

@jeremy jeremy commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Context

When hey reply or the TUI composer cannot get HEY's own reply prefill (it is unavailable or comes back empty), they work out the recipients locally. That local answer copied the answered message's Bcc'd people onto the reply, so a follow-up could reach someone who was blind copied "this once" without the others seeing. HEY stopped doing this in basecamp/haystack#9169, and every HEY client is meant to behave the same way (Jeremy's decision).

Change

  • Both local fallbacks (recipientsForReplyAddressed in internal/cmd/thread_reply.go, recipientsForReplyTo in internal/tui/compose.go) leave the Bcc'd people off a reply.
  • The one exception is haystack's: when Bcc is the whole audience ("To: me, Bcc: the list", or a message only blind copied people received), they stay, in Bcc.
  • Limit: the fallback does not know who is replying, so it treats the message's sender as the replier. A Bcc-only message written by someone else keeps its Bcc here, where HEY drops it. The primary path, the server prefill, is exact and unchanged.

Verification

  • New cases cover the plain drop and both whole-audience keeps. On the old code the two drop cases fail (the keeps pin existing behaviour).
  • make test and make lint pass.

Alternatives

  • Look up the signed-in user's addresses to know the replier exactly: more calls on a path that is already a fallback, and the server prefill covers it. Left out.
  • Drop Bcc always in the fallback: would send a reply to nobody in the whole-audience cases, which HEY keeps addressable.

Follows basecamp/haystack#9169.


Summary by cubic

Stops the local reply fallbacks in hey reply and the TUI composer from carrying the answered message's Bcc'd people onto the reply, matching HEY's behavior from haystack#9169.

  • The shared rule now lives in mail.ReplyRecipientsFor; both callers delegate to it instead of reimplementing HEY's logic in internal/cmd and internal/tui.
  • Bcc'd people stay off unless they are the whole audience ("To: me, Bcc: the list" or a Bcc-only message), in which case they remain in Bcc.
  • The fallback can't know who is replying, so it treats the sender as the replier; a Bcc-only message by someone else keeps its Bcc where HEY drops it, while the server prefill stays exact.
  • The CLI help and manual now say said the fallback leaves out blind copied people unless they are the only audience left.

Written for commit 6c8f3bd. Summary will update on new commits.

View guided diff Turn on auto-fix

When HEY's prefill is unavailable or empty, hey reply and the TUI composer
fall back to working out recipients locally, and they carried the answered
message's Bcc over to the reply. HEY stopped doing that in
basecamp/haystack#9169, so a follow-up could reach someone who was blind
copied "this once" without anyone seeing it.

The fallbacks now leave the Bcc'd people off. They keep them, in Bcc, only
when nobody else is left to address: the message went to the sender alone
("To: me, Bcc: the list") or only to blind copied people.

The fallback cannot know who is replying, so it treats the sender as the
replier. A Bcc-only message written by someone else therefore keeps its
Bcc here, where HEY would drop it; the server prefill, the primary path,
has the exact answer.

Verified: new cases for the plain drop and both whole-audience keeps fail on
the old code (the keeps pin existing behaviour); make test and make lint
pass.
@jeremy
jeremy marked this pull request as ready for review November 1, 2026 04:34
Copilot AI balanced review requested due to automatic review settings November 1, 2026 04:34
@jeremy
jeremy requested a review from a team as a code owner November 1, 2026 04:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T04:39:27.040361Z fc6d623 New commits
🔒 Security Review ✅ Completed 2026-11-01T04:39:52.849927Z fc6d623 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 61659df87d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cmd/thread_reply.go Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The reply help, agent notes, and CLI manual still promise replies to all original recipients without explaining the fallback’s Bcc exclusion, whole-audience exception, or sender-as-replier limitation.

1 open issue
What changed in this PR

Updates local reply recipient selection in the CLI and TUI to omit previously blind-copied recipients, while preserving them when they are the whole audience. Server-provided reply prefills remain unchanged.

Changes:

  • Apply the Bcc exclusion and whole-audience exception in both local fallbacks.
  • Document the fallback’s sender-as-replier assumption in code comments.
  • Add regression cases for ordinary replies and both whole-audience exceptions.

[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

File Description
internal/​tui/​compose.go Applies the Bcc rule to TUI reply fallback recipients.
internal/​tui/​compose_test.go Tests Bcc exclusion and whole-audience retention.
internal/​cmd/​thread_reply.go Applies the Bcc rule to CLI reply fallback recipients.
internal/​cmd/​thread_reply_test.go Tests ordinary replies and both Bcc retention exceptions.

Review effort: Balanced

Comment thread internal/cmd/thread_reply.go Resolved
…for the CLI and the TUI

Review finding (Codex, P1): the Bcc exclusion rule and its helpers were
written twice, in internal/cmd and internal/tui, and AGENTS.md says to
extend internal/mail rather than reimplement HEY's rules in a caller.

mail.ReplyRecipientsFor now holds recipientsForReplyTo, keepsBlindCopied
and addressesOf; both callers delegate to it. Behaviour is unchanged.

Verified with make test and make lint, the existing CLI and TUI cases
unchanged, plus a mail-level test of both Bcc outcomes.

Rejected: leaving two copies in step by a comment, which is the drift the
finding names.
Review finding (Copilot): the help, agent notes and CLI manual promised a
reply to everyone the entry addressed, but the fallback now leaves out the
people the message blind copied.

The help and docs/cli.md now say the fallback drops blind copied people
unless they are everyone left to address, and that it takes the sender as
the replier. The agent notes describe HEY's prefill, which is unchanged.

Verified with make test and make lint.

Rejected: editing the agent notes, whose sentence is about HEY's prefill.
@github-actions github-actions Bot added the docs label Nov 1, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed against the latest diff

Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread internal/mail/reply_recipients.go Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 8 files

View guided diff | Turn on auto-fix | Re-trigger cubic

@jeremy

jeremy commented Nov 1, 2026

Copy link
Copy Markdown
Member Author

Summary at 6c8f3bd. Codex P1 (duplicated rule): fixed, now mail.ReplyRecipientsFor. Copilot (help/docs): fixed. Cubic P1 (a Bcc recipient replying reaches other Bcc people in the all-Bcc case): declined with reasoning in its thread; the fallback cannot know the replier, and this is narrower than before the PR. Codex and Copilot reported on 61659df and were not re-requested; the follow-up commits only apply their findings. Merging by rebase because the repository disallows merge commits.

@jeremy
jeremy merged commit 505948d into main Nov 1, 2026
25 checks passed
@jeremy
jeremy deleted the reply-fallback-leaves-out-bcc branch November 1, 2026 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants