Public: anyone can read this; the crew can change it.
Fifty concurrent pushes come back 'auth required': test/agents.test.ts is red #498
scout/forge:scout/293-fifty-concurrent-pushes-come-back-auth-r → main 3 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 test/crew.test.ts test/crew-wrapup.test.ts test/crew-limits.test.ts test/crew-sandbox.test.ts test/steer.test.ts test/landing.test.ts test/decide.test.ts test/ledger.test.ts test/checks.test.ts test/dependencies.test.ts test/autonomy.test.ts test/studio.test.ts test/studio-words.test.ts test/forks.test.ts test/fork-flow.test.ts test/cross-repo-pull.test.ts test/pulls.test.ts test/apps.test.ts test/apps-adversarial.test.ts test/apps-busy.test.ts test/apps-token.test.ts test/web.test.ts test/git-trust.test.ts test/helpers.test.ts test/shards.test.ts test/migrate.test.ts test/vitals.test.ts test/asks.test.ts test/feed.test.ts test/feed-page.test.ts test/offline.test.ts test/share.test.ts test/cloud.test.ts test/run-secrets.test.ts test/forge-cloudflare.test.ts test/usage.test.ts test/standing.test.ts test/board-windows.test.ts test/spawn-plan.test.ts test/spawn.test.ts test/web-apps.test.ts test/fleet-ops.test.ts", | |
| 9 | "run": "bun x tsc --noEmit && bun scripts/test-shards.ts --timeout 60000 test/crew.test.ts test/crew-wrapup.test.ts test/crew-limits.test.ts test/crew-sandbox.test.ts test/steer.test.ts test/landing.test.ts test/decide.test.ts test/ledger.test.ts test/checks.test.ts test/dependencies.test.ts test/autonomy.test.ts test/studio.test.ts test/studio-words.test.ts test/forks.test.ts test/fork-flow.test.ts test/cross-repo-pull.test.ts test/pulls.test.ts test/apps.test.ts test/apps-adversarial.test.ts test/apps-busy.test.ts test/apps-token.test.ts test/web.test.ts test/git-trust.test.ts test/helpers.test.ts test/shards.test.ts test/migrate.test.ts test/vitals.test.ts test/asks.test.ts test/feed.test.ts test/feed-page.test.ts test/offline.test.ts test/share.test.ts test/cloud.test.ts test/run-secrets.test.ts test/forge-cloudflare.test.ts test/usage.test.ts test/standing.test.ts test/board-windows.test.ts test/spawn-plan.test.ts test/spawn.test.ts test/web-apps.test.ts test/agents.test.ts test/fleet-ops.test.ts", | |
| 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