Skip to content

fix(site): keep the family message envelope out of copy, edit, history, and queued preview - #426

Merged
ibetitsmike merged 8 commits into
mainfrom
mike/issue-421-family-envelope-leaks
Nov 23, 2026
Merged

ibetitsmike merged 8 commits into
mainfrom
mike/issue-421-family-envelope-leaks

Conversation

@ibetitsmike

Copy link
Copy Markdown
Owner

Coder Agents opened this PR on behalf of @ibetitsmike.

Closes #421.

A delivered family message is a user message whose text the server wraps in an <agent-message> envelope. Only ForkFamilyMessageHeader.tsx stripped it for display; four other surfaces used the raw envelope. This change routes each of them through the existing parseFamilyMessage helper in forkFamilyMessage.ts (fork code, fork-family-messages experiment). A new getFamilyMessageBody helper in the same fork module reads the body from a message's first text part, so no surface adds its own regex.

Changes:

  • Copy: deriveMessageDisplayState sets copyText to the envelope body for a user message whose text is an envelope.
  • Edit: getEditableContentPayload returns the envelope body as the draft text, so editing and saving a family message no longer resends the envelope. An async answer is never an envelope, so the async-answer path is unchanged.
  • Prompt history: decision, family messages are skipped from history entirely rather than stripped. They were not typed by the user, and cycling one into the composer would let the envelope be sent again as a user message. This matches the existing skip for async answers.
  • Queued preview: getQueuedMessageInfo strips the envelope when the first text part holds one, so the preview shows the body's first line instead of the envelope's. A new FamilyMessage story in QueuedMessagesList.stories.tsx covers that visual state.
  • All four surfaces are ungated: envelopes exist only when the experiment is on, and parseFamilyMessage returns undefined for ordinary text, so behavior is unchanged without the experiment.

Known limit kept from #247: the deliberate loss of framing when resending a family message body from edit or history is intended; the body is the message.

Not exercised: this PR touches no Go code and no database queries; coderd/database/queries/chats.sql is unchanged, as the issue requires.

Pre-commit hook

Pre-commit hook disabled for this branch with git config --worktree coder.pre-commit false (worktree-local only), following #407. Checks run instead, all on the head commit:

  • pnpm exec vitest run --project unit on the five touched test files: 200 passed.
  • pnpm lint:types (tsc): clean.
  • pnpm check (biome check, error on warnings): clean.
  • pnpm format (biome format): no fixes applied.
  • pnpm lint fails with 2 pre-existing React Compiler diagnostics on ForkAgentMentionMenu.tsx and ForkHtmlAttachmentViewer.tsx; both reproduce on a clean origin/main checkout, so they are not from this diff.
  • Storybook story tests for QueuedMessagesList.stories.tsx and ForkFamilyMessageHeader.stories.tsx: 28 passed.

Negative controls

Each new test was shown to fail with its production fix reverted, then the fix was restored:

  • Copy: AssertionError: expected '<agent-message from_chat_id="5f8b6a52...' to be 'The tests pass, so the **API review**...'.
  • Edit: AssertionError: expected { ... } to deeply equal { ... } on the payload text.
  • Prompt history: AssertionError: expected '<agent-message from_chat_id="5f8b6a52...' to be 'Build the settings page'.
  • Queued preview: AssertionError: expected [ { type: 'text', ... } ] to deeply equal [ { type: 'text', ... } ] on the preview part.

Test evidence

Commands and results, run in site/:

  • pnpm exec vitest run --project unit src/pages/AgentsPage/components/QueuedMessagesList.test.tsx src/pages/AgentsPage/components/ChatConversation/messageHelpers.test.ts src/pages/AgentsPage/components/ChatConversation/messageParsing.test.ts src/pages/AgentsPage/components/ChatPageContent.test.tsx: 189 passed.
  • Same plus src/pages/AgentsPage/components/ChatElements/tools/forkFamilyMessage.test.ts: 200 passed.
  • pnpm exec vitest run --project=storybook src/pages/AgentsPage/components/QueuedMessagesList.stories.tsx src/pages/AgentsPage/components/ChatConversation/ForkFamilyMessageHeader.stories.tsx: 28 passed.

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.
@codex review

@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T05:29:24.039095Z 6c3a23d Manual request
ℹ️ 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: c38e4bba67

ℹ️ 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".

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.
@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 83870dd4c4

ℹ️ 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".

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

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

ℹ️ 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".

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

@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: 6152cb4c51

ℹ️ 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".

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 1923c295f5

ℹ️ 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".

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 6c3a23de79

ℹ️ 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".

@ibetitsmike
ibetitsmike merged commit d191dbb into main Nov 23, 2026
9 checks passed
@ibetitsmike
ibetitsmike deleted the mike/issue-421-family-envelope-leaks branch November 23, 2026 06:41
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

Merged at head 6c3a23de79a81e7cb14f3a2691064fca7ce5c07a as d191dbb, on main 3e7b5225dafc433a9e60fd9f91a23f3e4660b525, with the server running that main.

Gates on this exact head:

  1. The head matched the SHA I verified (--match-head-commit).
  2. Every check run passed. fork-ci run 45117752446 passed on this head.
  3. Codex receipt for this head: fix(site): keep the family message envelope out of copy, edit, history, and queued preview #426 (comment) ("Didn't find any major issues", Reviewed commit 6c3a23de79).
  4. No unresolved review thread. The workstream replied to and resolved all 6 earlier threads.
  5. 0 commits behind main.
  6. Test evidence I ran in the PR worktree at df43465f71. Later commits only delete two comments and merge main (docs(codersdk): match ForkChatFamilyCapacity.LiveSubagents comment to the query #429, a Go doc comment and generated docs):
    • pnpm exec vitest run --project unit on messageHelpers.test.ts, messageParsing.test.ts, ChatPageContent.test.tsx and QueuedMessagesList.test.tsx: 4 files, 189 tests passed.
    • Negative control: with the envelope parse removed from getQueuedMessageInfo and getEditableContentPayload, "previews a queued family message's body without its envelope" and "edits a family message's body without its envelope" fail. Reverted, and the worktree was clean afterwards.

What this changes: a message that message_family_chat delivered shows and copies its body, not the <agent-message> envelope, in copy, edit and resend, and the queued message preview. Prompt history leaves family messages out, since the user never typed them. Closes #421.

Not exercised: a live browser session on these four surfaces. The unit tests cover each surface's parsing function and the prompt history filter.

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.

site: the family message envelope leaks into copy, edit, prompt history and the queued preview

1 participant