Repository navigation
fix(tui): check connected providers in the session location - #66424
Conversation
There was a problem hiding this comment.
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


Issue for this PR
Closes #66112
Type of change
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--serverTUI whose cwd doesn't exist on the server), only the session location gets synced. The default lists are empty, so the check fails and/modelsfalls back to "Free models" even with connected providers.The fix: pass
location.refto all three lists, the same as the dialogs and the sidebar onboarding already do. When the session is in the default location,refresolves to the same entries, so nothing changes there. This also fixes the otheruseConnected()callers (prompt warning,/connectsuggestion).No flag, it's a fix.
How did you verify your code works?
packages/tui/test/component/dialog-model.test.tsx: the launch dir has nothing connected and the session dir has a connected integration. It fails ondevand passes with the fixpackages/tuisuite passes,bun typecheckis cleandevand against this branch: TUI started in the project root with--sessionfor a session inpackages/b, then/modelsScreenshots / recordings
/modelsin a session outside the launch dirBefore (dev):
before.mp4
After:
after.mp4
Checklist
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
--timeoutto stop waiting after a while, for example--timeout 30m; it then exits with status 8.gh event listen --helpfor other event types.Added by the opencode bot (AI-generated).
Fixes #62105