Skip to content

fix: レビュースクリプトの TMP_DIR を worktree 内 .cross_review/ に統一#9

Open
takemi-ohama wants to merge 5 commits into
mainfrom
feature/PLAN22-gemini-result-workspace
Open

fix: レビュースクリプトの TMP_DIR を worktree 内 .cross_review/ に統一#9
takemi-ohama wants to merge 5 commits into
mainfrom
feature/PLAN22-gemini-result-workspace

Conversation

@takemi-ohama
Copy link
Copy Markdown
Contributor

Summary

  • gemini CLI の write_file が workspace 外 (~/.gemini/tmp/) への書き込みをブロックする問題を解消するため、レビュースクリプトの一時ファイルディレクトリ (TMP_DIR) を worktree 内 <worktree>/.cross_review/ に移行
  • state.py / monitor.py / _tmpdir.sh_tmp_dir() 関数を統一して git rev-parse --show-toplevel ベースでパスを解決するように変更。サブディレクトリからの実行でもパス不一致が発生しない
  • state.py cmd_init で worktree 作成前に _tmp_dir() を呼んでいた順序依存バグを修正(_tmp_dir()mkdir 副作用で worktree 存在チェックが常に true になる問題)
  • launch スクリプトのコメント・ドキュメントを新パス体系に整合
  • /ndf:merged skill に worktree クリーンアップ手順を追加(.cross_review/ は worktree ごと削除される)
  • .gitignore.cross_review/ を追加

変更ファイル

ファイル 変更内容
plugins/ndf/skills/cross-review/scripts/state.py _tmp_dir()<worktree>/.cross_review/ に変更、_git_toplevel() ヘルパ追加、cmd_init の呼び出し順序修正
plugins/ndf/skills/cross-review/scripts/monitor.py _tmp_dir() を同様に git rev-parse --show-toplevel ベースに変更
plugins/ndf/skills/cross-review/scripts/_tmpdir.sh fallback を git rev-parse --show-toplevel + .cross_review/ に統一
plugins/ndf/skills/cross-review/scripts/launch-codex.sh コメントを新パス体系に更新
plugins/ndf/skills/cross-review/scripts/launch-gemini.sh コメントを新パス体系に更新
plugins/ndf/skills/cross-review/SKILL.md ドキュメント内のパス記述を .cross_review/ 体系に統一
plugins/ndf/skills/cross-review/docs/02-fix-and-rotation.md ドキュメント内のパス記述を更新
plugins/ndf/skills/merged/SKILL.md worktree クリーンアップ手順を追加
.gitignore .cross_review/ 除外ルール追加
issues/PLAN22_cross-review-gemini-result-workspace-constraint.md 設計・修正方針ドキュメント (新規)

Test plan

  • worktree 上で gemini が <worktree>/.cross_review/ に result.json を書き込めることを確認
  • monitor.py<worktree>/.cross_review/ の result.json を検出して正常終了することを確認
  • state.py read-result が result.json を正常に読み取れることを確認
  • .cross_review/git status に表示されないことを確認
  • codex 側のフローに影響がないことを確認
  • /ndf:merged 実行後に対応する worktree が削除されることを確認

Related

takemi-ohama and others added 5 commits May 24, 2026 04:01
gemini CLI の write_file は workspace 内のみ書き込み可能。
~/.gemini/tmp/ は workspace 外のため result.json の書き込みが
ブロックされ NO_RESULT で停止していた。

TMP_DIR を <worktree>/.cross_review/ に変更し workspace 制約を根本回避。
codex の -s workspace-write 緩和は bwrap 非対応環境で不可のため維持。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- state.py: _tmp_dir() 呼び出しを worktree 存在チェック・作成の後に移動。
  _tmp_dir() が mkdir で worktree ディレクトリを副作用で作成し、
  exists() チェックが常に true になる順序問題を解消。
- _tmpdir.sh: $PWD 依存を git rev-parse --show-toplevel に変更し、
  サブディレクトリから実行しても worktree root を正しく特定。
- PLAN22 ドキュメント: After スニペットの .gemini/tmp を .cross_review に統一。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- PLAN22 ドキュメントの "After" コード例を .gemini/tmp → .cross_review に修正
- state.py / monitor.py の docstring から /tmp/ フォールバック記述を削除
- state.py の _tmp_dir() で pathlib.Path に .resolve() を追加し絶対パス化
- monitor.py の _tmp_dir() フォールバックを git rev-parse --show-toplevel ベースに変更
- monitor.py のモジュール docstring の result.json パス記述を更新

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ク (PLAN22 Round 4)

サブディレクトリから実行した場合に os.getcwd() だとパス不一致が発生する問題を修正。
git コマンド失敗時のみ os.getcwd() にフォールバックする。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…nd 5 fix)

- SKILL.md: 状態ファイルパスを /tmp/ → <worktree>/.cross_review/ に更新
- docs/02-fix-and-rotation.md: TMP_DIR 解決順の説明を実装に合わせて更新
- scripts/_tmpdir.sh: コメントの優先順位から削除済みの /tmp/ fallback を除去
- scripts/launch-gemini.sh: コメント内の旧パス ~/.gemini/tmp/ を .cross_review/ に更新

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor Author

@takemi-ohama takemi-ohama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 6 | codex | APPROVE

修正が必要な指摘はありません。

Copy link
Copy Markdown
Contributor Author

@takemi-ohama takemi-ohama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 6 | gemini | APPROVE

  • docs/01-state-and-review.md にも $TMP_DIR の解決順序(env > .cross_review)の注釈を追加することを推奨します。
  • 今回のパス体系変更(v4.7.4 時点の記述の上書き)を反映するため、CHANGELOG への追記(v4.7.5等)を推奨します。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant