From 6380c3d8782794cd9c9262fef48ca6007ffb42b5 Mon Sep 17 00:00:00 2001 From: y$un_ Date: Mon, 24 Aug 2026 18:00:28 -0400 Subject: [PATCH 1/2] 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 --- test/gstack-gbrain-sync.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/gstack-gbrain-sync.test.ts b/test/gstack-gbrain-sync.test.ts index 9948da51ce..10c3de7fc2 100644 --- a/test/gstack-gbrain-sync.test.ts +++ b/test/gstack-gbrain-sync.test.ts @@ -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", From 44dcb7651e4c31e6bc4fda91e9ffbbabadd3d32d Mon Sep 17 00:00:00 2001 From: y$un_ Date: Mon, 24 Aug 2026 18:24:22 -0400 Subject: [PATCH 2/2] test(gbrain-sync): blank inherited GBRAIN_HOME in the pin child Lock paths are checked before pgrep. Spreading process.env let a runner GBRAIN_HOME with a live lock refuse the case before the stub ran. Co-authored-by: Cursor --- test/gstack-gbrain-sync.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/gstack-gbrain-sync.test.ts b/test/gstack-gbrain-sync.test.ts index 10c3de7fc2..d0a484e860 100644 --- a/test/gstack-gbrain-sync.test.ts +++ b/test/gstack-gbrain-sync.test.ts @@ -196,7 +196,9 @@ esac // 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. + // symlink, not the operator's daemon. Blank GBRAIN_HOME so an inherited + // lock under $GBRAIN_HOME/.gbrain cannot refuse before pgrep. Do not add + // a production env hatch. writeFileSync(join(bindir, "pgrep"), "#!/bin/sh\nexit 1\n"); chmodSync(join(bindir, "pgrep"), 0o755); @@ -208,6 +210,7 @@ esac ...process.env, HOME: home, GSTACK_HOME: gstackHome, + GBRAIN_HOME: "", GSTACK_TEST_GBRAIN_LOG: commandLog, PATH: `${bindir}:${process.env.PATH || ""}`, },