Skip to content

fix(tui): scope connected provider check to session location - #66138

Closed
rplague wants to merge 1 commit into
anomalyco:devfrom
rplague:connected-provider-scope
Closed

rplague wants to merge 1 commit into
anomalyco:devfrom
rplague:connected-provider-scope

Conversation

@rplague

@rplague rplague commented Nov 24, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #66112

Type of change

  • Bug fix

What does this PR do?

useConnected() read the integration/provider/model lists with no location, so they came from the directory the TUI was launched in. Starting the TUI directly in a session whose directory differs from that launch directory left those lists empty, and /models fell back to "Free models". This passes the session's useLocation().ref instead, matching the sidebar onboarding check.

How did you verify your code works?

Added a component test in packages/tui/test/component/dialog-model.test.tsx (connected check uses the session location, not the launch directory). It renders "Free models" before this change while the session directory has a provider and a non-free model, and passes after.

  • cd packages/tui && bun test test/component/dialog-model.test.tsx -> 3 pass
  • bun test test/util/connected-provider.test.ts -> 7 pass
  • bun typecheck -> no errors
  • bun run check (repo root) -> 36/36 tasks

Screenshots / recordings

Not applicable; covered by the component test.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #60590

@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.

This looks correct. I reproduced #66112 on the base with the issue's drive script: a TUI started from the project root with --session on a session in a sub-folder, then /models, shows the "Free models" page. With this PR the same run shows the normal picker with the provider's model (screenshots below). The new component test fails on the base and passes here, and the nearby dialog-model and connected-provider tests pass.

useLocation().ref falls back to the default location when no ref is set, so behaviour in the launch directory is unchanged. All callers of useConnected() render inside LocationProvider, so the new useLocation() call is safe there.

The public API is unchanged.

No blocking concerns.

Related: #60590

Before

After

@rplague

rplague commented Nov 24, 2026

Copy link
Copy Markdown
Author

This overlaps with #60852, which made the same useConnected() change before #65793. That PR targets the old single-list signature, so it no longer applies to dev. This one applies the same location.ref fix to the current three-list signature and adds a regression test. Happy to fold into #60852 if you prefer to revive it.

The model dialog read integration/provider/model lists for the startup directory, so starting the TUI directly into a session in another directory fell back to the free models page. Use the session location instead, matching the sidebar onboarding check.
@rplague
rplague force-pushed the connected-provider-scope branch from d6ba93e to 796f63b Compare November 25, 2026 16:26

@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 new commit is a rebase onto the latest dev with the same change. I re-ran the #66112 reproduction on the new base and with this PR. The base still opens the "Free models" page for a session in another directory, and the PR shows the normal picker (screenshots below). The new test still fails on the base and passes here, and the nearby tests pass.

The public API is unchanged.

No new concerns.

Before

After

@rplague

rplague commented Nov 26, 2026

Copy link
Copy Markdown
Author

Fixed by #66424, which landed the same location.ref change with an equivalent regression test. Closing this one to keep the queue clean.

@rplague rplague closed this Nov 26, 2026
@rplague
rplague deleted the connected-provider-scope branch November 26, 2026 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tui: /models shows only "Free models" on 2.4.1 with connected integrations and a paid model active

1 participant