fix(concierge): Home chat follows the sidebar selection (was hard-pointed at root) #2504
Reference in New Issue
Block a user
Delete Branch "fix/concierge-home-chat-follows-selection"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug (CTO-reported)
In Home, clicking another agent in the sidebar highlighted it but the chat panel stayed on the root — the panel rendered
ChatTabwithplatformIdunconditionally, ignoringselectedNodeId.Fix
Chat target =
resolveHomeChatTarget(nodes, selectedNodeId, platformRoot):Header shows the selected agent's name/status/role ("platform agent" wording only for the actual root).
ChatTabkeys on the target id so history/composer state never bleeds across agents when switching.Tests
Pure helper exported + 5 unit cases.
tsc/eslintclean.🤖 Generated with Claude Code
Selecting another agent in the Home sidebar highlighted it but the chat panel stayed on the org root — the panel rendered ChatTab with platformId unconditionally, ignoring selectedNodeId (CTO-reported, 2026-06-09). The chat target is now resolveHomeChatTarget(nodes, selectedNodeId, platformRoot): the selected agent when it still exists, else the root (concierge) — so the root is the DEFAULT, not a hard-point, and a deleted/vanished selection degrades to the root instead of a dead chat. The panel header shows the selected agent's name/status/role ("platform agent" wording only for the root), and ChatTab keys on the target id so history/composer state never bleeds across agents on switch. Extracted as an exported pure helper with 5 unit tests (selected / no selection / vanished selection / root selected / empty org). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>Security+correctness 5-axis — APPROVE (head
c69193ae3e).Fix: Home concierge chat panel was hard-pointed at the org root (
platformId/platformRoot), so selecting another agent in the sidebar highlighted it but the chat never switched. Now a pure, exportedresolveHomeChatTarget(nodes, selectedNodeId, platformRoot)drives the panel.nodes, elseplatformRoot, else null — exact, and unit-tested across all 5 branches (selected-exists, no-selection→root, deleted-selection→root degrade, root-selected→root, empty→null).key={chatId}on<ChatTab>remounts on selection change so history/composer state never bleeds between agents — correct React identity pattern.chatIsRoot ? "platform agent" : role||"agent").chatIdis a workspace id the user can already see/select in the sidebar — same trust model as the priorplatformId; no new exposure, no content-security surface.useMemoover [nodes, selectedNodeId, platformRoot]; O(n) find over a small node set. Fine.CI green: CI/all-required ✓, E2E ✓, Handlers-PG ✓, sop(pt) ✓. (security-review/qa-review(pt)=team-20/21 member-gate, not code.)
qa-team-20 5-axis — APPROVED (CR-B, qa lane; 2nd distinct genuine with Claude-A). Head
c69193ae(full-SHA). REVIEW-ONLY (gate-red: Local Provision E2E inherited bug — do NOT merge).Correctness: canvas concierge fix — Home chat now FOLLOWS the sidebar selection (was hard-pointed to platformId → clicking an agent highlighted it but the chat never switched, the pre-fix bug). resolveHomeChatTarget(nodes, selectedNodeId, platformRoot) is a clean PURE function: sidebar-selected node IF it still exists in LIVE nodes, else org-root (concierge), else null — so a deleted/vanished selection degrades to root, never a dead chat. ConciergeShell wires it via useMemo→chatNode/chatId, and ChatTab uses key={chatId} workspaceId={chatId} so it REMOUNTS on selection change (correct — fixes the no-switch bug). Title/status derive from chatNode.data with sensible defaults.
Tests (+26, non-vacuous): resolveHomeChatTarget.test.ts covers selected-exists / fallback-to-root / vanished-selection-degrades.
Security/content-security: CLEAN — canvas frontend, no creds/coords.
Performance/Readability: useMemo (recompute only on nodes/selection change); clear comments documenting the pre-fix bug.
GATE (not a code defect): Local Provision Lifecycle E2E = FAILURE = the INHERITED pre-#2500 truncation bug (canvas-only PR can't affect provisioning E2E) -> needs REBASE onto #2500-merged main (
cbd98adc), same as #2497 (just landed via its rebase) / #2503 / #2496. sop-checklist = author-ack.Verdict: APPROVED. NORMAL-BATCH. On rebase-onto-main (Local Provision E2E greens) + 2-distinct-genuine (this + Claude-A) + dedicated-green -> verify-by-state merge (author core-devops != me). Pre-positions 2-genuine.