fix(mobile): launch the agent row picked, not the first with its preset

BR
1d ago
+219-41

Why

When a host has two agents with the same preset, such as "Claude (A)" and "Claude (B)" with different env, or any two custom agents, the mobile app can only launch the first one (#9262). The picker saved only the preset, so every launch took the first row with that preset.

What changed

  • The picker keeps the picked row id per host, next to the preset. The preset still carries to other hosts and still keys model and effort.
  • One resolver, selectAgentConfig, picks the row for every launch. It uses the remembered row when it is on this host with the selected preset, and otherwise the preset's first row, as before.
  • The new-chat composer, the workspace new-session sheet, Ask Agent on a pull request, and Finish Review send that row id to the host. The host already resolves a row id before a preset.

Scope

  • Mobile only. No host or API change.
  • Saved preferences from before this change have no row ids, so they keep today's behavior until the user picks again.
  • Analytics events still record the preset.

Blast Radius

Every mobile launch that names a host agent now sends a row id where it sent a preset. When the remembered row is gone or has another preset, it falls back to the preset's first row, which is today's behavior.

Verification

  • A selectAgentConfig test picks the second of two rows that share a preset. It fails on the old first-row rule and passes with the fix. The mobile suite passes (261 tests), and turbo typecheck --filter=@superset/mobile and biome are clean.
  • Not checked in the iOS simulator. That needs a real host-service with two same-preset agents registered against a local API, which this setup did not have.

Fixes #9262


Summary by cubic

Fixes the mobile agent picker so launches use the selected agent row instead of the first row sharing its preset.

  • Stores the selected row per host while keeping the preset as the cross-host selection and model/effort preference key.
  • New chat, new-session flows, Ask Agent, and Finish Review use the selected row when available, or fall back to the preset’s first row.
  • Launches wait for pending host configs when a row was picked and use that row’s model and effort; Finish Review skips the launch if its sheet closes while waiting.
  • Mobile only; no host or API changes. Existing saved preferences without row ids keep the previous behavior until another agent is picked.

Fixes #9262.

Summary by CodeRabbit

  • New Features
    • Agent configuration choices are saved per host and restored when you select an agent for that host.
    • You can select individual configurations even when they share the same agent preset.
    • New chats, terminal workspaces, review sessions, and pull request agent sessions use the selected host configuration when available, including its model and effort preferences.
    • If a saved configuration is unavailable, the app falls back to a matching agent preset.