Skip to content

End a new message with the sender's HEY name tag - #425

Open
jeremy wants to merge 3 commits into
mainfrom
fanB-395
Open

End a new message with the sender's HEY name tag#425
jeremy wants to merge 3 commits into
mainfrom
fanB-395

Conversation

@jeremy

@jeremy jeremy commented Sep 9, 2026

Copy link
Copy Markdown
Member

Fixes #395

Repro

hey compose --draft (and a plain hey compose send) posted the body exactly as written, so the draft landed in HEY without the sender's name tag. HEY does not add the tag server-side: MessagesController#new appends it to the body it prefills into the compose form, and #create saves whatever the form submits. A message written in HEY carries the tag because the form did; one written here never had it. Same for a send, which is why this covers both paths rather than the draft alone.

TestComposeEndsANewMessageWithTheSendersNameTag runs compose --draft and compose --to … against a fake HEY whose identity serves a name_tag on the default sender, and fails on main with the body unchanged.

Fix

A new message now ends with the name tag HEY serves for the sender it is filed under (identity.senders[].name_tag, sanitized HTML, the same field the bulk-reply prefill reads), appended after a <br> exactly as HEY's own form does. The sender is the one the SDK resolves for the send (DefaultSenderID, account-scoped or identity-wide), matched by id in the unscoped identity. A sender with no tag leaves the message as written, with no stray break. --no-name-tag leaves it off for callers who sign their own bodies; .surface, docs/cli.md and the skill note it.

Costs one extra GET /identity.json per new message. Replies (hey reply, compose --thread-id) are unchanged — HEY prepends the tag above the quoted body there and serves that prefill from GET /entries/{id}/replies/new.json, which is a separate change. The TUI's compose form is likewise a follow-up.


Summary by cubic

New messages from hey compose — sent or saved with --draft — now end with the HEY name tag of the sender they're filed under, fixing #395. HEY serves the tag in the compose form it prefills rather than on the saved message, so a body written in the CLI went out unsigned; it now carries the tag itself.

Bug Fixes

  • Appends the tag from the identity's senders[].name_tag after a <br>, matched to the sender the message is filed under, which --account selects, and after any attachments so the tag stays last as a signature.
  • --no-name-tag opts out for callers who sign their own bodies; a sender with no tag leaves the message as written.
  • Costs one extra GET /identity.json per new message. Replies and the TUI compose form are unchanged.

Written for commit 30d9a18. Summary will update on new commits.

Review in cubic

HEY applies a name tag in the compose form it prefills, not on the
message it saves, so a draft or a send from hey compose went out without
one while the same message written in HEY would not. A new message now
ends with the name tag HEY serves for the sender it is filed under,
appended after a break the way HEY's own form does; a sender without one
leaves the message as written, and --no-name-tag leaves it off.
@jeremy
jeremy requested a review from a team as a code owner September 9, 2026 23:24
Copilot AI balanced review requested due to automatic review settings September 9, 2026 23:24
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 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-09-09T23:41:24.088787Z 30d9a18 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.

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

Account-scoped sender selection needs a focused regression test.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds HEY sender name tags to new CLI-composed messages, with an opt-out flag.

Changes:

  • Appends the resolved sender’s name tag to sends and drafts.
  • Adds --no-name-tag.
  • Updates tests, CLI documentation, skill guidance, and command surface.

[!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 summaries
File Description
internal/cmd/compose.go Resolves and appends sender name tags.
internal/cmd/compose_test.go Tests default, disabled, and absent tags.
docs/cli.md Documents name-tag behavior and opt-out.
skills/hey/SKILL.md Adds an opt-out usage example.
.surface Records the new flag.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/cmd/compose.go

@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: bbdb91c433

ℹ️ 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/compose.go Outdated
}
if !c.noNameTag {
var tagErr error
if message, tagErr = appendSenderNameTag(ctx, message); tagErr != nil {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Append the name tag after uploaded attachments

When a new message includes --attach, the tag is added here before attachFiles; appendUploadedAttachments then appends <br><action-text-attachment ...> to that content. Consequently the serialized message ends with the attachments rather than the sender’s tag, and an attachment-only message starts with the signature followed by the files. Append the tag after constructing the attachment-bearing content so attached messages preserve the promised signature-at-the-end behavior.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed: a signature is the last thing in a message, and HEY's form puts a dropped file above the prefilled tag. 30d9a18 appends the tag after attachFiles, so both shapes end with the files and then the tag; TestComposeEndsAnAttachedMessageWithTheNameTag pins the order for a message with a body and for an attachment-only one.

A signature comes last, and HEY's form puts a dropped file above the
prefilled tag, so an attached message ended with the files instead.

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.

🟢 Approval recommended

The implementation matches the stated behavior and includes focused coverage for its important paths and edge cases.

Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

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.

hey compose --draft omits the sender’s Name Tag

2 participants