Repository navigation
feat: improve diff comment composer agent picker legibility (#5189) - #5190
Closed
github-actions[bot] wants to merge 1 commit into
Closed
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
|
Ready to review this PR? Stage has broken it down into 2 individual chapters for you:
Chapters generated by Stage for commit de5cf4b on Jun 8, 2026 6:11pm UTC. |
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.
What
Addresses part of #5189 — making it clearer which terminal session a diff comment will be sent to.
The picker (
AgentPickerSelect) and the closedSelectTriggerhistorically rendered each existing session asagentId · terminalId[0:6](e.g.claude · a1b2c3). Two problems the issue calls out:agentIdis generic — multiple sessions running the same agent all read asclaude/codex, so the headline doesn't disambiguate them.terminalId.slice(0, 6)is an opaque hash —a1b2c3maps to nothing the user sees elsewhere.Scope of this PR (option 4 from the issue)
This implements the same-agent disambiguation piece, which is fully self-contained and unit-testable today. When more than one live session shares an agent, the picker now appends a stable, human-countable ordinal —
claude #1,claude #2(ordered most-recent-first, matching the composer's existing sort) — to both the dropdown option and the closed trigger. The short id is kept as a secondary hint. Single-session agents are unchanged (no#1noise).The fuller "show the visible tab/pane title" correlation (options 1/2) is intentionally not included here:
TerminalAgentBindingcarries no human-readable title, and resolvingterminalId → tab/panedepends on the desktop tab-state index tracked in #5126 / #5108. This PR is a strict improvement that doesn't block on those.Implementation
buildSessionLabels(sessions)→Map<terminalId, SessionLabel>, plusformatSessionName(label). Pure and deterministic, so option and trigger render identically.AgentPickerSelectconsumes it via a memo and passes the resolved label intoExistingSessionOption.Tests
buildSessionLabels.test.ts(bun:test):claudesessions collapse to one headline),All 6 tests pass;
bun run lintclean; desktop typecheck shows no new errors.Refs #5189
Summary by cubic
Disambiguates same-agent terminal sessions in the diff comment composer by adding a stable ordinal to session names in the agent picker and trigger (e.g., "claude #1", "claude #2"). Addresses #5189; the 6-char short id stays as a hint, and single-session agents show no ordinal.
buildSessionLabelsandformatSessionNameutilities and wire them intoAgentPickerSelect; includes tests for ordinals and edge cases.Written for commit de5cf4b. Summary will update on new commits.