From 90d4c8f5adfd36ef8a75d7c879aae78cf50b922e Mon Sep 17 00:00:00 2001 From: Hare Date: Sat, 23 May 2026 00:53:47 +0900 Subject: [PATCH] docs: track read pod output log entry bug --- TODO.md | 1 + ...5-22-read-pod-output-singular-log-entry.md | 20 ++++++++++++ tickets/read-pod-output-singular-log-entry.md | 32 +++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 docs/report/2026-05-22-read-pod-output-singular-log-entry.md create mode 100644 tickets/read-pod-output-singular-log-entry.md diff --git a/TODO.md b/TODO.md index eb95e789..a9d359cc 100644 --- a/TODO.md +++ b/TODO.md @@ -8,6 +8,7 @@ - Pod: 任意ターンからの Fork(複数ターン巻き戻しを汎用化) → [tickets/pod-session-fork.md](tickets/pod-session-fork.md) - Pod: Inbound PodEvent ハンドリングの重複を統合 → [tickets/pod-inbound-pod-event-dedup.md](tickets/pod-inbound-pod-event-dedup.md) - Pod: 過去 Pod の探索と restore ツール → [tickets/pod-discovery-restore-tools.md](tickets/pod-discovery-restore-tools.md) +- Pod: ReadPodOutput を singular LogEntry 形式に追従 → [tickets/read-pod-output-singular-log-entry.md](tickets/read-pod-output-singular-log-entry.md) - llm-worker のエラー耐性 - ストリーム途中失敗時の継続 → [tickets/llm-worker-stream-continuation.md](tickets/llm-worker-stream-continuation.md) - llm-worker: history append を callback 経由の単一経路に閉じる → [tickets/worker-history-append-contract.md](tickets/worker-history-append-contract.md) diff --git a/docs/report/2026-05-22-read-pod-output-singular-log-entry.md b/docs/report/2026-05-22-read-pod-output-singular-log-entry.md new file mode 100644 index 00000000..8cb7b366 --- /dev/null +++ b/docs/report/2026-05-22-read-pod-output-singular-log-entry.md @@ -0,0 +1,20 @@ +# ReadPodOutput が新しい LogEntry 形式を読めず no new assistant text になる + +## 観測 + +spawned Pod のレビュー出力について、operator が attach すると assistant 出力が見える一方、spawner 側の `ReadPodOutput` は `pod ... running; no new assistant text` を返した。 + +## 原因候補 + +`crates/pod/src/spawn/comm_tools.rs` の `extract_assistant_text` は、`Event::Snapshot` 内の `LogEntry` から assistant text を抽出する際に以下だけを対象にしている。 + +- `LogEntry::SegmentStart { history, .. }` +- legacy plural の `LogEntry::AssistantItems { items, .. }` + +現在の session log は新規書き込みで singular の `LogEntry::AssistantItem { item, .. }` を使うため、新しい assistant 出力が snapshot に存在しても抽出対象にならない。その結果、`ReadPodOutput` は cursor を進めつつ text は空と判断し、以後の read でも見えなくなる。 + +これは entry hash の問題ではなく、session-store の新しい singular LogEntry 形式への tool 側追従漏れと見られる。 + +## 対応 + +`tickets/read-pod-output-singular-log-entry.md` を追加した。`extract_assistant_text` に `LogEntry::AssistantItem` 対応を追加し、singular entry の snapshot から text を返す test を追加する。 diff --git a/tickets/read-pod-output-singular-log-entry.md b/tickets/read-pod-output-singular-log-entry.md new file mode 100644 index 00000000..6830192e --- /dev/null +++ b/tickets/read-pod-output-singular-log-entry.md @@ -0,0 +1,32 @@ +# ReadPodOutput: singular LogEntry 形式への追従 + +## 背景 + +`ReadPodOutput` は spawned Pod の socket に接続して `Event::Snapshot` を読み、差分 cursor 以降の assistant text を抽出する。現在の抽出処理は `SegmentStart.history` と legacy plural の `LogEntry::AssistantItems` だけを見ている。 + +一方、現在の session log は新規書き込みで singular の `LogEntry::AssistantItem` を使う。実際に attach では assistant 出力が見えているのに、spawner 側の `ReadPodOutput` が `no new assistant text` を返す事象が確認された。これは hash cursor の問題ではなく、`extract_assistant_text` が新しい LogEntry 形式を読めていないことが主因と見られる。 + +## 要件 + +- `crates/pod/src/spawn/comm_tools.rs` の `extract_assistant_text` を現在の `LogEntry` 形式に追従させる。 + - `LogEntry::AssistantItem { item, .. }` を assistant text 抽出対象に含める。 + - legacy `AssistantItems` と `SegmentStart.history` の扱いは維持する。 + - 必要なら `SystemItem` / tool result / reasoning item は対象外でよいが、assistant message item の取りこぼしはなくす。 +- `ReadPodOutput` の cursor は item index ベースのままでよいが、抽出対象を見落として cursor だけ進む退行を test で防ぐ。 +- attach/TUI に見える assistant output と `ReadPodOutput` の結果が乖離しないようにする。 + +## 完了条件 + +- singular `LogEntry::AssistantItem` を含む snapshot に対して、`ReadPodOutput` が assistant text を返す unit/integration test を追加する。 +- legacy `LogEntry::AssistantItems` の既存 test が引き続き通る。 +- cursor の2回目 read は引き続き `no new assistant text` になる。 +- `cargo fmt --check` +- `cargo check --workspace` +- `cargo test -p pod` + +## 範囲外 + +- cursor 永続化 +- ReadPodOutput の protocol/API 変更 +- 過去 Pod 探索 / restore tool の実装 +- assistant text 以外の structured event 表示