100 lines
6.7 KiB
Markdown
100 lines
6.7 KiB
Markdown
<!-- event: create author: "yoi ticket" at: 2026-06-10T07:49:10Z -->
|
||
|
||
## 作成
|
||
|
||
LocalTicketBackend によって作成されました。
|
||
|
||
---
|
||
|
||
<!-- event: intake_summary author: intake at: 2026-06-10T08:09:54Z -->
|
||
|
||
## Intake summary
|
||
|
||
既存 Ticket `00001KTR83D6E` の本文・thread・artifacts を確認し、関連する closed Ticket `00001KTNVGT8G`(ToolExecutionContext 導入)と `00001KTNS9B50`(same-file multiple Edit の analytics)も確認した。同目的の未完了重複は見当たらず、本 Ticket は `ToolExecutionContext` 基盤を使う concrete follow-up として妥当。目的は Worker の approved tool call 並列実行を維持しつつ、`Edit` / `Write` など同一 target file への built-in mutation を tool 側の per-file boundary で直列化し、同一 `batch_id` 内では `call_index` 昇順に実行すること。binding decisions は Worker に resource scheduler を持たせないこと、Hook/Interceptor に lock lifecycle を置かないこと、全 tool/全 response を直列化しないこと、分散 file lock はこの Ticket の非目標であること。実装裁量として、異なる `batch_id` の同一 file mutation に厳密 global ordering が必要か単純な per-file mutex で十分かを判断し、理由を記録する余地がある。Reviewer focus / risk flags は concurrency、path-canonicalization、scope-permission-boundary、diagnostics-privacy、failure/timeout/drop 時の guard 解放。blocking open question はなく、受け入れ条件と validation が明確なため implementation_ready と判断する。
|
||
|
||
---
|
||
|
||
<!-- event: state_changed author: intake at: 2026-06-10T08:09:54Z from: planning to: ready reason: intake_ready field: state -->
|
||
|
||
## State changed
|
||
|
||
既存 Ticket の本文・thread・artifacts と関連 Ticket を確認した。要件・非目標・受け入れ条件・レビュー焦点が実装 routing 可能な粒度で揃っているため、planning から ready にします。
|
||
|
||
---
|
||
|
||
<!-- event: state_changed author: workspace-panel at: 2026-06-10T08:10:58Z from: ready to: queued reason: queued field: state -->
|
||
|
||
## State changed
|
||
|
||
Ticket を `workspace-panel` が queued にしました。
|
||
|
||
|
||
---
|
||
|
||
<!-- event: state_changed author: orchestrator at: 2026-06-10T09:19:09Z from: queued to: inprogress reason: orchestrator_queue_acceptance field: state -->
|
||
|
||
## State changed
|
||
|
||
Queue acceptance: relation query has no blockers, orchestration-plan query only has prior human-gate waiting note, workspace is clean, and user explicitly requested continuing inprogress/queued consumption. Implementation side effects will proceed in a separate worktree/branch before reviewer evidence and merge-completion.
|
||
|
||
---
|
||
|
||
<!-- event: plan author: orchestrator at: 2026-06-10T09:19:09Z -->
|
||
|
||
## Plan
|
||
|
||
Routing decision: implementation_ready
|
||
|
||
Reason:
|
||
- Ticket is `queued`, relation query has no blockers, and existing orchestration plan only contains a prior human-gate waiting note.
|
||
- User explicitly requested continuing inprogress/queued work; this satisfies the prior human gate.
|
||
- Requirements and acceptance criteria are concrete: same-file `Edit`/`Write` ordering by `ToolExecutionContext.call_index` within a batch, no Worker-wide scheduler, different-file parallelism, guard release on error, and path equivalence coverage.
|
||
|
||
Evidence checked:
|
||
- Ticket body/thread/artifacts.
|
||
- `TicketRelationQuery`: no relations/blockers.
|
||
- `TicketOrchestrationPlanQuery`: one waiting note from prior target-unspecified routing pass.
|
||
- Code map: `crates/tools/src/edit.rs`, `crates/tools/src/write.rs`, `crates/tools/src/tracker.rs`, `crates/tools/src/scoped_fs.rs`, `crates/llm-worker/src/tool.rs`, `crates/llm-worker/src/worker.rs`.
|
||
- Workspace state is clean; existing separate setup-wizard worktree is independent.
|
||
|
||
IntentPacket:
|
||
- Intent: serialize same-target-file built-in mutations so `Edit`/`Write` calls for one file in one response execute in model call order while preserving Worker parallel tool execution.
|
||
- Binding decisions / invariants: Worker must not become a general resource scheduler; do not disable provider/Worker parallel tool calls; do not serialize unrelated tools or different files; preserve existing scope/read-before-edit behavior; path keying must not weaken scope validation; no distributed lock across Pods/processes.
|
||
- Requirements / acceptance criteria: same-batch same-file `Edit` order; same-batch same-file `Write` + `Edit` order; different files remain concurrent; failure releases guard; path equivalence behavior fixed by implementation/test; targeted tests and standard validation pass.
|
||
- Implementation latitude: exact guard placement may be a shared file-mutation coordinator in `tools` as long as both `Edit` and `Write` share it and Worker remains parallel; for different batch same-file mutations, a simple per-file exclusion is acceptable if reason is recorded.
|
||
- Escalate if implementation requires changing Worker execution semantics, tool result ordering/history semantics, permission/scope model, or broad distributed locking.
|
||
- Validation: `cargo fmt`, `cargo test -p tools mutation`, focused `cargo test -p tools`, `git diff --check`, `target/debug/yoi ticket doctor`, and broader build before merge if touched surfaces require it.
|
||
|
||
---
|
||
|
||
<!-- event: implementation_report author: orchestrator at: 2026-06-10T09:29:06Z -->
|
||
|
||
## Implementation report
|
||
|
||
Implementation report
|
||
|
||
Branch/worktree: `serialize-file-mutations` / `.worktree/serialize-file-mutations`
|
||
Commit:
|
||
- `40130143 fix: serialize same-file mutations`
|
||
|
||
Summary:
|
||
- Added a shared per-target-file mutation guard to `Tracker`, keyed by canonical target path where possible.
|
||
- `Edit` and `Write` acquire this guard around their critical read/verify/write/record sections, so same-file mutations serialize while Worker-level parallel tool execution remains intact.
|
||
- Different files use different guards and are not globally serialized.
|
||
- The guard uses `ToolExecutionContext` for response-local diagnostics/correlation (`batch_id`, `call_index`) without making it a Worker/session authority handle.
|
||
- Added tests for equivalent-path guard blocking, different-file non-blocking, same-batch `Write` then `Edit` order, and failed mutation guard release.
|
||
|
||
Validation run in branch:
|
||
- `cargo fmt`
|
||
- `cargo test -p tools --lib` passed.
|
||
- `cargo test -p tools mutation_guard --lib` passed.
|
||
- `cargo test -p tools write_then_edit_same_file_same_batch_uses_call_order --lib` passed.
|
||
- `cargo test -p tools failed_same_file_mutation_releases_guard_for_followup --lib` passed.
|
||
- `cargo check -p tools` passed.
|
||
- `git diff --check` passed.
|
||
|
||
Notes:
|
||
- `nix build .#yoi` not yet run on this branch; Orchestrator should run it before/after merge because this changes tool runtime code and crate feature configuration.
|
||
|
||
---
|