ticket: record cwd workspace followups

This commit is contained in:
2026-06-12 01:05:29 +09:00
parent 7eff9301b9
commit a111a91c83
13 changed files with 528 additions and 89 deletions
+36
View File
@@ -0,0 +1,36 @@
---
title: 'runtime workspace と process cwd を分離する'
state: 'done'
created_at: '2026-06-11T15:45:07Z'
updated_at: '2026-06-11T15:59:55Z'
assignee: null
queued_by: 'yoi ticket'
queued_at: '2026-06-11T15:45:53Z'
---
## 背景
Ticket role Pod、とくに workspace Orchestrator は、runtime workspace として original workspace を使い続けながら、Bash / file tool の default cwd だけ dedicated orchestration worktree にしたい。
直前の調査で `--workspace` を dedicated worktree に寄せたり、`--tool-cwd` のような追加 CLI surface を作る方向は不適切だと確認した。`--workspace` は runtime workspace / project context の基準であり、process cwd は通常の current directory として扱えばよい。
また、コード内で `pwd``cwd` に明確な意味差がない箇所は `cwd` に統一し、用語混乱を減らす。
## 要件
- `--workspace` は runtime workspace / project context の基準として維持する。
- process current directory は Pod の tool default cwd として起動時に snapshot する。
- Ticket role Orchestrator は `--workspace = original workspace` のまま、process cwd を dedicated orchestration worktree にして起動・restore される。
- `--tool-cwd` のような追加 CLI surface は作らない。
- `SpawnConfig` など host-side launch config で必要なら `cwd` を内部値として持ち、child process の `Command::current_dir` にだけ使う。
- `pwd``cwd` に意図的な意味差がない runtime field / helper / local 変数は `cwd` に統一する。
- cwd は authority ではないため、scope / delegation / workspace identity の基準として扱わない。
## 受け入れ条件
- Orchestrator role launch/restore が original workspace を runtime workspace として使い、dedicated orchestration worktree を process cwd として使う。
- child Pod へ `.worktree` 配下を delegate できる authority は original workspace profile/scope に基づいて評価される。
- `--tool-cwd` などの新しい CLI argument が残らない。
- `pwd` / `cwd` の命名が混在していた主要 runtime path は `cwd` に統一される。
- 既存の `SpawnPod.cwd` semantics は「child process cwd を指定する」で維持され、runtime workspace を変更しない。
- `nix build .#yoi` が通る。
+84
View File
@@ -0,0 +1,84 @@
<!-- event: create author: "yoi ticket" at: 2026-06-11T15:45:07Z -->
## 作成
LocalTicketBackend によって作成されました。
---
<!-- event: intake_summary author: hare at: 2026-06-11T15:45:52Z -->
## Intake summary
Marked ready by `yoi ticket state`.
---
<!-- event: state_changed author: "yoi ticket" at: 2026-06-11T15:45:52Z from: planning to: ready reason: cli_state field: state -->
## State changed
Marked ready by `yoi ticket state`.
---
<!-- event: state_changed author: "yoi ticket" at: 2026-06-11T15:45:53Z from: ready to: queued reason: queued field: state -->
## State changed
Ticket を `yoi ticket` が queued にしました。
---
<!-- event: state_changed author: "yoi ticket" at: 2026-06-11T15:45:53Z from: queued to: inprogress reason: cli_state field: state -->
## State changed
State changed to `inprogress`.
---
<!-- event: implementation_report author: hare at: 2026-06-11T15:59:55Z -->
## Implementation report
runtime workspace と process cwd を分離する実装を行った。
- `--workspace` は runtime workspace / project context の基準として維持し、child process の current directory とは分離した。
- `SpawnConfig` / Ticket role launch plan は内部値として `cwd` を持ち、CLI argument にはせず `Command::current_dir` にのみ使うようにした。
- Panel Orchestrator launch/restore は `workspace_root = original workspace``cwd = dedicated orchestration worktree` として起動する。
- `SpawnPod.cwd` は child process cwd 指定として扱い、`--workspace` は spawner の runtime workspace を渡すままにした。
- Pod entrypoint は process cwd を起動時に snapshot し、workspace root とは別に Pod construction へ渡す。`--tool-cwd` は作らない。
- `pwd``cwd` の意図的な意味差がない主要 runtime path は `cwd` に統一した。
- metadata snapshot restore では、現在の launch manifest の scope/delegation scope を復元後 manifest に反映できるようにした。
検証:
- `cargo check`
- `cargo test -p client`
- `cargo test -p pod entrypoint::tests:: -- --nocapture`
- `cargo test -p pod spawn_pod_launches_runtime_in_workspace_and_process_cwd -- --nocapture`
- `cargo test -p pod spawn_pod_omitted_cwd_preserves_spawner_cwd -- --nocapture`
- `cargo fmt --check`
- `git diff --check`
- `yoi ticket doctor`
- `nix build .#yoi`
補足:
- `cargo test -p tools` は doctest の既存不整合 (`core_builtin_tools` の引数数) で失敗したため、この実装の検証対象からは外した。通常 unit/integration tests は通っている。
---
<!-- event: state_changed author: "yoi ticket" at: 2026-06-11T15:59:55Z from: inprogress to: done reason: cli_state field: state -->
## State changed
State changed to `done`.
---