Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

show per-message assistant identity from metadata instead of props - #156

Merged
morgmart merged 6 commits into
mainfrom
agent-name-chat
Apr 12, 2026
Merged

morgmart merged 6 commits into
mainfrom
agent-name-chat

Conversation

@morgmart

@morgmart morgmart commented Apr 12, 2026 •

Copy link
Copy Markdown
Collaborator

Category: improvement
User Impact: Each assistant message now shows the correct provider name and icon for the model that actually generated it, even when switching providers mid-conversation.

Problem: Assistant identity (name, avatar, icon) was passed down as props from the chat view, meaning every message displayed the current agent's identity rather than the identity of the model that actually generated that message. Switching providers mid-conversation would retroactively relabel old messages.

Solution: Identity is now derived per-message from metadata (providerId, personaId) stamped at send time. A pendingAssistantProviderId in the chat runtime captures the provider before the backend confirms the message, ensuring the correct provider is recorded even if the session provider changes between send and message creation. The loading indicator was also simplified from animated icons to a shimmer-based "Thinking..." / "Responding..." status.

Note: Session replay will fallback to providerID at the session level, not per message. Following up with separate PRs for storing per message provider in backend.

File changes

src/shared/types/chat.ts
Added pendingAssistantProviderId to SessionChatRuntime so the provider chosen at send time is available before the backend creates the assistant message.

src/shared/types/messages.ts
Added providerId to MessageMetadata so each message records which provider generated it.

src/features/chat/stores/chatStore.ts
Added setPendingAssistantProvider action to set and clear the pending provider ID on the session runtime.

src/features/chat/hooks/acpStreamTypes.ts
Extracted ACP event payload type definitions from useAcpStream.ts to keep the hook file under the size limit.

src/features/chat/hooks/useAcpStream.ts
Stamps providerId on assistant messages at creation time using the pending provider, with a fallback to the session's provider. Clears the pending provider after message creation and on completion.

src/features/chat/hooks/useChat.ts
Sets pendingAssistantProviderId before sending, and clears it on error, stop, and reset paths.

src/features/chat/ui/ChatView.tsx
Removed agentName and agentAvatarUrl props that were being threaded through to child components. Wrapped the loading indicator in AnimatePresence for smooth enter/exit transitions.

src/features/chat/ui/LoadingGoose.tsx
Replaced animated icon indicators with a shimmer-based status. Simplified from four state-specific copy strings to two ("Thinking..." / "Responding..."). Removed the agentName prop since the indicator is now agent-agnostic. Added proper useReducedMotion support.

src/features/chat/ui/MessageBubble.tsx
Derives assistant identity (name, icon, avatar) from per-message metadata instead of props. Shows the provider icon and display name from the provider catalog, with persona name taking priority when present. Migrated the fallback Bot icon from lucide to @tabler/icons-react.

src/features/chat/ui/MessageTimeline.tsx
Removed agentName and agentAvatarUrl props. Added filtering for empty in-progress assistant shell messages.

src/shared/ui/ai-elements/shimmer.tsx
Added delay, repeatDelay, and tone props to support the loading indicator's softer shimmer variant.

src/shared/i18n/locales/en/chat.json
Replaced four loading state keys with two simplified ones: thinking and responding.

src/shared/i18n/locales/es/chat.json
Updated Spanish translations to match the simplified loading state keys.

scripts/check-file-sizes.mjs
Bumped the test file size limit for useAcpStream.test.ts to accommodate provider identity tests.

src/features/chat/hooks/tests/useAcpStream.test.ts
Added tests verifying that providerId is stamped on created messages and that the pending provider is preserved when the session provider changes before message creation.

src/features/chat/ui/tests/LoadingGoose.test.tsx
New test file covering thinking/responding copy, idle state rendering, with assertions driven from translation JSON.

src/features/chat/ui/tests/MessageBubble.test.tsx
Updated tests to verify provider-based identity rendering, persona name priority, and empty in-progress message handling.

Reproduction Steps

  1. Run just dev to start the app.
  2. Start a chat with any provider (e.g., Claude). Send a message and observe the assistant response shows the provider icon and name (e.g., the Claude icon + "Claude Code").
  3. Switch to a different provider mid-conversation and send another message. Verify the new response shows the new provider's identity, while previous messages retain their original provider identity.
  4. Create an agent with a persona. Chat with it and verify the persona name and avatar take priority over the provider label.
  5. Observe the loading indicator shows "Thinking..." initially, then "Responding..." during streaming — no agent name prefix.
Screenshot 2026-04-11 at 11 37 13 PM

- Introduced `getPendingAssistantProviderId` function to retrieve the current pending assistant provider ID for a session.
- Updated `useAcpStream` and `useChat` hooks to manage and utilize the pending assistant provider ID during message handling.
- Modified message metadata to include `providerId` for better identification of assistant messages.
- Improved tests to validate the correct handling of pending assistant provider changes and message creation.
- Refactored UI components to remove unused agent name and avatar props, streamlining the message display logic.
Replace the Goose-specific loading row with calmer Thinking/Responding shimmer states so progress feels consistent across providers and less visually noisy.
Align the assistant identity row more cleanly with inline provider branding and nudge the user avatar to match the first line of message text.
…r rendering

- Renamed `getPendingAssistantProviderId` to `getAssistantProviderId` for clarity and updated its logic to return the correct provider ID based on session state.
- Added a key to the `LoadingGoose` component for improved rendering consistency.
- Removed unused logic in `MessageBubble` to simplify the component.
- Updated tests to reflect changes in message rendering behavior for in-progress assistant messages.
- Increased file size limit for `useAcpStream.test.ts` to accommodate additional test cases.
- Expanded justification for the test to include provider identity persistence.
- Simplified rendering logic in `LoadingGoose` by removing unnecessary class names.
- Refactored `MessageBubble` component for improved readability and consistency in JSX formatting.
- Updated tests for `LoadingGoose` and `MessageBubble` to reflect changes in rendering behavior.
- Updated test assertions in `MessageBubble.test.tsx` to enhance clarity by using consistent formatting for text queries.
- Ensured that the checks for the presence of "Codex" are more readable and maintainable.
@morgmart
morgmart requested a review from wesbillman as a code owner April 12, 2026 06:26

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

ℹ️ 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 src/features/chat/hooks/useAcpStream.ts
@morgmart
morgmart merged commit ddc8246 into main Apr 12, 2026
8 checks passed
@morgmart
morgmart deleted the agent-name-chat branch April 12, 2026 06:38
lifeizhou-ap added a commit to lifeizhou-ap/goose2 that referenced this pull request Apr 13, 2026
* main:
  show per-message assistant identity from metadata instead of props (block#156)
  add file-aware widgets to context panel, simplify session search (block#154)
  Add i18n and cross-boundary dead data checks to code review skill (block#153)
  search session message content (block#152)
  add workspace widget with git branch and worktree management (block#151)
  fix: strip XML wrapper from replayed user messages (block#150)
  feat: add file @-mention autocomplete with project file scanning (block#147)
  improve sidebar contrast and constrain model picker (block#149)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant