Public: anyone can read this; the crew can change it.
Fifty concurrent pushes come back 'auth required': test/agents.test.ts is red #531
scout/forge:scout/293-fifty-concurrent-pushes-come-back-auth-r → main 5 commits fork
2 files
changed +11
−5
forge.json +1 −1
| @@ -6,7 +6,7 @@ | ||
| 6 | 6 | "ready": 90 |
| 7 | 7 | }, |
| 8 | 8 | "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", | |
| 10 | 10 | "timeout": 1800 |
| 11 | 11 | } |
| 12 | 12 | } |
test/agents.test.ts +10 −4
| @@ -30,6 +30,7 @@ import { | ||
| 30 | 30 | import { RateLimiter } from "../src/core/ratelimit.ts"; |
| 31 | 31 | import { deliveryBusy, runDelivery } from "../src/core/webhooks.ts"; |
| 32 | 32 | import { Gate, gitGate, runGit } from "../src/git/env.ts"; |
| 33 | import { gitClientEnv } from "./helpers/git-client.ts"; | |
| 33 | 34 | import { quietLogs } from "./helpers/globals.ts"; |
| 34 | 35 | import { isBusy, transact } from "../src/kernel/db.ts"; |
| 35 | 36 | import { repoDir } from "../src/git/repos.ts"; |
| @@ -169,12 +170,16 @@ describe("fifty agents at once", () => { | ||
| 169 | 170 | // through the same pre-receive path a real one takes... except that the |
| 170 | 171 | // hook only runs for a transport. So drive real ones, in parallel, over |
| 171 | 172 | // 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(); | |
| 172 | 177 | const clones = await mkdtemp(join(tmpdir(), "forge-agents-push-")); |
| 173 | 178 | const remote = `${base.replace("http://", `http://crew:${token}@`)}/crew/swarm.git`; |
| 174 | 179 | |
| 175 | 180 | const clone = await Bun.spawn( |
| 176 | 181 | ["git", "clone", "--quiet", remote, join(clones, "work")], |
| 177 | { stdout: "ignore", stderr: "pipe" }, | |
| 182 | { stdout: "ignore", stderr: "pipe", env }, | |
| 178 | 183 | ); |
| 179 | 184 | expect(await clone.exited).toBe(0); |
| 180 | 185 | const work = join(clones, "work"); |
| @@ -186,9 +191,10 @@ describe("fifty agents at once", () => { | ||
| 186 | 191 | cwd: work, |
| 187 | 192 | stdout: "ignore", |
| 188 | 193 | stderr: "ignore", |
| 194 | env, | |
| 189 | 195 | }).exited; |
| 190 | 196 | 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 }) | |
| 192 | 198 | .exited; |
| 193 | 199 | await Bun.spawn( |
| 194 | 200 | [ |
| @@ -202,7 +208,7 @@ describe("fifty agents at once", () => { | ||
| 202 | 208 | "-m", |
| 203 | 209 | `agent ${i}`, |
| 204 | 210 | ], |
| 205 | { cwd: work, stdout: "ignore", stderr: "ignore" }, | |
| 211 | { cwd: work, stdout: "ignore", stderr: "ignore", env }, | |
| 206 | 212 | ).exited; |
| 207 | 213 | } |
| 208 | 214 | |
| @@ -210,7 +216,7 @@ describe("fifty agents at once", () => { | ||
| 210 | 216 | Array.from({ length: WRITERS }, (_, i) => |
| 211 | 217 | Bun.spawn( |
| 212 | 218 | ["git", "push", "--quiet", "origin", `agent-${i}:agent-${i}`], |
| 213 | { cwd: work, stdout: "pipe", stderr: "pipe" }, | |
| 219 | { cwd: work, stdout: "pipe", stderr: "pipe", env }, | |
| 214 | 220 | ), |
| 215 | 221 | ).map(async (proc) => ({ |
| 216 | 222 | code: await proc.exited, |
new above
offline