chore: record profile scope and restore diagnostics
This commit is contained in:
@@ -1,27 +1,49 @@
|
||||
---
|
||||
title: 'Orchestrator delegation scope を root read + worktree write に狭める'
|
||||
state: 'planning'
|
||||
title: 'Profile から concrete scope を外して launch policy で付与する'
|
||||
state: 'ready'
|
||||
created_at: '2026-06-13T17:45:32Z'
|
||||
updated_at: '2026-06-13T17:46:37Z'
|
||||
updated_at: '2026-06-13T19:02:42Z'
|
||||
assignee: null
|
||||
readiness: 'requirements_sync_needed'
|
||||
risk_flags: ['scope', 'delegation-scope', 'orchestrator', 'profile-merge', 'spawnpod']
|
||||
readiness: 'implementation_ready'
|
||||
risk_flags: ['scope', 'delegation-scope', 'profiles', 'launch-policy', 'orchestrator', 'spawnpod', 'restore']
|
||||
---
|
||||
|
||||
## Background
|
||||
|
||||
Orchestrator の direct scope は root workspace read-only であるべきだが、child Coder/Reviewer には implementation worktree への write と original workspace への read を委譲できる必要がある。
|
||||
Profile は reusable behavior / model / prompt / feature policy の単位であるべきだが、現在は concrete filesystem authority である `scope` / `delegation_scope` も持っている。これにより、runtime launch policy と Profile authority が衝突している。
|
||||
|
||||
現在の暫定 Orchestrator profile は `resources/profiles/orchestrator.lua` で以下になっている。
|
||||
実際に起きた問題:
|
||||
|
||||
```lua
|
||||
scope = "workspace_read"
|
||||
delegation_scope = "workspace_write"
|
||||
- `builtin:default` の workspace write scope が role profile 継承に混ざり、Orchestrator direct scope が workspace write を要求した。
|
||||
- 暫定対応として `resources/profiles/orchestrator.lua` に `scope = "workspace_read"` / `delegation_scope = "workspace_write"` を置いたが、これは scalar replacement に依存した非自明な workaround である。
|
||||
- Orchestrator の本来の authority は mixed shape である。
|
||||
- direct scope: original workspace root read
|
||||
- delegation scope: original workspace root read + `<workspace>/.worktree` write
|
||||
- Profile の Lua API / merge semantics でこの mixed authority を表現しようとすると、`yoi.profile.extend()` の deep merge や authority-bearing field replacement の問題に引きずられる。
|
||||
- Restore では metadata snapshot を正本として尊重すべきであり、current Profile/default manifest 由来の scope で上書きしてはいけない。
|
||||
|
||||
根本方針:
|
||||
|
||||
```text
|
||||
Profile = reusable behavior / prompt / model / feature policy
|
||||
Launch policy = concrete runtime authority / workspace root / cwd
|
||||
metadata snapshot = restore 時の effective authority 正本
|
||||
```
|
||||
|
||||
これは fresh launch の delegation 不足を避けるが、delegation が広すぎる。概念的には child に original workspace root への write まで委譲可能になっている。
|
||||
この Ticket は、Orchestrator delegation を狭めるだけでなく、built-in/Profile から concrete scope を外し、起動経路ごとの launch policy が effective `scope` / `delegation_scope` を確定する形へ整理する。
|
||||
|
||||
手動 restore 復旧時に delegation を `.worktree` write のみに狭めたところ、Reviewer 起動で root workspace read を再委譲できず失敗した。正しい effective shape は以下。
|
||||
## Requirements
|
||||
|
||||
- Reusable Profiles から concrete filesystem authority を外す。
|
||||
- Builtin role Profiles (`builtin:companion`, `builtin:orchestrator`, `builtin:coder`, `builtin:reviewer` など) は `scope` / `delegation_scope` を role behavior の正本として持たない。
|
||||
- `resources/profiles/orchestrator.lua` の `scope = "workspace_read"` / `delegation_scope = "workspace_write"` workaround を解消する。
|
||||
- Profile は model / worker instruction / feature policy / compaction 等の reusable behavior を担う。
|
||||
- Launch surface が concrete authority を構築する。
|
||||
- normal TUI / Companion launch は workspace write など、その起動経路の policy に基づいて direct scope を付与する。
|
||||
- Ticket Orchestrator launch は Orchestrator role policy に基づいて scope/delegation を付与する。
|
||||
- SpawnPod / role child launch は explicit delegated child scope を child direct scope として渡す。
|
||||
- Child delegation scope は明示的に必要な場合のみ付与し、profile inheritance から暗黙に継承しない。
|
||||
- Orchestrator launch policy を以下にする。
|
||||
|
||||
```text
|
||||
direct scope:
|
||||
@@ -32,28 +54,22 @@ delegation_scope:
|
||||
write <original workspace root>/.worktree
|
||||
```
|
||||
|
||||
現状の scalar profile intent では、この mixed delegation scope を簡潔に表現できない。object/table form は `profile.extend()` の deep merge と scope merge semantics により inherited value の置換が難しいため、既存 Ticket `00001KTZY8HK2` の profile replace/clear semantics と関連する。
|
||||
|
||||
## Requirements
|
||||
|
||||
- Orchestrator fresh launch の effective scope を以下にする。
|
||||
- direct `scope`: original workspace root recursive read
|
||||
- `delegation_scope`: original workspace root recursive read + original workspace `.worktree` recursive write
|
||||
- Reviewer/Coder child launch が必要とする root read と implementation worktree write を Orchestrator が再委譲できること。
|
||||
- Orchestrator が child に original workspace root write を委譲できないこと。
|
||||
- Profile 継承は維持する。
|
||||
- `builtin:orchestrator` は `builtin:default` から reusable defaults を継承してよい。
|
||||
- inherited authority-bearing scope fields を意図せず加算しないこと。
|
||||
- 実装方法は `00001KTZY8HK2` の profile replacement/clear semantics と整合させる。
|
||||
- この Ticket で replacement API まで実装するか、Orchestrator launch context 側で role-specific delegation scope を構築するかは設計で決める。
|
||||
- いずれの場合も scalar string workaround への依存を増やさない。
|
||||
- Restore path と fresh launch path の effective scope が意図せず乖離しないようにする。
|
||||
- metadata snapshot は restore 時に尊重する。
|
||||
- 新規生成される Orchestrator metadata snapshot には narrowed delegation scope が保存される。
|
||||
- Restore path は metadata snapshot を尊重する。
|
||||
- metadata snapshot がある場合、current profile/default/launch policy で scope/delegation_scope を上書きしない。
|
||||
- 新規 launch で保存される metadata snapshot には launch policy 適用後の effective scope/delegation_scope が入る。
|
||||
- Existing Profile scope support の扱いを明確にする。
|
||||
- この Ticket で Profile schema から完全削除するか、built-in role Profiles では禁止/無視しつつ user Profile support を deprecated として残すかは実装時に決めてよい。
|
||||
- ただし built-in role launch の concrete authority は Profile scope に依存しないこと。
|
||||
- `00001KTZY8HK2` の Lua/profile replacement API は、この Ticket の前提にしない。
|
||||
- scope 問題は Profile replacement API で解くのではなく、concrete authority を launch policy へ移すことで解く。
|
||||
- scope 以外の field replacement が必要なら `00001KTZY8HK2` を後続の別問題として扱う。
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
- Fresh Orchestrator launch の resolved/effective manifest が以下を満たす test がある。
|
||||
- Builtin Orchestrator Profile の resolved reusable behavior から broad `delegation_scope = "workspace_write"` 依存がなくなる。
|
||||
- Fresh Orchestrator launch の effective manifest が以下を満たす test がある。
|
||||
- direct scope allows read on original workspace root
|
||||
- direct scope does not allow write on original workspace root
|
||||
- delegation scope allows read on original workspace root
|
||||
@@ -61,18 +77,27 @@ delegation_scope:
|
||||
- delegation scope does not allow write on original workspace root outside `.worktree`
|
||||
- Reviewer/Coder launch validation can be satisfied by the narrowed Orchestrator delegation scope.
|
||||
- Scope allocator does not conflict with the Companion/top-level `yoi` Pod's workspace write allocation.
|
||||
- `resources/profiles/orchestrator.lua` no longer needs to express delegation as broad `"workspace_write"` unless a separate explicit override intentionally narrows it later in launch resolution.
|
||||
- Tests cover both profile resolution / launch context and child delegation validation where practical.
|
||||
- Validation: focused scope/profile/client tests, `cargo build -p yoi`, and `nix build .#yoi`.
|
||||
- Normal Companion/TUI launch still receives the expected workspace write direct scope from launch policy, not from reusable Profile authority.
|
||||
- SpawnPod child config still replaces inherited/profile scope with the explicitly delegated child scope.
|
||||
- Restore from metadata snapshot preserves saved scope/delegation_scope and does not reapply current Profile/launch default authority over the snapshot.
|
||||
- Tests cover at least:
|
||||
- Profile resolution no longer leaking default workspace write into Orchestrator authority
|
||||
- launch policy authority for Orchestrator
|
||||
- launch policy authority for normal top-level/Companion launch where practical
|
||||
- restore snapshot preservation
|
||||
- child delegation validation for root read + worktree write
|
||||
- Validation: focused scope/profile/client/pod tests and `cargo build -p yoi`. Run `nix build .#yoi` only if Cargo.lock, packaging, or resource inclusion changes require it.
|
||||
|
||||
## Out of scope
|
||||
|
||||
- General Plugin/MCP permission design.
|
||||
- Full replacement of profile scope semantics beyond what is needed here, unless this Ticket is intentionally merged with `00001KTZY8HK2`.
|
||||
- OS-level sandboxing of child processes.
|
||||
- Designing a full replacement/clear Lua API for every Profile field.
|
||||
- Full removal of user Profile `scope` compatibility unless the implementation chooses that as the cleanest route and updates tests/docs accordingly.
|
||||
|
||||
## Related work
|
||||
|
||||
- Profile replacement/clear semantics: `00001KTZY8HK2`
|
||||
- Restore should preserve metadata manifest snapshot: current local fix in `crates/pod/src/pod.rs`
|
||||
- Profile replacement/clear semantics follow-up: `00001KTZY8HK2`
|
||||
- Restore should preserve metadata manifest snapshot: `9be3f132`
|
||||
- Orchestrator role profile: `resources/profiles/orchestrator.lua`
|
||||
- SpawnPod child scope/delegation path: `crates/pod/src/spawn/tool.rs`
|
||||
|
||||
@@ -4,4 +4,17 @@
|
||||
|
||||
LocalTicketBackend によって作成されました。
|
||||
|
||||
---
|
||||
|
||||
<!-- event: decision author: hare at: 2026-06-13T19:02:42Z -->
|
||||
|
||||
## Decision
|
||||
|
||||
決定:
|
||||
- 旧方針の「Orchestrator delegation scope だけを狭める」ではなく、1 Ticket にまとめて「Profile から concrete scope を外し、launch policy が runtime authority を付与する」方針に広げる。
|
||||
- Profile は reusable behavior / prompt / model / feature policy を持つ層とし、filesystem `scope` / `delegation_scope` は起動経路が concrete workspace/cwd とともに決める。
|
||||
- Orchestrator の desired effective authority は launch policy で `direct read workspace` + `delegation read workspace, write workspace/.worktree` として構築する。
|
||||
- Lua/profile replacement API (`00001KTZY8HK2`) はこの scope 問題の前提にしない。scope 以外の replacement が必要なら後続として扱う。
|
||||
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user