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

Fifty concurrent pushes come back 'auth required': test/agents.test.ts is red #531

Closed opened this
Closed without merging

scout/forge:scout/293-fifty-concurrent-pushes-come-back-auth-r → main 5 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
2 files changed +11 −5
forge.json +1 −1
@@ -6,7 +6,7 @@
66 "ready": 90
77 },
88 "check": {
9 "run": "bun x tsc --noEmit && bun scripts/test-shards.ts --timeout 60000 -- crew review-route review-lines review-gate crew-wrapup crew-limits crew-parks crew-sandbox steer session-settle landing decide ledger checks dependencies map-closing autonomy studio studio-words forks fork-flow cross-repo-pull pulls apps apps-adversarial apps-busy apps-token surfaces-adversarial orgs web git-trust helpers shards migrate vitals guard asks feed feed-page offline share cloud run-secrets forge-cloudflare usage tokens credentials standing board board-windows spawn-plan spawn web-apps fleet-ops meter told-by",
9 "run": "bun x tsc --noEmit && bun scripts/test-shards.ts --timeout 60000 -- crew review-route review-lines review-gate crew-wrapup crew-limits crew-parks crew-sandbox steer session-settle landing decide ledger checks dependencies map-closing autonomy studio studio-words forks fork-flow cross-repo-pull pulls apps apps-adversarial apps-busy apps-token surfaces-adversarial orgs web git-trust helpers shards migrate vitals guard asks feed feed-page offline share cloud run-secrets forge-cloudflare usage tokens credentials standing board board-windows spawn-plan spawn web-apps agents fleet-ops meter told-by",
1010 "timeout": 1800
1111 }
1212 }
test/agents.test.ts +10 −4
@@ -30,6 +30,7 @@ import {
3030 import { RateLimiter } from "../src/core/ratelimit.ts";
3131 import { deliveryBusy, runDelivery } from "../src/core/webhooks.ts";
3232 import { Gate, gitGate, runGit } from "../src/git/env.ts";
33 import { gitClientEnv } from "./helpers/git-client.ts";
3334 import { quietLogs } from "./helpers/globals.ts";
3435 import { isBusy, transact } from "../src/kernel/db.ts";
3536 import { repoDir } from "../src/git/repos.ts";
@@ -169,12 +170,16 @@ describe("fifty agents at once", () => {
169170 // through the same pre-receive path a real one takes... except that the
170171 // hook only runs for a transport. So drive real ones, in parallel, over
171172 // HTTP — the socket's backlog is exactly what is under test.
173 // Never inherit the host's git config: a crew machine carries an
174 // `http.extraHeader` with the agent's own forge token, which beats the
175 // `crew:token` in the URL below and is refused here as `auth required`.
176 const env = gitClientEnv();
172177 const clones = await mkdtemp(join(tmpdir(), "forge-agents-push-"));
173178 const remote = `${base.replace("http://", `http://crew:${token}@`)}/crew/swarm.git`;
174179
175180 const clone = await Bun.spawn(
176181 ["git", "clone", "--quiet", remote, join(clones, "work")],
177 { stdout: "ignore", stderr: "pipe" },
182 { stdout: "ignore", stderr: "pipe", env },
178183 );
179184 expect(await clone.exited).toBe(0);
180185 const work = join(clones, "work");
@@ -186,9 +191,10 @@ describe("fifty agents at once", () => {
186191 cwd: work,
187192 stdout: "ignore",
188193 stderr: "ignore",
194 env,
189195 }).exited;
190196 await Bun.write(join(work, `agent-${i}.txt`), `work from agent ${i}\n`);
191 await Bun.spawn(["git", "add", "."], { cwd: work, stdout: "ignore" })
197 await Bun.spawn(["git", "add", "."], { cwd: work, stdout: "ignore", env })
192198 .exited;
193199 await Bun.spawn(
194200 [
@@ -202,7 +208,7 @@ describe("fifty agents at once", () => {
202208 "-m",
203209 `agent ${i}`,
204210 ],
205 { cwd: work, stdout: "ignore", stderr: "ignore" },
211 { cwd: work, stdout: "ignore", stderr: "ignore", env },
206212 ).exited;
207213 }
208214
@@ -210,7 +216,7 @@ describe("fifty agents at once", () => {
210216 Array.from({ length: WRITERS }, (_, i) =>
211217 Bun.spawn(
212218 ["git", "push", "--quiet", "origin", `agent-${i}:agent-${i}`],
213 { cwd: work, stdout: "pipe", stderr: "pipe" },
219 { cwd: work, stdout: "pipe", stderr: "pipe", env },
214220 ),
215221 ).map(async (proc) => ({
216222 code: await proc.exited,

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs