197 lines
14 KiB
Markdown
197 lines
14 KiB
Markdown
<!-- event: create author: LocalTicketBackend at: 2026-06-13T10:04:55Z -->
|
||
|
||
## 作成
|
||
|
||
LocalTicketBackend によって作成されました。
|
||
|
||
---
|
||
|
||
<!-- event: intake_summary author: intake at: 2026-06-13T10:05:07Z -->
|
||
|
||
## Intake summary
|
||
|
||
Panel から Quit するときに断続的な遅延が発生する問題について、調査・修正用 Ticket を作成した。現象は明確だが再現条件や遅延箇所は未特定のため readiness は `spike_needed`。Orchestrator はまず `crates/tui/src/multi_pod.rs` の Panel event loop / `PendingReload` / Quit handling / queue-attention notice dispatch / snapshot reload 周辺を調査し、Quit が非本質的な background work の完了待ちでブロックされない修正へ routing できる。関連 closed Ticket `00001KTFMMZP0` は Panel 非同期遷移改善で、今回の Quit 遅延とは別の follow-up として扱う。
|
||
|
||
---
|
||
|
||
<!-- event: state_changed author: intake at: 2026-06-13T10:05:07Z from: planning to: ready reason: intake_ready field: state -->
|
||
|
||
## State changed
|
||
|
||
要件・受け入れ条件・binding decisions・調査焦点が揃っており、Orchestrator が spike/実装修正へ routing できるため ready にする。
|
||
|
||
---
|
||
|
||
<!-- event: state_changed author: workspace-panel at: 2026-06-13T10:53:17Z from: ready to: queued reason: queued field: state -->
|
||
|
||
## State changed
|
||
|
||
Ticket を `workspace-panel` が queued にしました。
|
||
|
||
|
||
---
|
||
|
||
<!-- event: decision author: orchestrator at: 2026-06-13T10:57:14Z -->
|
||
|
||
## Decision
|
||
|
||
Routing decision: spike_needed / queued_waiting_capacity
|
||
|
||
Reason:
|
||
- Ticket は `queued` で要件は明確だが、readiness は `spike_needed`。遅延原因・再現条件・影響 async path は未特定で、まず `crates/tui/src/multi_pod.rs` の Panel event loop / `PendingReload` / Quit handling / queue-attention notice dispatch / snapshot reload 周辺の code-path analysis が必要。
|
||
- `TicketRelationQuery` と `TicketOrchestrationPlanQuery` で durable blocker はなかったが、この queue review では `00001KV072V89`(Workspace panel mouse selection)を先に inprogress 受理した。
|
||
- `00001KV0723PC` と `00001KV072V89` はどちらも Panel / `multi_pod.rs` の event/input/render/reload surface に触れる可能性が高く、同時 child worktree で進めると conflict risk と reviewer bottleneck が大きい。
|
||
- `00001KV04NJ8D` は single-Pod rewind / Pod protocol 周辺の別 surface として parallel start 可能なため、現在の capacity は `00001KV072V89` と `00001KV04NJ8D` に割り当てる。
|
||
|
||
Evidence checked:
|
||
- Ticket body / thread / artifacts(artifacts なし)。
|
||
- relation records: なし。
|
||
- orchestration plan records: この routing pass で `00001KV072V89` との `conflicts_with` と waiting-capacity note を記録。
|
||
- related closed Ticket `00001KTFMMZP0`: Panel non-blocking transition work は closed で、`PendingReload` / background refresh / attach-return path の背景として関連するが、今回の Quit 遅延とは別 follow-up。
|
||
- code map: `crates/tui/src/multi_pod.rs` の run loop、`PendingReload`、Quit action、queue-attention notice dispatch、terminal event poll/reload interaction。
|
||
- workspace/Pod state: Orchestrator worktree clean。implementation Pods はまだ起動していないが、この routing pass で 2 件を受理予定。
|
||
|
||
Next action:
|
||
- この Ticket は queued のまま保持する。
|
||
- `00001KV072V89` の branch が統合されるか、panel surface conflict が低いと再評価できた時点で、改めて `queued -> inprogress` 受理を検討する。
|
||
- 受理時の first step は read-only/code-path spike とし、Quit が pending background work / notice dispatch / snapshot reload で block される path を特定してから修正する。
|
||
|
||
Escalate if:
|
||
- Quit 遅延の修正が terminal cleanup、Pod lifecycle authority、Ticket workflow semantics、または broad TUI runtime-loop redesign を必要とする場合。
|
||
- 原因が Panel 外(OS terminal / shell / external command / specific provider/network)にある証拠が出た場合。
|
||
|
||
---
|
||
|
||
<!-- event: decision author: orchestrator at: 2026-06-13T11:00:41Z -->
|
||
|
||
## Decision
|
||
|
||
Queue attention reviewed: no duplicate start.
|
||
|
||
Actual state check:
|
||
- `00001KV072V89` is `inprogress` with live spawned child `coder-00001KV072V89-panel-mouse` and worktree `/home/hare/Projects/yoi/.worktree/panel-mouse-selection`.
|
||
- `00001KV04NJ8D` is `inprogress` with live spawned child `coder-00001KV04NJ8D-rewind` and worktree `/home/hare/Projects/yoi/.worktree/rewind-live-refresh`.
|
||
- This Ticket remains `queued`.
|
||
- `TicketRelationQuery` still shows no durable dependency blockers, but the existing OrchestrationPlan `conflicts_with` / `waiting_capacity_note` remains applicable: this Ticket likely touches the same Panel `multi_pod.rs` event-loop surface as `00001KV072V89` and should wait until that branch is integrated or conflict surface is re-evaluated.
|
||
|
||
Decision:
|
||
- Do not start another Coder Pod for this Ticket now.
|
||
- Keep queued; re-evaluate after `00001KV072V89` completion/integration or explicit human override.
|
||
|
||
---
|
||
|
||
<!-- event: decision author: orchestrator at: 2026-06-13T11:27:26Z -->
|
||
|
||
## Decision
|
||
|
||
Routing decision: implementation_ready
|
||
|
||
Reason:
|
||
- Ticket は `queued` で、Quit 遅延の原因特定と修正の intent / requirements / acceptance criteria / binding invariants / implementation latitude / escalation conditions が揃っている。
|
||
- `readiness: spike_needed` だが、調査対象は `crates/tui/src/multi_pod.rs` の Panel event loop / `PendingReload` / Quit handling / queue-attention notice dispatch / snapshot reload 周辺に bounded されており、専用 worktree の Coder に first-step code-path spike と修正を委ねられる。
|
||
- `TicketRelationQuery` に durable dependency blocker はない。
|
||
- 以前の OrchestrationPlan `conflicts_with` / `waiting_capacity_note` は `00001KV072V89`(Panel mouse selection)との同時編集 conflict を理由に queued 待機としていたが、同 Ticket は review/merge/validation/cleanup 済みで `done`。現在の Orchestrator worktree は clean で、related implementation Pods/worktrees も cleanup 済み。
|
||
- risk flags は `tui-panel` / `shutdown-latency` / `async-cancellation` だが、Ticket は Quit の authority/invariants と escalation conditions を明記しており、実装前に追加の human decision は不要。
|
||
|
||
Evidence checked:
|
||
- Ticket body / thread / artifacts。
|
||
- relation records: なし。
|
||
- orchestration plan records: 既存 `conflicts_with` / `waiting_capacity_note` を確認し、blocking condition(`00001KV072V89` の未統合)は解消済み。
|
||
- related Ticket `00001KTFMMZP0`: Panel non-blocking transition work は closed で、`PendingReload` / background refresh / attach-return path の背景として参照する。
|
||
- current code/workspace state: `00001KV072V89` と `00001KV04NJ8D` は merge/validation/cleanup 済み。Orchestrator worktree clean。visible spawned implementation Pods なし。
|
||
|
||
IntentPacket:
|
||
|
||
Intent:
|
||
- `yoi panel` / workspace Panel の Quit 操作で、ユーザー入力後に Panel の background reload / notice dispatch / snapshot load / Pod observation など非本質的処理待ちによる断続的な遅延が起きないよう、原因を特定して修正する。
|
||
|
||
Binding decisions / invariants:
|
||
- Quit はユーザーの明示的な終了意思であり、Panel の観測/reload/通知送信完了待ちで遅延してはならない。
|
||
- 端末状態復旧、描画 backend の正常終了、Rust drop による安全な abort など、最小限の終了処理は維持する。
|
||
- Ticket lifecycle authority、Pod authority boundary、Panel row/action semantics、Companion/Orchestrator composer target semantics は変更しない。
|
||
- `resources/prompts` や durable Ticket schema 変更は想定しない。必要になった場合は escalation。
|
||
|
||
Requirements / acceptance criteria:
|
||
- `Ctrl+C` / `Ctrl+D` など現行 Quit 経路が pending background work によって目に見えて遅延しない。
|
||
- 遅延原因と修正方針を implementation report に説明する。
|
||
- 可能な範囲で unit test / regression test を追加し、Quit 経路が pending background work にブロックされないことを検証する。
|
||
- 自動化が難しい場合は manual validation 手順と観測結果を report する。
|
||
|
||
Implementation latitude:
|
||
- まず `crates/tui/src/multi_pod.rs` の event loop / `PendingReload` / Quit handling / terminal event polling / queue-attention notice dispatch / snapshot load を code-path spike する。
|
||
- 修正手段は、不要 await の回避、cancellable background work の abort/drop、event-loop priority adjustment、test seam 追加などから Coder が選んでよい。
|
||
- 再現が難しい場合は遅延し得る code path を単体再現できる test seam を優先してよい。
|
||
|
||
Escalate if:
|
||
- Panel public UX、Ticket lifecycle semantics、Pod shutdown semantics、authority boundary の変更が必要になる。
|
||
- 端末 cleanup や Pod process lifecycle safety を犠牲にしないと遅延を解消できない。
|
||
- 原因が Panel 外(OS terminal / shell / external command / provider/network)にある証拠が出た。
|
||
|
||
Validation:
|
||
- focused test for Quit not waiting on pending background work。
|
||
- `cargo fmt --check`。
|
||
- `git diff --check`。
|
||
- 変更範囲に応じて `cargo test -p tui ...` / `cargo check -p tui --all-targets`。
|
||
- 可能なら manual `yoi panel` Quit observation を report。
|
||
|
||
Current code map:
|
||
- `crates/tui/src/multi_pod.rs`: Panel run loop、Quit key handling、`PendingReload`、background reload / attention notice / snapshot observation paths。
|
||
- `crates/tui/src/workspace_panel.rs`: ViewModel は参照のみ。row/action semantics は変更しない。
|
||
|
||
Critical risks / reviewer focus:
|
||
- Quit を速くするために terminal cleanup / safe abort / Pod lifecycle を壊していないこと。
|
||
- nonessential background work が Quit を block しないこと。
|
||
- Panel/Ticket/Pod authority semantics と row/action semantics が変わっていないこと。
|
||
- Regression test が実際に pending background work block を防ぐ性質を持つこと。
|
||
|
||
---
|
||
|
||
<!-- event: state_changed author: orchestrator at: 2026-06-13T11:27:38Z from: queued to: inprogress reason: orchestrator_acceptance_after_conflict_resolved field: state -->
|
||
|
||
## State changed
|
||
|
||
Ticket evidence、relation records、existing OrchestrationPlan waiting/conflict notes、related completed Panel mouse integration、visible Pod/worktree state、and clean Orchestrator workspace were checked. The prior conflict/capacity blocker is resolved; no durable dependency blockers remain. Implementation can proceed in a dedicated child worktree with a first-step code-path spike and focused regression test before changing Quit behavior.
|
||
|
||
---
|
||
|
||
<!-- event: implementation_report author: hare at: 2026-06-13T11:35:16Z -->
|
||
|
||
## Implementation report
|
||
|
||
Implementation report for Ticket 00001KV0723PC
|
||
|
||
Commit: cfe411e50d7361228e509a18699477b13c4bc3e7 (`fix: avoid panel quit notice wait`)
|
||
|
||
Observed / identified delay cause:
|
||
- In `crates/tui/src/multi_pod.rs`, the workspace Panel run loop handled a completed `PendingReload` before polling terminal input.
|
||
- When the reload result requested Orchestrator queue-attention notification, the loop awaited `dispatch_orchestrator_queue_attention_notice(request)` inline.
|
||
- That dispatch path can wait on Unix socket connect/read/write operations and their timeouts. While it was awaited inline, queued terminal events such as `Ctrl+C` / `Ctrl+D` could not be observed, so an explicit Quit could be delayed by non-essential notice dispatch work.
|
||
|
||
Fix summary:
|
||
- Added `PendingQueueAttentionNotice`, a cancellable background task wrapper for queue-attention notice dispatch.
|
||
- Changed the Panel run loop to start queue-attention notice dispatch asynchronously after reload and only harvest the result when the task is already finished.
|
||
- Added explicit quit cleanup through `abort_panel_background_work_for_quit`, aborting both pending reload and pending queue-attention notice work before returning `MultiPodOutcome::Quit`.
|
||
- Also abort the background notice before foreground open/action paths that already abort reload work, so non-essential notice dispatch does not contend with user-directed operations.
|
||
- Preserved terminal/backend shutdown behavior by keeping the existing return path and relying on explicit abort plus Rust `Drop` cleanup for background tasks.
|
||
|
||
Files changed:
|
||
- `crates/tui/src/multi_pod.rs`
|
||
|
||
Regression coverage:
|
||
- Added `multi_quit_aborts_background_reload_and_notice_without_waiting`, which starts never-completing reload and notice tasks, exercises the quit abort helper under a timeout, and verifies both tasks are cancelled.
|
||
- Existing reload overlap behavior remains covered by `multi_poll_reload_does_not_overlap_in_flight_reload`.
|
||
|
||
Validation commands/results:
|
||
- `cargo fmt --check` — passed
|
||
- `git diff --check` — passed
|
||
- `cargo test -p tui multi_quit_aborts_background_reload_and_notice_without_waiting --lib` — passed
|
||
- `cargo test -p tui multi_poll_reload_does_not_overlap_in_flight_reload --lib` — passed
|
||
- `cargo check -p tui --all-targets` — passed
|
||
|
||
Residual risks / manual validation notes:
|
||
- No broad runtime-loop rewrite was done. Foreground user-directed operations that are already awaited by the Panel can still occupy the loop; this change targets the identified non-essential background notice dispatch delay path.
|
||
- I did not run an interactive manual `yoi panel` session from this Coder environment. Recommended manual check: start `yoi panel`, trigger a reload/queued Ticket condition that would dispatch queue-attention notice, then press `Ctrl+C`/`Ctrl+D` while the notice target is slow or unavailable; the Panel should exit promptly while terminal state is restored.
|
||
|
||
|
||
---
|