Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

warehouse: the connection registry is process-global, so one server hands the first project's connections to every project

未关闭
#1,208 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript
领域
backend, cli, databases

调研方向

从 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.directory is the request's working directory, not Instance.worktree. A request naming a nested directory looks for .altimate-code in that nested directory rather than at the project root.
  • run --attach without --dir sends 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

贡献指南

打开贡献指南

从这里开始

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

AltimateAI/altimate-code 的其他 Issue

查看 AltimateAI/altimate-code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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