Skip to content

fix(cli): API レスポンスの無検証キャストと版照会手段の欠如で版違いデーモンに静かに誤動作する #1357

Description

@Kewton

事象

CLI(send / wait / respond / capture / instances / ls / report)は稼働デーモンへ HTTP で話すが、API レスポンスを無検証で型キャストしており、版違いのデーモンに対して静かに誤動作する。CLI がデーモンの版を照会する手段(version / health エンドポイント)も存在しない。

原因

  • src/cli/utils/api-client.ts:199-211get<T>: (await response.json()) as T(無検証キャスト)
  • :223-239, 252-267 — post/patch: JSON.parse(text) as T(同様)
  • 版ヘッダ・シェイプ検証はどこにも無い
  • src/app/api/ 配下に version / health 系エンドポイントが無い(update-check はあるが CLI から版照合には使われていない)

具体例

src/cli/utils/agent-instances.ts:26-28worktree.agentInstances ?? [] — 旧デーモンが agentInstances フィールドを返さない場合、無音で空配列になり「No agent instances found」と表示される(実在するのに)。エラーではなく「静かに間違った答え」になるのが問題。

失敗シナリオ

#1337 の状況(新 CLI + 旧デーモン、またはその逆)で、レスポンス形状の差分が誤った既定値・undefined アクセスとして現れる。利用者にもエージェント(CLI を自動操作する側)にも版ずれが見えない。

対策案

関連

優先度

中。

確信度

コード確認済み。


この Issue は #1337#1341 の真因分析から横展開した潜在バグ調査(2026-07-17)により検出。

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions