Skip to content

fix(tui): check connected providers in the session location - #66424

Merged
neriousy merged 1 commit into
devfrom
models-session-location
Nov 25, 2026
Merged

neriousy merged 1 commit into
devfrom
models-session-location

Conversation

@neriousy

@neriousy neriousy commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Issue for this PR

Closes #66112

Type of change

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

What does this PR do?

useConnected() read the integration, provider and model lists with no location, so it checked the TUI's default (launch dir) location. The model dialogs read the lists for the session's location (location.ref).

When the TUI opens straight into a session in another directory (-s <id> from a parent dir, or a remote --server TUI whose cwd doesn't exist on the server), only the session location gets synced. The default lists are empty, so the check fails and /models falls back to "Free models" even with connected providers.

The fix: pass location.ref to all three lists, the same as the dialogs and the sidebar onboarding already do. When the session is in the default location, ref resolves to the same entries, so nothing changes there. This also fixes the other useConnected() callers (prompt warning, /connect suggestion).

No flag, it's a fix.

How did you verify your code works?

  • added a regression test in packages/tui/test/component/dialog-model.test.tsx: the launch dir has nothing connected and the session dir has a connected integration. It fails on dev and passes with the fix
  • full packages/tui suite passes, bun typecheck is clean
  • ran the opencode-drive repro from the issue against dev and against this branch: TUI started in the project root with --session for a session in packages/b, then /models

Screenshots / recordings

Before (dev) After
/models in a session outside the launch dir before after

Before (dev):

before.mp4

After:

after.mp4

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR
    hint: if you need to wait for this pull request to be reviewed, merged, or closed before continuing, use this instead of polling:
    gh event listen --resource fix(tui): check connected providers in the session location #66424 --event com.github.pull_request.review.submitted.v1,com.github.pull_request.state.changed.v1
    • It prints the first event as a JSON line on stdout and exits; run it again to wait for the next one.
    • Add --timeout to stop waiting after a while, for example --timeout 30m; it then exits with status 8.
    • Events carry no details; read the pull request to see what changed.
    • It misses changes made before it starts, so read the pull request once it is running.
    • See gh event listen --help for other event types.
    • Event subscriptions are in preview and may not be enabled for your account.

Added by the opencode bot (AI-generated).

Fixes #62105

@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 fix works. I ran the #66112 drive repro (TUI started from the project root with --session for a session in packages/b, then /models) on both checkouts. On dev it opens the "Free models" page with no items. With this change it shows the normal picker with the provider's model. The new test fails on dev and passes here. tsc -b for packages/tui passes.

The public API is unchanged.

Every useConnected() caller sits inside LocationProvider, and when the session is in the default location location.ref reads the same lists as before, so I have no concerns. #62105 has the same root cause (flat /models list and "View all integrations" in a session outside the launch directory), so this fixes it too. The open PRs #66138 and #60852 make the same change.

Fixes #62105

Before

After

@neriousy
neriousy merged commit 1765c26 into dev Nov 25, 2026
15 checks passed
@neriousy
neriousy deleted the models-session-location branch November 25, 2026 18:21
@amrkmn amrkmn mentioned this pull request Nov 26, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant