Skip to content

Send a reply as your own address, and keep a draft's sender on update_message - #665

Merged
jeremy merged 4 commits into
mainfrom
adopt-draft-sent-as
Nov 19, 2026
Merged

jeremy merged 4 commits into
mainfrom
adopt-draft-sent-as

Conversation

@jeremy

@jeremy jeremy commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

hey-sdk v0.35.1 answers the identity a draft sends as (DraftSentAs: its
sender, else its creator) and builds a whole revision from an edit state
(DraftContentFromEdit). hey draft edit and send, draft show, and
send_draft's snapshot use them, and the copies here go.

Changes to what gets sent:

  • A reply goes out as the person's own address when HEY names no other
    sender
    , instead of the account's default sender. HEY names a reply's
    sender in the prefill only when it differs from the person's own contact;
    the zero this used to pass left the SDK on the account's default sender,
    which need not be that address. A reply now takes the prefill's sender,
    else its creator (ReplySentAs).
  • hey mcp's update_message with no acting_sender_id now keeps the
    draft's sender
    instead of moving it to the account address. HEY revises
    a draft from the whole request and drops the sender from one without
    acting_sender_id, so an update used to move a draft saved from a shared
    or alternate address to the account's own. An update that leaves it out
    now gets the identity the draft was saved as, read from its edit state;
    when that can't be read, or the edit page HEY answers isn't the draft's own (a sent or deleted draft redirects to the Imbox), nothing is changed. A sender the caller chose is
    kept, and describe's update_message schema no longer requires
    acting_sender_id (create_message and create_reply still do).

Pins github.com/basecamp/hey-sdk/go to v0.35.1; the Nix vendorHash follows
go.sum. The vendored MCP model is already from v0.35.1's commit.

Changelog: Replies go out from your own address when HEY names no other
sender, rather than the account's default sender; hey mcp update_message
keeps a draft's sender when no acting_sender_id is given.

…essage

hey-sdk v0.35.1 answers the identity a draft sends as (DraftSentAs: its
sender, else its creator) and builds a whole revision from an edit state
(DraftContentFromEdit). hey draft edit and send, draft show, and send_draft's
snapshot use them, and the copies here go.

A reply now goes out as the prefill's sender, else its creator (ReplySentAs):
HEY names a reply's sender only when it differs from the person's own
contact, and the zero this used to pass left the SDK on the account's default
sender, which need not be that address.

hey mcp's update_message passed the caller's params straight to HEY, which
revises a draft from the whole request and drops a draft's sender from one
without acting_sender_id, moving a draft saved from a shared or alternate
address to the account's own. An update that leaves it out now gets the
identity the draft was saved as, read from its edit state; when that can't be
read, nothing is changed. A sender the caller chose is kept.
The draft-sender helpers this branch adopts shipped in hey-sdk go/v0.35.1;
go.mod takes the tag in place of its pre-release commit, the vendored MCP
model's provenance names the tag it was synced from, and the Nix vendorHash
follows go.sum.
@jeremy
jeremy requested a review from a team as a code owner November 19, 2026 04:20
Copilot AI balanced review requested due to automatic review settings November 19, 2026 04:20

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.

🔵 Needs a closer look

Live verification against an authorized HEY server is still needed to confirm actual From selection and persisted MCP draft sender preservation, which mocked tests and existing smoke cases do not establish.

No open issues 🎉

What changed in this PR

This PR corrects sender selection for replies and MCP draft updates, using shared SDK helpers to keep identity handling consistent across the CLI and MCP server.

Changes:

  • Use the reply creator’s address when HEY supplies no explicit sender.
  • Preserve a draft’s saved sender during MCP updates unless explicitly overridden; refuse the update if that identity cannot be read.
  • Adopt SDK draft helpers, add regression coverage, and update dependency metadata.

[!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
nix/​package.nix Updates the dependency vendor hash.
internal/​mcpserver/​send.go Uses the SDK sender helper for draft snapshots.
internal/​mcpserver/​param_contract_test.go Accommodates the sender lookup in parameter tests.
internal/​mcpserver/​model/​PROVENANCE.json Records SDK v0.35.1 model provenance.
internal/​mcpserver/​model/​openapi.json Clarifies that scheduling dates and hours use UTC.
internal/​mcpserver/​drafts.go Preserves saved senders and documents update behavior.
internal/​mcpserver/​drafts_test.go Covers sender preservation, overrides, and lookup failures.
internal/​mcpserver/​dispatch.go Applies sender preservation before draft updates.
internal/​mail/​reply_prefill.go Resolves reply identity through the SDK helper.
internal/​mail/​reply_prefill_test.go Tests creator fallback when no sender is supplied.
internal/​cmd/​thread_reply.go Updates comments describing reply sender fallback.
internal/​cmd/​draft.go Replaces local draft conversion logic with SDK helpers.
go.sum Updates SDK dependency checksums.
go.mod Pins the HEY SDK to v0.35.1.

Review effort: Balanced

HEY answers the edit page of a sent or deleted draft by redirecting to the
Imbox, and the client follows it, so update_message could read a sender or
creator off a page that isn't the draft and revise with it. The identity is
now taken only from an answer that is the draft's own; anything else is
refused with nothing changed, as an unreadable one is.

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.

🔵 Needs a closer look

The update_message schema still requires acting_sender_id, forcing schema-following callers to choose a sender rather than omit it to preserve the saved one.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Make acting_sender_id optional for message updates

internal/​mcpserver/​drafts.go:241

The schema returned by describe update_message still requires acting_sender_id: UpdateMessage uses CreateMessageRequestContent, and draftBody preserves its required list. Schema-following callers must therefore choose a sender instead of omitting it to preserve the saved one. Remove this requirement for UpdateMessage only, keep it for creation operations, and assert that distinction in the describe-contract test.

Review effort: Balanced

The model gives UpdateMessage CreateMessage's body, which requires
acting_sender_id, so describe told a caller following the schema to choose a
sender, and the update that keeps the draft's own was one it would never
send. update_message's body no longer requires it; create_message and
create_reply still do.
@jeremy

jeremy commented Nov 19, 2026

Copy link
Copy Markdown
Member Author

Fixed — the review's finding that describe still required acting_sender_id for update_message: the model gives UpdateMessage CreateMessage's body, so holdToDrafts now drops acting_sender_id from update_message's required list only, and TestDescribeServesTheDraftOnlyContract asserts update_message doesn't require it while create_message and create_reply still do (01b8b51). basecamp/hey-mcp-server#78 had the same schema and gets the same change.

@jeremy

jeremy commented Nov 19, 2026

Copy link
Copy Markdown
Member Author

Review threads: none open.
Review bodies: 1 finding answered (1 fixed).
Fixed from a review body: update_message's schema required acting_sender_id, now optional for updates only (01b8b51).
Also fixed, carried from basecamp/hey-mcp-server#78's review: the saved sender is read only from the draft's own edit page (12212c4).
Not reported on 01b8b51: Copilot, re-requested once on this PR (it reviewed 12212c4).

@jeremy
jeremy merged commit ece2e2c into main Nov 19, 2026
36 checks passed
@jeremy
jeremy deleted the adopt-draft-sent-as branch November 19, 2026 06:52
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