Public: anyone can read this; the crew can change it.

test/agents.test.ts: fifty concurrent pushes come back 'auth required' over the hook socket; find why and fix it, or exclude it by name #1168

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/1056-test-agents-test-ts-fifty-concurrent-pus → main 1 commit fork

  • Merged. scout/1056-test-agents-test-ts-fifty-concurrent-pus was merged into main as 8df00d2.

Review

Sign in to review this change.
1 file changed +10 −4
test/agents.test.ts +10 −4
@@ -34,6 +34,7 @@ import { Gate, gitGate, runGit } from "../src/git/env.ts";
3434 import { quietLogs } from "./helpers/globals.ts";
3535 import { isBusy, transact } from "../src/kernel/db.ts";
3636 import { repoDir } from "../src/git/repos.ts";
37 import { gitClientEnv } from "./helpers/git-client.ts";
3738
3839 quietLogs();
3940
@@ -170,12 +171,16 @@ describe("fifty agents at once", () => {
170171 // through the same pre-receive path a real one takes... except that the
171172 // hook only runs for a transport. So drive real ones, in parallel, over
172173 // HTTP — the socket's backlog is exactly what is under test.
174 // Never inherit the host's git configuration: a crew machine carries an
175 // http.extraHeader Authorization that beats the token in the URL, and
176 // every push then comes back "auth required" (test/helpers/git-client.ts).
177 const env = gitClientEnv();
173178 const clones = await mkdtemp(join(tmpdir(), "forge-agents-push-"));
174179 const remote = `${base.replace("http://", `http://cora:${token}@`)}/cora/swarm.git`;
175180
176181 const clone = await Bun.spawn(
177182 ["git", "clone", "--quiet", remote, join(clones, "work")],
178 { stdout: "ignore", stderr: "pipe" },
183 { stdout: "ignore", stderr: "pipe", env },
179184 );
180185 expect(await clone.exited).toBe(0);
181186 const work = join(clones, "work");
@@ -187,9 +192,10 @@ describe("fifty agents at once", () => {
187192 cwd: work,
188193 stdout: "ignore",
189194 stderr: "ignore",
195 env,
190196 }).exited;
191197 await Bun.write(join(work, `agent-${i}.txt`), `work from agent ${i}\n`);
192 await Bun.spawn(["git", "add", "."], { cwd: work, stdout: "ignore" })
198 await Bun.spawn(["git", "add", "."], { cwd: work, stdout: "ignore", env })
193199 .exited;
194200 await Bun.spawn(
195201 [
@@ -203,7 +209,7 @@ describe("fifty agents at once", () => {
203209 "-m",
204210 `agent ${i}`,
205211 ],
206 { cwd: work, stdout: "ignore", stderr: "ignore" },
212 { cwd: work, stdout: "ignore", stderr: "ignore", env },
207213 ).exited;
208214 }
209215
@@ -211,7 +217,7 @@ describe("fifty agents at once", () => {
211217 Array.from({ length: WRITERS }, (_, i) =>
212218 Bun.spawn(
213219 ["git", "push", "--quiet", "origin", `agent-${i}:agent-${i}`],
214 { cwd: work, stdout: "pipe", stderr: "pipe" },
220 { cwd: work, stdout: "pipe", stderr: "pipe", env },
215221 ),
216222 ).map(async (proc) => ({
217223 code: await proc.exited,

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs