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

未关闭 适合新手
#62,105 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

  • #62109 来自 @andycostintoma —— 已关闭,未合并

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
65/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
frontend

调研方向

从 packages/tui/src/component/use-connected.tsx 开始,将它的位置查询与模型和集成对话框进行比较;issue 指出这些对话框会传入 location.ref。检查 LocationProvider 如何同步当前活动位置,然后使用一个位于非默认目录中的会话复现问题。当该会话的已连接 provider 及其分组显示在 /models 中时,即为完成;issue 未指定测试文件。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
TypeScript
星标
224k
派生
30k
平均合并
5 小时 25 分钟
30 天内合并 PR
494

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。