tui: /models drops provider grouping when the session location differs from the default location

Aperta Adatta ai principianti
#62,105 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #62109 di @andycostintoma — chiusa senza merge

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
frontend

Direzione di ricerca

Inizia da packages/tui/src/component/use-connected.tsx e confronta la ricerca della posizione con quella delle finestre di dialogo dei modelli e delle integrazioni, che secondo l’issue passano location.ref. Verifica come LocationProvider sincronizza la posizione attiva, poi riproduci il problema usando una sessione in una directory diversa da quella predefinita. Il lavoro è completato quando /models mostra i provider connessi e i relativi gruppi per quella sessione; l’issue non indica alcun file di test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

reproduced
Description

When the TUI opens a session whose directory is not the client's default location, /models shows one flat list without provider groups, Favorites or Recent, and its action reads "View all integrations" as if nothing were connected. The integrations dialog in the same session shows the providers as connected.

useConnected() in packages/tui/src/component/use-connected.tsx calls data.location.integration.list() without a location, so it reads the default location's store. LocationProvider only syncs the active location, so when the two differ that store stays empty and useConnected() returns false. The model dialog and the integrations dialog already pass the active location (location.ref); useConnected() doesn't.

I hit it with --server against a remote service: the client's cwd doesn't exist on the server, so the default location falls back to the server's cwd while the session lives in a project directory. The same happens locally with -s <session> for a session in another directory.

Plugins

None needed to reproduce.

OpenCode version

2.2.1 (still present on dev)

Steps to reproduce
  1. Connect any provider, e.g. Anthropic.
  2. Start the service from one directory (cd ~ && opencode service start).
  3. Create a session in a different directory via POST /api/session with {"location":{"directory":"/path/to/project"}}.
  4. From a directory that isn't that project (or from another machine with --server), run opencode -s <session-id>.
  5. Open /models: flat list, "View all integrations". Open the integrations dialog: providers show as connected.
Screenshot

Not attached; /models renders a single flat list with "View all integrations" as its action.

Operating System

Linux (NixOS / Ubuntu)

Terminal

Reproduces independent of terminal (state bug, not rendering).

Lingua principale
TypeScript
Stelle
224k
Fork
30k
Merge medio
4h 44m
PR unite (30g)
513

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di anomalyco/opencode

Tutte le issue di anomalyco/opencode

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.