2.0 KiB
2.0 KiB
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 --checkcargo check --workspacecargo test -p pod
範囲外
- cursor 永続化
- ReadPodOutput の protocol/API 変更
- 過去 Pod 探索 / restore tool の実装
- assistant text 以外の structured event 表示