概要
ndf:cross-review skill で gemini レビューが result.json を TMP_DIR (~/.gemini/tmp/pr<N>/) に書き出せず、monitor.py が NO_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.json を TMP_DIR ではなく worktree 直下 に書いてしまう。monitor.py は TMP_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.json を TMP_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
工数が大きい。
関連
概要
ndf:cross-reviewskill で gemini レビューがresult.jsonをTMP_DIR(~/.gemini/tmp/pr<N>/) に書き出せず、monitor.pyがNO_RESULT(exit 3) を返してループが止まる。メイン側で手動補完しないと進行できない状態。再現環境
ndfv4.7.2 (skills/cross-review/scripts/launch-gemini.sh)/ndf:cross-review 25/work/worktrees/pr25/home/hammer/.gemini/tmp/pr25症状
gemini の err.log:
gemini stdout 抜粋 (round 2):
→ レビュー投稿自体は成功するが、
result.jsonをTMP_DIRではなく worktree 直下 に書いてしまう。monitor.pyはTMP_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でも同様影響
gemini-review-pr<N>-result.jsonをTMP_DIRに手書きしないとstate.py read-resultが失敗する修正案
案1 (推奨): プロンプトで worktree 内
.gemini-tmp/に書かせる + launcher で回収.gemini-tmp/は.gitignoreで除外しておけば worktree を汚さない。案2: monitor.py が TMP_DIR と worktree 直下の両方を探索
互換性は高いが、
.gitignore漏れで worktree に payload/result が残るリスク。案3: gemini 起動時に worktree を
~/.gemini/tmp/pr<N>/に bind mount工数が大きい。
関連
skills/cross-review/scripts/launch-gemini.sh(v4.7.2)/のファイル名自動補完 (#24) devbase#25) で 2 round 連続で踏みました