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
- 平均マージ
- 5時間 32分
- マージ済み PR(30日)
- 492
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
anomalyco/opencode のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
anomalyco/opencode#60174 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
anomalyco/opencode#60143 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
anomalyco/opencode#60121 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
anomalyco/opencode#59973 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
triaging
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
anomalyco/opencode#59942 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
anomalyco/opencode の issue をすべて見る
似ている issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
area:plugins area:security area:skills bug has repro
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
anthropics/claude-code#105911 ·
メンテナーはふだん 1 日以内に返信
-
documentation good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
dev-five-git/devup-ui#879 ·
メンテナーはふだん 11 日以内に返信
-
openspec-apply-change skill: when blocked, may select a ready artifact unrelated to missingArtifactsオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Fission-AI/OpenSpec#2165 ·
メンテナーはふだん 1 日以内に返信
-
🐞 bug 🧐 unconfirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
Tencent/tdesign-vue-next#7032 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信