Skip to content

CL-6594: resolve invited agents into real identities everywhere - #302

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-6594-agent-identity
Aug 22, 2026
Merged

CL-6594: resolve invited agents into real identities everywhere#302
TheGreatAxios merged 2 commits into
mainfrom
cl-6594-agent-identity

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

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 @scout never appeared in the mention list — even though the workbench's chat/participants setting 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's workbenches list query has already been fetched, then navigates straight into the new room without invalidating that cache. The room can open holding a participants array 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.

  • 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 (packages/chat-ui/src/chat-workspace.tsx) gives each agent its own generatedAvatarStyle fill 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 — clean
  • WORKBENCH_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 — clean
  • Live repro on the shared :3000 verify stack before the fix: created a fresh "Research & due diligence" workbench as dana.reyes@example.com and 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 both myra and scout were already present in chat/participants at that moment — confirming this is a client staleness bug, not a data bug, exactly as the issue described.
  • Live post-fix re-verification against the shared :3000 stack — blocked by the permission system from writing to the shared cl-e2e-main checkout 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.

…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.
@TheGreatAxios
TheGreatAxios merged commit 57dfd3f into main Aug 22, 2026
5 checks passed
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.

1 participant