CL-6594: resolve invited agents into real identities everywhere - #302
Merged
Conversation
…tions Covers the three reported symptoms directly: buildTeamAvatarStack must give every agent participant its own initial and generated color (never a shared fallback), friendlyEventText must name a joined agent by handle (or its address's local part) rather than "An agent joined", and createWorkbenchFromTemplate must invalidate the workbenches query cache once a template's participant agents are invited so a freshly created room never opens holding a stale, pre-invite participant list.
Root cause: createWorkbenchFromTemplate invites a due-diligence template's participant agents (e.g. Scout) after the workbench's own `workbenches` list query has already been fetched, then navigates straight into the new room without invalidating that cache — so the room can open holding a participants list captured before its own second agent finished joining. Every reader of that list (the header's avatar stack, the join-event line, the @mention popover) then treats the missing agent as if it never joined, instead of a name it already has. - createWorkbenchFromTemplate now invalidates the workbenches query once every template participant has been invited, mirroring the in-room "Invite agent" dialog's own refreshWorkbenchLists call. - buildTeamAvatarStack gives each agent its own generatedAvatarStyle fill keyed by address, same as humans already get, instead of one shared CSS accent color for every agent in the stack. - friendlyEventText falls back to the joined agent's address local part instead of the generic "An agent joined" whenever the roster hasn't caught up with that address yet — the generic noun hides a name the join event already carries.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes CL-6594: in a Due Diligence workbench (Myra + Scout), the header showed two "M" avatars with no Scout, the timeline read "An agent joined" instead of naming Scout, and
@scoutnever appeared in the mention list — even though the workbench'schat/participantssetting held both agents correctly in Postgres the whole time.Root cause, confirmed live:
createWorkbenchFromTemplate(apps/web/src/instant-agent-create.ts) invites a template's participant agents (Scout) after the client'sworkbencheslist query has already been fetched, then navigates straight into the new room without invalidating that cache. The room can open holding aparticipantsarray captured before its own second agent finished joining — and every reader of that array (header avatar stack, join-event line, mention popover) then treats the missing agent as if it never joined at all, instead of a name it already has.createWorkbenchFromTemplatenow invalidates theworkbenchesquery once every template participant has been invited, mirroring the in-room "Invite agent" dialog's ownrefreshWorkbenchListscall.buildTeamAvatarStack(packages/chat-ui/src/chat-workspace.tsx) gives each agent its owngeneratedAvatarStylefill keyed by address — reusing the CL-6570 avatar-identity machinery — instead of one shared CSS accent color for every agent in the header stack.friendlyEventText(packages/chat-ui/src/timeline.tsx) falls back to the joined agent's address local part instead of the generic "An agent joined" whenever the roster hasn't caught up with that address yet — belt-and-suspenders so a future staleness gap never hides a name the join event already carries.Test plan
WORKBENCH_CHECK_SINCE=origin/main bun run typecheck— cleanWORKBENCH_CHECK_SINCE=origin/main bun run test— clean (683 chat-ui tests, 19 apps/web tests, all passing including new coverage)bun run lint— clean (0 errors)bun run check:browser-safe-subpaths— cleandana.reyes@example.comand confirmed all three symptoms exactly as reported — header showed "MM", timeline showed "An agent joined" right under Myra's Scout-naming greeting, and typing@in the composer offered only Myra. Cross-checked against Postgres (chat.workbench_settings) and confirmed bothmyraandscoutwere already present inchat/participantsat that moment — confirming this is a client staleness bug, not a data bug, exactly as the issue described.cl-e2e-maincheckout or provisioning a separate local stack (consistent with tonight's "don't touch shared checkouts" caution). Recommend re-running the same repro against this branch once merged to a scratch environment.