Skip to content

feat(tui): open the first busy tab when the picker opens with down - #64972

Merged
jlongster merged 2 commits into
devfrom
tui-down-first-tab
Nov 19, 2026
Merged

jlongster merged 2 commits into
devfrom
tui-down-first-tab

Conversation

@jlongster

Copy link
Copy Markdown
Contributor

Issue for this PR

Follow-up to #64956.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Pressing ↓ (session.child.first) always opened the picker on Subagents, so with only a script or shell running it showed "No active subagents". Clicking the footer pill already opened the first tab with something in it.

Both paths now use one helper, busyTab in routes/session/composer/tabs.ts: Scripts, else Subagents, else Shell (the order the pill already used), falling back to Subagents when nothing is running. A tab passed by a command or plugin still wins. No flag: this is a small change to an existing keybind.

How did you verify your code works?

  • bun run typecheck:tsc in packages/tui
  • bun test --timeout 30000 test/routes/composer-tabs.test.tsx (new busyTab case)
  • oxlint on the touched files
  • A drive TUI recording: with one background script and two shells, ↓ now opens Scripts directly

Screenshots / recordings

Drive recording made locally.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

User decisions:
- Pressing down opens the first picker tab that has something in it

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as described. With only a background shell running, ↓ now opens the picker on Shell instead of Subagents' "No active subagents". I checked this with an opencode-drive run on the base and on this PR, using a session-owned shell started through the SDK. The composer-tabs test and tsc -b in packages/tui pass.

Public API: unchanged. This is TUI-internal; the keybind and the plugin dispatch argument behave as before.

One small maintainability point inline: only the tab order is shared, so the busy checks are still written twice.

Before

After

item.delivery === "queue" ? [{ id: item.id, text: item.payload.text, payload: item.payload }] : [],
),
)
const openingTab = () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This re-derives the footer's scripts/subagents/shells checks from feature-plugins/prompt/footer.tsx, so only the tab order is shared between ↓ and the pill. If either copy changes (for example, how subagent jobs or shells are counted), the two paths will open different tabs again. Could the busy flags come from one shared helper, maybe next to busyTab, that both places call?

User decisions:
- Address the review on the down-key PR

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commit fixes the earlier point: the footer and ↓ now both use busyCounts, so the pill and the picker can't drift apart. I re-ran the drive check on the new head: with only a background shell running, ↓ still opens Shell. The composer-tabs test and tsc -b in packages/tui pass. Public API: unchanged. No new concerns.

Before

After

@jlongster
jlongster merged commit 5051718 into dev Nov 19, 2026
10 checks passed
@jlongster
jlongster deleted the tui-down-first-tab branch November 19, 2026 20:43
@amrkmn amrkmn mentioned this pull request Nov 23, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant