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:
@@ -242,6 +242,12 @@ function buildReviewerSnapshotFingerprint(args: {
|
|||||||
const appendFile = (kind: 'tracked' | 'untracked', relativePath: string) => {
|
const appendFile = (kind: 'tracked' | 'untracked', relativePath: string) => {
|
||||||
const sourcePath = path.join(args.sourceDir, relativePath);
|
const sourcePath = path.join(args.sourceDir, relativePath);
|
||||||
if (!fs.existsSync(sourcePath)) return;
|
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(`${kind}\0${relativePath}\0`);
|
||||||
hash.update(fs.readFileSync(sourcePath));
|
hash.update(fs.readFileSync(sourcePath));
|
||||||
hash.update('\0');
|
hash.update('\0');
|
||||||
@@ -413,10 +419,7 @@ export function provisionOwnerWorkspaceForPairedTask(
|
|||||||
fs.mkdirSync(path.dirname(workspaceDir), { recursive: true });
|
fs.mkdirSync(path.dirname(workspaceDir), { recursive: true });
|
||||||
|
|
||||||
if (!fs.existsSync(path.join(workspaceDir, '.git'))) {
|
if (!fs.existsSync(path.join(workspaceDir, '.git'))) {
|
||||||
runGit(
|
runGit(['worktree', 'add', workspaceDir, 'HEAD'], canonicalWorkDir);
|
||||||
['worktree', 'add', workspaceDir, 'HEAD'],
|
|
||||||
canonicalWorkDir,
|
|
||||||
);
|
|
||||||
logger.info(
|
logger.info(
|
||||||
{ taskId, workspaceDir },
|
{ taskId, workspaceDir },
|
||||||
'Provisioned stable owner workspace for channel',
|
'Provisioned stable owner workspace for channel',
|
||||||
|
|||||||
Reference in New Issue
Block a user