feat: use Claude session name for the agent label - #367
Open
neruad wants to merge 1 commit into
Open
Conversation
The agent label's secondary line now shows the Claude session name (e.g.
"pixel-agents-1a") when it can be resolved, falling back to the workspace
folder name as before. folderName is left intact because it also keys the
Areas folder->seat mapping and must not be overloaded.
Resolution reads Claude's per-session registry
(~/.claude/sessions/<pid>.json -> { sessionId, name }) via a new optional
HookProvider.getSessionName, kept behind the provider boundary. The runtime
re-resolves every few seconds and broadcasts a new agentSessionNameChanged
message so late-named sessions and live renames surface without a reload;
teammates are skipped since they share the lead's session id.
Protocol (core/asyncapi.yaml): new agentSessionNameChanged ServerMessage,
optional sessionName on AgentCreated, and a sessionNames map on
ExistingAgents. messages.ts is regenerated from the contract.
Tests: server unit tests for the refresh/broadcast (including the teammate
skip); an e2e spec seeding the session registry and asserting the label
resolves via the getAgentSeats hook.
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.
Description
The agent label's secondary line now shows the Claude session name (e.g.
pixel-agents-1a) when it can be resolved, falling back to the workspace folder name as before.folderNameis deliberately left intact: it also keys the Areas folder→seat mapping (findFreeSeat/areaMappings), so it can't be overloaded with the session name. A separatesessionNamefield carries the title.How it works
~/.claude/sessions/<pid>.json({ sessionId, name, ... }), read via a new optionalHookProvider.getSessionName(sessionId). All Claude specifics stay behind the provider boundary; a short-lived cache reuses one directory scan across agents.AgentRuntimere-resolves names on a periodic timer (a few seconds) and broadcasts a newagentSessionNameChangedmessage, so sessions that get named after they start — and live/rename— surface without a reload. Teammates are skipped (they share the lead's session id).sessionNameoverfolderNameinToolOverlay.Type of change
The protocol change is additive/optional (new message + optional fields), so existing clients keep working.
Protocol contract
core/asyncapi.yaml(single source of truth) gains:agentSessionNameChangedServerMessage,sessionNameonAgentCreated,sessionNamesmap onExistingAgents.core/src/messages.tsis regenerated from the contract (npm run asyncapi:generate); the CI drift check passes.Screenshots / GIFs
No screenshot attached — the change is a text swap on the existing overlay's secondary line (session name in place of folder name); no new UI surface or layout change. Verified by manual smoke in the Extension Development Host.
Test plan
npm run check-types— cleannpm run lint— clean (only the pre-existingApp.tsxexhaustive-deps warning)npm run test:server— 280/280npm run test:webview— 41/41/rename, watched the label update live to the session name; with no name it falls back to the folder name.E2E coverage
Added
e2e/tests/claude/hooks-on/labels.spec.ts(@area:labels): seeds the session registry for a spawned agent's real session id and asserts the character's resolvedsessionNamevia thegetAgentSeatstest hook. New area documented ine2e/README.md("What this suite covers" + regenerated inventory) and mapped inhelpers/allure-labels.ts.Note: the local VS Code Electron e2e harness would not launch on my machine (a known-good existing spec fails identically at the fixture launch step), so the new spec was verified statically — it mirrors the accepted
getAgentSeats/cast pattern used by the Areas specs — and will run in CI across Linux/macOS/Windows.🤖 Generated with Claude Code