Skip to content

ndf/cross-review: gemini が result.json を TMP_DIR に書けず monitor.py が NO_RESULT を返す #7

Description

@takemi-ohama

概要

ndf:cross-review skill で gemini レビューが result.jsonTMP_DIR (~/.gemini/tmp/pr<N>/) に書き出せず、monitor.pyNO_RESULT (exit 3) を返してループが止まる。メイン側で手動補完しないと進行できない状態。

再現環境

  • plugin: ndf v4.7.2 (skills/cross-review/scripts/launch-gemini.sh)
  • gemini CLI: 0.22.4
  • 実行コマンド: /ndf:cross-review 25
  • worktree: /work/worktrees/pr25
  • TMP_DIR: /home/hammer/.gemini/tmp/pr25

症状

gemini の err.log:

YOLO mode is enabled. All tool calls will be automatically approved.
Loaded cached credentials.
Error executing tool write_file: File path must be within one of the workspace directories: /work/worktrees/pr25

gemini stdout 抜粋 (round 2):

I see, I cannot write outside the workspace. I will write the payload to the root of the current working directory as `gemini-review-pr25-round2-payload.json` and proceed with the review submission.
...
Review posted. Now to create the summary file. I'll write it to the workspace as `gemini-review-pr25-result.json`...

→ レビュー投稿自体は成功するが、result.jsonTMP_DIR ではなく worktree 直下 に書いてしまう。monitor.pyTMP_DIR/gemini-review-pr<PR>-result.json を見るため NO_RESULT 判定になる。

原因

gemini CLI の workspace 制約は --include-directories を渡しても write_file ツールには適用されない (YOLO mode でも workspace 外への書き込みは拒否される)。launch-gemini.sh のプロンプトは $TMP_DIR/gemini-review-pr$STATE_PR-result.json への書き込みを指示しているが、$TMP_DIR は workspace (worktree) の外。

検証:

  • launch-gemini.sh--include-directories \"$TMP_DIR\" を追加 → 効果なし (同じエラー)
  • GEMINI_CLI_TRUST_WORKSPACE=true でも同様

影響

  • 各 round 毎にメイン側で gemini-review-pr<N>-result.jsonTMP_DIR に手書きしないと state.py read-result が失敗する
  • cross-review の "AI 直接投稿 + メイン context 節約" 設計の前提が崩れる
  • 結果として context 消費が増える / 中断リスクが上がる

修正案

案1 (推奨): プロンプトで worktree 内 .gemini-tmp/ に書かせる + launcher で回収

# launch-gemini.sh
GEMINI_LOCAL_TMP=$WORKTREE/.gemini-tmp
mkdir -p \"$GEMINI_LOCAL_TMP\"
# prompt 内の result.json パスを $GEMINI_LOCAL_TMP/gemini-review-pr$STATE_PR-result.json に変更
# gemini 終了後、launcher / monitor.py が TMP_DIR にコピー (もしくは monitor.py が両方を見る)

.gemini-tmp/.gitignore で除外しておけば worktree を汚さない。

案2: monitor.py が TMP_DIR と worktree 直下の両方を探索

互換性は高いが、.gitignore 漏れで worktree に payload/result が残るリスク。

案3: gemini 起動時に worktree を ~/.gemini/tmp/pr<N>/ に bind mount

工数が大きい。

関連

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions