test(gbrain-sync): stub pgrep so the pin case is hermetic

The only non-dry-run --code-only child hits #1734's PATH-resolved
autopilot probe. A live host daemon is a correct refuse; the test
cannot inject processRunning. Neutralize pgrep in the fixture bindir
instead of adding a production env hatch.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
y$un_
2026-08-31 20:50:08 +00:00
committed by Garry Tan
co-authored by Cursor
parent ddcd4073ef
commit 924744fed9
+7
View File
@@ -192,6 +192,13 @@ case "$*" in
esac
`);
chmodSync(join(bindir, "gbrain"), 0o755);
// #2685: this case is a real (non-dry-run) --code-only child, so it hits
// detectAutopilot's PATH-resolved `pgrep -f "gbrain autopilot"`. A live
// host autopilot is a correct #1734 refuse — the test cannot inject
// processRunning. Stub pgrep to "no match" so the pin is about the
// symlink, not the operator's daemon. Do not add a production env hatch.
writeFileSync(join(bindir, "pgrep"), "#!/bin/sh\nexit 1\n");
chmodSync(join(bindir, "pgrep"), 0o755);
const r = spawnSync("bun", [SCRIPT, "--code-only", "--quiet"], {
encoding: "utf-8",