feat(ui): show sessions_spawn label instead of agentId#28
Draft
JimmyBlanquet wants to merge 1 commit intoWW-AI-Lab:mainfrom
Draft
feat(ui): show sessions_spawn label instead of agentId#28JimmyBlanquet wants to merge 1 commit intoWW-AI-Lab:mainfrom
JimmyBlanquet wants to merge 1 commit intoWW-AI-Lab:mainfrom
Conversation
…play The OpenClaw gateway accepts a 'label' field in sessions_spawn (e.g. 'Analyste de portefeuille') for human-readable session names. Previously the UI ignored this and showed agentId or session UUID, making multi-agent demos hard to follow. This change makes the UI prefer the label, falling back to agentId then sessionKey suffix if absent. Patches: - SessionSwitcher.tsx: use session.label for both the dropdown items and the active session display name (was using session.key only). - ChatPage.tsx: formatSessionTitle now accepts a sessionLabel param and prefers it over the technical session key when present. - useSubAgentPoller.ts: harden label fallback against empty/whitespace labels (existing UUID-based fallback retained for compatibility). - office-store.ts: in processAgentEvent's pending sub-agent path, use the actual agentId as the temporary label (the sessions.list poller later overwrites it with the real label from the gateway). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Make the UI prefer the human-readable
labelfield passed viasessions_spawnover the technicalagentId/sessionKeyUUID. Falls back gracefully if label is missing.The OpenClaw gateway already accepts and stores a
labelfield insessions_spawn(e.g."Analyste de portefeuille") and exposes it viasessions.list. The UI was reading it inchat-dock-store.normalizeSessionand on the chat page list, but a few prominent UI surfaces still showed only the technical session key. This made multi-agent demos hard to follow because every spawned session appeared asagent:main:subagent:5533959a-...instead of its human name.Files changed
src/components/chat/SessionSwitcher.tsx— the dropdown items and the active session display name now usesession.labelfirst via a newformatSessionDisplayhelper. Previously it only calledformatSessionName(session.key).src/components/pages/ChatPage.tsx—formatSessionTitle(used in the chat page header) now accepts asessionLabelarg and prefers it over the agent-name lookup. The single call site passes the active session's label from the sorted list.src/hooks/useSubAgentPoller.ts— hardentoSubAgentInfoListagainst empty/whitespacelabelvalues (s.label?.trim() || ...), keeping the existing fallback chain (Sub-<uuid>→agentId) for backwards compatibility with the test suite.src/store/office-store.ts— inprocessAgentEvent's two pending-sub-agent branches, use the actualagentIdas the temporary label instead ofSub-<8-char slice>. Thesessions.listpoller still overwrites this with the real gateway label as soon as it arrives, but the visible-during-race string is now meaningful.Behavior
sessions_spawnis called withlabel: "Analyste de portefeuille", both the SessionSwitcher dropdown and the chat page header now displayAnalyste de portefeuille…(truncated at 24/32 chars) instead ofsubagent:5533959a-1a5e-….agent:foo:main, formatted suffix otherwise).Test plan
npm run typecheck— passes (no new TS errors)npm test— 475/475 tests pass, including the existinguseSubAgentPollerlabel fallback testsnpm run build— passes (vite buildproduces all expected chunks)sessions_spawnwith a label, observe the SessionSwitcher and chat page header show the labelNotes
src/i18n/locales/(concurrent FR translation work in another branch).useSubAgentPollerwas deliberately kept aslabel → Sub-<uuid> → agentIdrather thanlabel → agentId → Sub-<uuid>because the parent agent'sagentId(e.g."main") shouldn't be displayed as the sub-agent's identity, which an existing test (subagent-poller.test.ts:124) explicitly enforces.🤖 Generated with Claude Code