warehouse: the connection registry is process-global, so one server hands the first project's connections to every project
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
调研方向
从 packages/opencode/src/altimate/native/connections/registry.ts 开始,跟踪 Instance.provide() 如何将目录上下文提供给 configs、待处理的加载、已加载状态和 connector 缓存。重新运行双项目复现,然后检查 cli/cmd/run.ts:408 和 server/server.ts:281 中的 attach-without-dir 路径。当不同项目不再共享 configs 或活动 connector(包括请求使用嵌套目录时),即表示完成。
由索引模型根据 Issue 内容生成。
描述
What happens
ConnectionRegistry keeps configs, connectors, pending, and loaded as module-level state (packages/opencode/src/altimate/native/connections/registry.ts). ensureLoaded() loads once for the life of the process. One server process serving two projects therefore hands the first project's connections to both.
Reproduced with two Instance.provide() contexts against the same process:
first: Instance.directory = .../project-a → path = .../project-a/warehouse.db
second: Instance.directory = .../project-b → path = .../project-a/warehouse.db
Cached connectors make it worse: they are keyed only by connection name, so project B can be handed a live connector already open against project A's warehouse.
Why it matters now
This predates #1204 — before it, the base was the server's launch directory for everyone, so every project was equally wrong. #1204 made resolution correct for whichever project loads first, which is the right answer for the single-project case that covers nearly all real use. The residue is that the behaviour is now "first request wins" rather than "uniformly wrong", and that is worth closing properly rather than leaving in a comment.
Two related gaps in the same area:
Instance.directoryis the request's working directory, notInstance.worktree. A request naming a nested directory looks for.altimate-codein that nested directory rather than at the project root.run --attachwithout--dirsends no directory (cli/cmd/run.ts:408), so the server falls back to its own cwd (server/server.ts:281).
What a fix looks like
Make the registry state instance-scoped rather than module-scoped — keyed by Instance.directory, or held in the instance context — so each project loads and caches its own configs and connectors. Connector cache keys need the project in them too.
Not a blocker for #1204
#1204 documents this limitation in projectRoot()'s doc comment and does not regress it. Filing separately because the fix is a state-ownership change across the whole registry, not a path-resolution change.
- 主要语言
- TypeScript
- 星标
- 813
- 派生
- 134
- 平均合并
- 2 天 3 小时
- 30 天内合并 PR
- 65
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
AltimateAI/altimate-code 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
AltimateAI/altimate-code#1359 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
AltimateAI/altimate-code#1323 ·
-
难度 2/5 1-3 小时 新手友好度 86/100
AltimateAI/altimate-code#1288 ·
-
难度 1/5 1 小时以内 新手友好度 92/100
AltimateAI/altimate-code#1285 ·
-
privacy: Altimate Base consent dialog no longer discloses persistent per-installation identifier 未关闭
难度 1/5 1 小时以内 新手友好度 88/100
AltimateAI/altimate-code#1284 ·
查看 AltimateAI/altimate-code 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
bcgov/bc-wallet-mobile#4761 · 1 条评论 ·
-
external-issue to-triage
难度 2/5 1-3 小时 新手友好度 88/100
-
area-deployment area-integrations triage:bot-seen
难度 2/5 半天 新手友好度 86/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
refactor
难度 2/5 1-3 小时 新手友好度 84/100