fix: skip directories in reviewer snapshot fingerprint to prevent EISDIR

git ls-files can return directory entries (e.g. submodules). readFileSync
on these causes EISDIR error, blocking reviewer trigger for all non-brain
paired channels.
This commit is contained in:
Eyejoker
2026-03-30 00:33:44 +09:00
parent 3899271b9a
commit 09b2ec2b8e

View File

@@ -242,6 +242,12 @@ function buildReviewerSnapshotFingerprint(args: {
const appendFile = (kind: 'tracked' | 'untracked', relativePath: string) => {
const sourcePath = path.join(args.sourceDir, relativePath);
if (!fs.existsSync(sourcePath)) return;
// Skip directories (e.g. submodules listed by git ls-files)
try {
if (fs.statSync(sourcePath).isDirectory()) return;
} catch {
return;
}
hash.update(`${kind}\0${relativePath}\0`);
hash.update(fs.readFileSync(sourcePath));
hash.update('\0');
@@ -413,10 +419,7 @@ export function provisionOwnerWorkspaceForPairedTask(
fs.mkdirSync(path.dirname(workspaceDir), { recursive: true });
if (!fs.existsSync(path.join(workspaceDir, '.git'))) {
runGit(
['worktree', 'add', workspaceDir, 'HEAD'],
canonicalWorkDir,
);
runGit(['worktree', 'add', workspaceDir, 'HEAD'], canonicalWorkDir);
logger.info(
{ taskId, workspaceDir },
'Provisioned stable owner workspace for channel',