Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-04-21
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# T1 Notes

- Reduce CI risk in the agent-bot lifecycle tests by making the fake review bot daemon stop quickly on TERM/INT.
- Replace the 60-second sleep loop with a short, signal-friendly loop shared through one helper.
- Keep the change test-only and focused on eliminating runner-dependent delay during `agents stop`.
35 changes: 14 additions & 21 deletions test/install.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ function createFakeGhScript(scriptBody) {
return { fakeBin, fakePath };
}

function fakeReviewBotDaemonScript() {
// Keep the fake daemon responsive to stop signals so CI runners do not sit
// inside a 60s sleep if process-group termination falls back to parent-only.
return (
'#!/usr/bin/env bash\n' +
'set -euo pipefail\n' +
'trap "exit 0" TERM INT\n' +
'while true; do sleep 0.2; done\n'
);
}

function initRepo() {
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'guardex-'));
const repoDir = path.join(tempDir, 'repo');
Expand Down Expand Up @@ -1753,13 +1764,7 @@ test('agents command starts review+cleanup bots for the target repo and stops th
fs.mkdirSync(scriptsDir, { recursive: true });

const reviewScriptPath = path.join(scriptsDir, 'review-bot-watch.sh');
fs.writeFileSync(
reviewScriptPath,
'#!/usr/bin/env bash\n' +
'set -euo pipefail\n' +
'while true; do sleep 60; done\n',
'utf8',
);
fs.writeFileSync(reviewScriptPath, fakeReviewBotDaemonScript(), 'utf8');
fs.chmodSync(reviewScriptPath, 0o755);

const pruneScriptPath = path.join(scriptsDir, 'agent-worktree-prune.sh');
Expand Down Expand Up @@ -1815,13 +1820,7 @@ test('agents start reuses running review bot when only cleanup bot is missing',
fs.mkdirSync(scriptsDir, { recursive: true });

const reviewScriptPath = path.join(scriptsDir, 'review-bot-watch.sh');
fs.writeFileSync(
reviewScriptPath,
'#!/usr/bin/env bash\n' +
'set -euo pipefail\n' +
'while true; do sleep 60; done\n',
'utf8',
);
fs.writeFileSync(reviewScriptPath, fakeReviewBotDaemonScript(), 'utf8');
fs.chmodSync(reviewScriptPath, 0o755);

const pruneScriptPath = path.join(scriptsDir, 'agent-worktree-prune.sh');
Expand Down Expand Up @@ -1877,13 +1876,7 @@ test('agents cleanup bot defaults to a 60-minute idle threshold', () => {
fs.mkdirSync(scriptsDir, { recursive: true });

const reviewScriptPath = path.join(scriptsDir, 'review-bot-watch.sh');
fs.writeFileSync(
reviewScriptPath,
'#!/usr/bin/env bash\n' +
'set -euo pipefail\n' +
'while true; do sleep 60; done\n',
'utf8',
);
fs.writeFileSync(reviewScriptPath, fakeReviewBotDaemonScript(), 'utf8');
fs.chmodSync(reviewScriptPath, 0o755);

const pruneScriptPath = path.join(scriptsDir, 'agent-worktree-prune.sh');
Expand Down