mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-07 22:16:52 +02:00
fix: move prompt temp file outside workingDirectory to prevent race condition
The .prompt-tmp file was written inside workingDirectory, which gets deleted by afterAll cleanup. With --concurrent --retry, afterAll can interleave with retries, causing "No such file or directory" crashes at 0s (seen in review-design-lite and office-hours-spec-review). Fix: write prompt file to os.tmpdir() with a unique suffix so it survives directory cleanup. Also convert review-design-lite from describeE2E to describeIfSelected for proper diff-based test selection. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -161,8 +161,10 @@ export async function runSkillTest(options: {
|
||||
'--allowed-tools', ...allowedTools,
|
||||
];
|
||||
|
||||
// Write prompt to a temp file and pipe it via shell to avoid stdin buffering issues
|
||||
const promptFile = path.join(workingDirectory, '.prompt-tmp');
|
||||
// Write prompt to a temp file OUTSIDE workingDirectory to avoid race conditions
|
||||
// where afterAll cleanup deletes the dir before cat reads the file (especially
|
||||
// with --concurrent --retry). Using os.tmpdir() + unique suffix keeps it stable.
|
||||
const promptFile = path.join(os.tmpdir(), `.prompt-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
||||
fs.writeFileSync(promptFile, prompt);
|
||||
|
||||
const proc = Bun.spawn(['sh', '-c', `cat "${promptFile}" | claude ${args.map(a => `"${a}"`).join(' ')}`], {
|
||||
|
||||
Reference in New Issue
Block a user