Skip to content

Pi bridge: bare model ids from bb's own spawns fail at thread.start ("Ambiguous Pi model") #1123

Closed

Description

@amadad

Summary

A Pi thread spawned with a bare model id (e.g. gpt-5.6-terra) fails at thread.start with:

Ambiguous Pi model "gpt-5.6-terra": served by azure-openai-responses, cloudflare-ai-gateway, github-copilot, openai, openai-codex, opencode. Prefix it with the provider you want.

(or Failed to resolve Pi model "..." on older Pi catalogs). Two aspects of this feel like bugs rather than the documented don't-guess policy:

1. bb itself produces the bare ids

The error is easy to hit without the user ever typing a model name: in our case a Codex parent thread spawned Pi worker threads, and the model id carried over to the spawn was the bare gpt-5.6-terra. Selections stored before #1037 have the same shape. So the "prefix it" advice targets a string the user never wrote.

2. The failure is deferred from spawn to start

bb thread spawn accepts the unresolvable model without complaint; the thread only errors when it is started — in our case days later, inside automation, where the error surfaced as silently dead worker threads. Validating the model against the provider catalog at spawn time (or at least warning) would catch this where the caller can react.

Suggestion: resolve ambiguity via the sole authenticated provider

resolveConfiguredModel in packages/agent-runtime/src/pi/bridge/sdk-session.ts refuses to guess between providers serving the same id, on the (sound) rationale that substituting a vendor would send workspace content and billing somewhere the user never chose. But when exactly one of the matching providers has credentials configured (modelRuntime.hasConfiguredAuth), the others could never serve the request at all — picking the sole authenticated provider sends nothing anywhere the user hasn't already signed in to. In practice this makes bare ids from stored selections and cross-provider spawns Just Work on single-account machines, while genuinely ambiguous cases (two authed providers) still error.

We're running this as a small patch on our fork — happy to send it as a PR if you want it:
amadad@c26b696

if (bare.length > 1) {
  const authed = bare.filter((candidate) =>
    modelRuntime.hasConfiguredAuth(candidate.provider),
  );
  if (authed.length === 1) {
    return authed[0];
  }
  // ... existing ambiguity error
}

Environment

  • bb-app 0.35.1 (self-hosted, built from origin/main @ cce08058)
  • Pi @earendil-works/pi-coding-agent 0.84.0, auth: openai-codex OAuth only

Activity

  1. added theissue type on Aug 7, 2026
  2. added a commit that references this issue on Aug 7, 2026
    781104d
  3. added a commit that references this issue on Aug 14, 2026
    3851a4d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions