[#778] fix-source-review-issues#779
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughGit worktreeのlinked-worktree判定で参照クローン戦略を切り替え、シャロー参照のフォールバックと中断メッセージを整理しました。repertoire add は mkdtempSync ベースの安全な一時ディレクトリへ移行し、パス包含判定を isPathInside に置き換え、関連テストを追加・拡張しています。 ChangesWorktree gitdir解決とclone参照パス修正
セキュアな一時ディレクトリ処理
パス境界検証のWindows対応化
🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
レビューしました。今回の3件のうち、Windows パス境界チェックと 一方で、worktree の 相対 TAKT の shared clone 隔離では、AI エージェントに元 repo / 親 repo のパスを見せないことが重要です。実運用上、元 repo のパス情報がログや文脈に少しでも混ざると、AI がそちらを探索・修正対象にしてしまう事故が起きます。docs/task-management.md でも「Agents work entirely within the clone directory, unaware of the main repository」という前提になっているため、main repo の実パスを TAKT 側で復元して露出する方向は避けたいです。 マージ前に以下を対応してください。
結論として、この PR は現時点では Request changes です。worktree 部分の隔離方針を直した上で再確認したいです。 |
Summaryタスク指示書: PR #779 の worktree shared clone 隔離方針を修正する目的PR #779( 参照資料
高優先度
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/infra/task/clone.ts`:
- Around line 190-196: Prefetch aborts are being swallowed, allowing execution
to continue after the AbortSignal fires; update the catch after
runGitCommandAbortable(projectDir, ['fetch', 'origin', branch], abortSignal) to
rethrow when the operation was aborted (check abortSignal.aborted or detect an
AbortError from the caught error) and only log non-abort failures, so that
aborts stop execution and do not proceed to subsequent branch checks or clone
logic.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: fc6ea326-bcbe-4137-821f-3b89d7023b3b
📒 Files selected for processing (5)
src/__tests__/clone-isolation.test.tssrc/__tests__/clone.test.tssrc/infra/task/clone-errors.tssrc/infra/task/clone-exec.tssrc/infra/task/clone.ts
| try { | ||
| await runGitCommandAbortable(projectDir, ['fetch', 'origin', branch], abortSignal); | ||
| } catch (err) { | ||
| } catch { | ||
| log.info('Failed to prefetch branch from origin, continuing', { | ||
| branch, | ||
| error: String(err), | ||
| }); | ||
| } |
There was a problem hiding this comment.
中断された prefetch を握りつぶさないでください。
ここは runGitCommandAbortable() の中断エラーまで通常の prefetch 失敗として扱ってしまうので、AbortSignal 発火後も後続の branch 判定や clone が続行されます。abort は先に再送出しないと、キャンセル済みタスクが clone を作り始める経路が残ります。
修正案
import {
cloneAndIsolate,
cloneAndIsolateAbortable,
fetchRemoteBranchIntoIsolatedClone,
fetchRemoteBranchIntoIsolatedCloneAbortable,
resolveCloneSubmoduleOptions,
runGitCommandAbortable,
} from './clone-exec.js';
+import { isTaskAbortError } from './clone-errors.js';
...
try {
await runGitCommandAbortable(projectDir, ['fetch', 'origin', branch], abortSignal);
- } catch {
+ } catch (err) {
+ if (isTaskAbortError(err)) {
+ throw err;
+ }
log.info('Failed to prefetch branch from origin, continuing', {
branch,
});
}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/infra/task/clone.ts` around lines 190 - 196, Prefetch aborts are being
swallowed, allowing execution to continue after the AbortSignal fires; update
the catch after runGitCommandAbortable(projectDir, ['fetch', 'origin', branch],
abortSignal) to rethrow when the operation was aborted (check
abortSignal.aborted or detect an AbortError from the caught error) and only log
non-abort failures, so that aborts stop execution and do not proceed to
subsequent branch checks or clone logic.
Summary
確認範囲
/home/opa/work/taktFindings
High: worktree の
.gitrelativegitdir:を process cwd 基準で解決しています。src/infra/task/clone-exec.ts:42gitdir:相対パスは.gitファイルのあるディレクトリ基準です。現在はpath.resolve(worktreePath, '..', '..')と cwd 依存の解決になり、別ディレクトリから実行すると main repo を誤認して--referenceclone が壊れます。path.dirname(gitPath)基準で解決してください。Medium: root 配下判定が
/固定で Windows path を壊します。src/features/repertoire/takt-repertoire-config.ts:194realPath.startsWith(realRoot + '/')は Windows の\separator で valid child path を拒否します。既存の path boundary helper かpath.sep/path.relativeベースにしてください。Medium: repertoire add の temp path が時刻ベースで予測可能です。
src/commands/repertoire/add.ts:71takt-import-${Date.now()}を作るため、衝突や symlink race の余地があります。fs.mkdtempSync(path.join(tmpdir(), 'takt-import-'))を使ってください。Execution Report
Workflow
takt-defaultcompleted successfully.Closes #778
Summary by CodeRabbit
テスト
バグ修正
変更