Skip to content

Commit d33e109

Browse files
committed
test(at): wrap agents cli invocations for ci stability
1 parent 8491878 commit d33e109

1 file changed

Lines changed: 24 additions & 22 deletions

File tree

‎tests/at/agents-cli.test.ts‎

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -65,28 +65,30 @@ async function runAgentsCli(args: string[], env?: NodeJS.ProcessEnv, stdinData?:
6565
}
6666

6767
return new Promise<CliResult>((resolve) => {
68-
const child = stdinPath
69-
? spawn(
70-
"bash",
71-
[
72-
"-lc",
73-
`${shellQuote(process.execPath)} run src/cli.ts -- agents ${args.map(shellQuote).join(" ")} < ${shellQuote(stdinPath)}`,
74-
],
75-
{
76-
cwd: REPO_ROOT,
77-
env: env ?? createCleanEnv(),
78-
stdio: ["ignore", "pipe", "pipe"],
79-
},
80-
)
81-
: spawn(process.execPath, ["run", "src/cli.ts", "--", "agents", ...args], {
82-
cwd: REPO_ROOT,
83-
env: env ?? createCleanEnv(),
84-
// On CI, a writable stdin pipe for Bun child processes can occasionally
85-
// keep the CLI invocation from closing promptly even though these
86-
// commands never read stdin. Use `ignore` unless stdin is explicitly
87-
// redirected via the shell path above.
88-
stdio: ["ignore", "pipe", "pipe"],
89-
});
68+
const command = [
69+
"exec",
70+
shellQuote(process.execPath),
71+
"run",
72+
"src/cli.ts",
73+
"--",
74+
"agents",
75+
...args.map(shellQuote),
76+
].join(" ");
77+
const child = spawn(
78+
"bash",
79+
[
80+
"-lc",
81+
stdinPath ? `${command} < ${shellQuote(stdinPath)}` : command,
82+
],
83+
{
84+
cwd: REPO_ROOT,
85+
env: env ?? createCleanEnv(),
86+
// Always route through `bash -lc exec ...` because Bun 1.3.8 can
87+
// intermittently hang when a `bun run ...` process is spawned directly
88+
// under this AT harness on CI.
89+
stdio: ["ignore", "pipe", "pipe"],
90+
},
91+
);
9092

9193
let stdout = "";
9294
let stderr = "";

0 commit comments

Comments
 (0)