Skip to content

feat: improve diff comment composer agent picker legibility (#5189) - #5190

Closed
github-actions[bot] wants to merge 1 commit into
mainfrom
triage/issue-5189-27157046287
Closed

github-actions[bot] wants to merge 1 commit into
mainfrom
triage/issue-5189-27157046287

Conversation

@github-actions

@github-actions github-actions Bot commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

What

Addresses part of #5189 — making it clearer which terminal session a diff comment will be sent to.

The picker (AgentPickerSelect) and the closed SelectTrigger historically rendered each existing session as agentId · terminalId[0:6] (e.g. claude · a1b2c3). Two problems the issue calls out:

  • agentId is generic — multiple sessions running the same agent all read as claude / codex, so the headline doesn't disambiguate them.
  • terminalId.slice(0, 6) is an opaque hash — a1b2c3 maps 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 #1 noise).

The fuller "show the visible tab/pane title" correlation (options 1/2) is intentionally not included here: TerminalAgentBinding carries no human-readable title, and resolving terminalId → tab/pane depends on the desktop tab-state index tracked in #5126 / #5108. This PR is a strict improvement that doesn't block on those.

Implementation

  • New pure helper buildSessionLabels(sessions) → Map<terminalId, SessionLabel>, plus formatSessionName(label). Pure and deterministic, so option and trigger render identically.
  • AgentPickerSelect consumes it via a memo and passes the resolved label into ExistingSessionOption.

Tests

buildSessionLabels.test.ts (bun:test):

  • documents the reported same-agent ambiguity (two claude sessions collapse to one headline),
  • verifies distinct ordinals are assigned and the resulting names are unique,
  • verifies single-session agents get no ordinal,
  • verifies ordinals are numbered per agent following input (recency) order,
  • verifies the short-id hint and the empty-input case.

All 6 tests pass; bun run lint clean; desktop typecheck shows no new errors.

Refs #5189


Open in Stage

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.

  • New Features
    • Number multiple sessions per agent by recency (most recent = Bump react-dom from 18.3.1 to 19.2.0 #1) and use the same label in the dropdown and closed trigger.
    • Add buildSessionLabels and formatSessionName utilities and wire them into AgentPickerSelect; includes tests for ordinals and edge cases.

Written for commit de5cf4b. Summary will update on new commits.

Review in cubic

@ghost

ghost commented Jun 8, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 2 individual chapters for you:

Title
1 Implement session label generation logic
2 Integrate session labels into AgentPickerSelect
Open in Stage

Chapters generated by Stage for commit de5cf4b on Jun 8, 2026 6:11pm UTC.

@Kitenite Kitenite closed this Jul 11, 2026
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