Skip to content

🪪 fix: Draw a Subagent's Brief as the Dispatching Agent's Turn - #18278

Merged
danny-avila merged 2 commits into
devfrom
danny-avila/child-brief-author
Nov 18, 2026
Merged

danny-avila merged 2 commits into
devfrom
danny-avila/child-brief-author

Conversation

@danny-avila

Copy link
Copy Markdown
Collaborator

Summary

Since #18197 the subagent panel draws a background child's thread as a conversation, with main chat's own message list. A child's first turn is its brief, which the agent that dispatched it wrote. In that list the brief is the thread's user message, so it was drawn as an unlabelled user-side bubble, the way the reader's own messages are drawn. The view it replaced drew the same turn as a briefing from the parent agent, with that agent's name and face. A reader opening a child now sees a message that looks like one they sent and did not.

This draws the brief as the dispatching agent's turn again: the same user-side bubble, under the parent agent's name and avatar.

Related to #18197.

How it works

Main chat's row already has what is needed: MessageRow takes showAuthor, an icon and a label, and the wake-up row uses them to put an author over a user-side turn. What was missing is a way for a list to say that its user-side turns are someone else's.

SubagentThreadPanel
  useParentAuthor(...)                     # the dispatching agent, as the durable view resolves it
  FollowedChildThread   briefAuthor
    FollowedThread      userAuthor
      UserTurnAuthorContext.Provider       # new, beside the existing AuthorContext
        MessagesView → Message → MessageRender
          msg.isCreatedByUser && author    →  <MessageRow icon label showAuthor />

UserTurnAuthorContext is absent everywhere else, so main chat, the added pane and the shared view draw the reader's turns as they did. It applies to plain user-side turns only; a wake-up row keeps its own author.

Type of change

  • Bug fix
  • Tests / tooling / CI

Testing

Tested environments/configuration:

Chromium via Playwright, e2e/playwright.config.mock.ts, server and client built from this branch, in-memory Mongo, fake model, Linux (WSL2).

Automated tests:

  • packages/chat/src/components/subagents/__tests__/followed.spec.tsx (2 new): with a brief author the brief's heading is visible and carries that author's name and icon; without one the turn stays a plain user-side turn.
  • panel.spec.tsx: the panel hands the followed thread the parent author it resolved.
  • Each was run with its half of the change removed and fails.
  • packages/chat: npx jest src/components/subagents src/components/pane src/components/messages (758 tests), npx tsc --noEmit. npm run static-checks -- --against origin/dev.

Manual: opened a running background child in the mock lane; the brief shows the parent agent's name and avatar above the bubble (capture below).

Screenshots / recordings

The brief, drawn as the parent agent's turn

Risk / compatibility

Only a followed child thread sets the new context. A child whose parent author cannot be resolved gets the localized "Parent agent" fallback the durable view already uses.

@danny-avila
danny-avila marked this pull request as ready for review November 18, 2026 11:03
Copilot AI balanced review requested due to automatic review settings November 18, 2026 11:03
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Head 07c7c34.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 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-18T11:56:32.489601Z dee57ad 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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 07c7c3413e

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

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

Restored self-spawn briefs can show the wrong agent name and avatar, while parent-author headings can display and announce the child agent’s model instead of the parent’s name.

2 open issues
What changed in this PR

Restores dispatching-agent attribution for subagent briefs in the conversation-style panel introduced by #18197, while preserving ordinary user-turn rendering elsewhere.

Changes:

  • Adds an optional author context for user-side turns in followed conversations.
  • Passes the parent agent’s name and avatar from the subagent panel to message rows.
  • Adds tests for brief attribution and panel prop wiring.
File Description
packages/​chat/​src/​react/​messages/​author.tsx Defines the optional user-turn author context and hook.
packages/​chat/​src/​components/​subagents/​panel.tsx Supplies parent-agent attribution for followed briefs.
packages/​chat/​src/​components/​subagents/​followed.tsx Forwards the brief author to the followed conversation.
packages/​chat/​src/​components/​subagents/​__tests__/​panel.spec.tsx Checks that the panel passes the resolved author.
packages/​chat/​src/​components/​subagents/​__tests__/​followed.spec.tsx Tests brief rendering with and without attribution.
packages/​chat/​src/​components/​pane/​Followed.tsx Provides author context around the message list.
packages/​chat/​src/​components/​messages/​MessageRender.tsx Displays explicit author headings on plain user-side turns.

Review effort: Balanced

label={authored != null ? authored.label : (messageLabel ?? '')}
showAuthor={authored != null}
hoverLabel={getHeaderHoverLabel(
hasConfiguredSender,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Valid. Fixed in dee57ad: a turn drawn for an explicit author gets no model hover label. The label on offer was the model of the conversation's agent, which for a child thread is the child, so the brief's heading named the parent and revealed the child's model on hover and to screen readers. Pinned in subagents/__tests__/followed.spec.tsx (the brief's heading does not contain the child's model), which fails against the previous code.

threadId={threadId}
followed={followed}
agentId={taskView?.agentId ?? foregroundAgentId}
briefAuthor={briefAuthor}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Valid. Fixed in dee57ad: the brief's author is now the same value the durable view passes as its turn's parent author, childAuthor for a self-spawn that is not an event thread and parentAuthor otherwise. It is computed once (dispatcher) and used by both bodies, so they cannot name the brief differently. Pinned in panel.spec.tsx (a self-spawn's brief is named for the agent it runs as), which fails with the parent author used unconditionally.

@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Head dee57ad.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: dee57adc41

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

@danny-avila
danny-avila merged commit 2a63b30 into dev Nov 18, 2026
59 of 60 checks passed
@danny-avila
danny-avila deleted the danny-avila/child-brief-author branch November 18, 2026 12:18
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.

2 participants