Feature request: opt-in exclusive worktree ownership for session families (v2)
维护者通常 1 天内回复
@kitlangton 已经在做这个了。
开始于 2026年10月4日。
评估
这个 Issue 还没有评估数据。
描述
Feature request: opt-in exclusive worktree ownership for session families (v2)
Problem
The v2 session API accepts a location when creating a root session and allows an existing session to be moved. In an isolated OpenCode v2.0.22 scratch-config probe, two sequential and two concurrent independent root sessions were accepted at the same linked-worktree path. A child inherited its parent location. A separate root moved to that occupied destination and the API returned 204; reading the session confirmed the new location.
This is a bounded API behavior report, not a claim that every OpenCode workflow has this problem or that a universal existing bug is promised. The concern is that independent roots can share a working tree unintentionally, while session ancestry already distinguishes families.
Reproduction (isolated scratch instance only)
Prerequisites: use an isolated OpenCode v2.0.22 scratch configuration/database and an owned loopback listener. BASE and TEST_PASSWORD must come from that isolated listener only; explicitly reject the production listener on port 4097 and any user's working data. WT is an absolute path to a disposable linked worktree. Keep the scratch password only in the local variable, do not put its value in docs or logs, and do not enable shell tracing.
body=$(jq -n --arg directory "$WT" '{id:"ses_probe_root_A_001",location:{directory:$directory}}')
curl -fS --max-time 20 --user "opencode:${TEST_PASSWORD}" -X POST "$BASE/api/session" \
-H 'content-type: application/json' --data "$body"
body=$(jq -n --arg directory "$WT" '{id:"ses_probe_root_B_001",location:{directory:$directory}}')
curl -fS --max-time 20 --user "opencode:${TEST_PASSWORD}" -X POST "$BASE/api/session" \
-H 'content-type: application/json' --data "$body"
Both returned HTTP 200 in the isolated probe. Repeating two root creates concurrently also returned HTTP 200 for each. Creating a child with parentID set to root A returned 200 and inherited that location. Creating root C at another disposable directory, then posting {"directory":"/absolute/path/to/linked-worktree"} to /api/session/ses_probe_root_C_001/move, returned 204; a GET of that session showed the target location.
These are placeholders; normalize the path and use fresh probe IDs in any reproduction. The complete isolated run log is not a public artifact and contains host-specific paths.
Request
Please consider an opt-in native admission policy that atomically limits each real linked worktree to one root session family across all writers. Resolve aliases such as symlinks and subdirectories to the same linked-worktree identity. Apply the same admission decision to create, move, import, fork, and queued placement/delivery paths; reject foreign, ambiguous, or incomplete ownership states without mutation. Children should inherit family ownership naturally.
The v2.0.22 source review shows session-ID idempotency, not a location-occupancy guard. The request is for native enforcement using existing durable session state, not a second ownership ledger. Preserve ordinary multi-session behavior unless the opt-in policy is enabled. Pending-move reservations must be atomic/durable; a client-side check followed by a list is racy and bypassable. This is an implementation proposal, not a claim that a particular storage mechanism already exists.
Expected checks
- Two concurrent independent roots targeting one worktree: exactly one admitted when opt-in is enabled.
- Same-family children, grandchildren, and resume remain permitted.
- Alias paths identify the same worktree; foreign move/import/fork and queued placement races fail without mutation.
- Archived or descendant-only roots remain ownership anchors until explicit clearance; failed ancestry/enumeration fails closed.
- Default behavior without opt-in preserves normal multi-session workflows.
References
- OpenCode v2.0.22 source tag:
527f0b931d1f9b3ebd34e106c51b31ce5db5b075, especiallypackages/core/src/session.tsandpackages/server/src/handlers/session.ts. - Related, not duplicates: #51992 and #51196.
- 主要语言
- TypeScript
- 星标
- 221k
- 派生
- 29.6k
- 平均合并
- 7 小时 41 分钟
- 30 天内合并 PR
- 510
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
anomalyco/opencode 的其他 Issue
-
core: OpenRouter BYOK sessions record cost = 0 since v2.2.0 (ignores cost_details.upstream_inference_cost)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭reproduced
难度 2/5 1-3 小时 新手友好度 72/100
anomalyco/opencode#60558 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
anomalyco/opencode#60541 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
anomalyco/opencode#60529 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
anomalyco/opencode#60469 · 2 条评论 ·
维护者通常 1 天内回复
-
TUI permission prompt for MCP tools doesn't show the call arguments可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 73/100
anomalyco/opencode#60350 · 2 条评论 ·
维护者通常 1 天内回复
查看 anomalyco/opencode 的全部 Issue
相似的 Issue
-
area: triage theme: undefined
难度 2/5 1-3 小时 新手友好度 85/100
jhipster/generator-jhipster#35895 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
paperclipai/paperclip#18396 ·
维护者通常 1 天内回复
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 1/5 1 小时以内 新手友好度 82/100
lingdojo/kana-dojo#33380 · 1 条评论 · 5 个 reaction ·
维护者通常 1 天内回复
-
chore other
难度 2/5 1-3 小时 新手友好度 82/100
alastair-smith/card-games#342 ·
维护者通常 1 天内回复