fix(desktop): show launch progress and Codex usage on agent presets

VI
2d ago
+652-30

What & why

Pi and Codex presets wait for the host before showing a new tab. During a slow launch, a second click can start another session and leave two tabs open.

Single-tab presets now open a tab with Starting… as soon as the user clicks. Clicks and shortcuts for the same preset share the pending launch in that workspace.

The Codex preset shows usage for the host's default Codex account. Its context menu lists usage windows and reset times and links to the workspace's usage settings.

How I tested it

Used CDP mouse input in an isolated macOS dev workspace with demo commands for Pi and Codex. I held the terminal creation request and clicked Pi twice. Before the fix, the tab bar stayed empty while two requests were pending, then showed two Pi tabs. After the fix, the first click immediately showed one tab with Starting…. The second click left one request and one tab. The Codex comparison uses a sample weekly quota.

BeforeAfter
No tab during a pending launchOne Pi tab with Starting status
Codex preset menu with script actionsCodex preset menu with usage and reset time
  • bun run lint, bun run typecheck, and bun run check:i18n passed.
  • All 9,129 desktop tests passed. The 51 focused tests also passed after rebasing.
  • bun run test --continue=always completed 29 of 32 tasks. One test in each of agent-setup, port-scanner, and shared also failed when rerun against the same package sources from main.

Codex assisted with implementation and verification.

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (CI fails on lint warnings too)
  • "Allow edits from maintainers" is checked on fork PRs
  • CLA is on file for the commit author

Summary by cubic

Shows launch progress for agent presets so a slow host start no longer leaves two tabs open. The Codex preset now also surfaces the default account's usage.

  • Pi and Codex presets open a tab with Starting… as soon as the user clicks; clicks and shortcuts for the same preset share the pending launch in that workspace.
  • The Codex preset button shows the default account's usage; its context menu lists usage windows and reset times and links to the workspace's usage settings.
  • Codex terminal panes show the usage percentage and a "View usage" context menu item.
  • The user settings query needed to choose chat vs. terminal at launch is now warmed before the first click.

Summary by CodeRabbit

  • New Features
    • Presets can open eligible agent chats, and Codex presets display usage information with a shortcut to usage settings.
    • Preset launches show a starting state and prevent duplicate clicks while in progress.
    • Codex terminal menus now include a “View usage” option, and usage indicators show percentages.
  • Bug Fixes
    • Improved handling of preset launches when tabs or panes change during startup.
    • Chat pane placement can follow the selected layout.