Skip to content
Myr

Read each swarm contributor's status for the swarm's project only

Before adoption: this commit came in with the history the project adopted, so no landing records it.

- scripts/swarm.ts passes `project: options.project` to `runAgent` (711's note for 799). Without it, `status` lists every project's claims and answers and the loop finds the ask by name alone; a `seed --as` copy of burrow (where 804 runs the swarm) holds the same ask names. - Test added in packages/config/test/swarm.test.ts ("reads each contributor's status for the swarm's project only"): a full run where wren's Claude Code replays its recorded start and status has no answer yet, so the loop nudges once and reads status twice; both reads must carry `--project burrow`. Red by assertion before the change (`["status", "--json"]`). `fullRun` gained an optional `otherwise` answer for commands the fake platform does not know. - Merges of W7 merge group 2: build/711-swarm-drivers-and-verdict-loop (b46c422) and build/708-null-answer-codemod (4dd54d8), no conflicts; bun install and fix left no diff (no gen since 598). - verify green (config 210, checks 334; platform entry 1,605,141 of 1,665,000, sandbox 569,484, web JavaScript 2,364,635). One earlier verify run timed out cartridge.test.ts's "is reached by no file outside it" at 5 s under full parallel load (292 ms alone, 1,075 ms in the green run); left for 799 as a flake to watch, no timeout raised.

authored by oscabriel · committed by oscabriel · parent 70e5967 · Browse files · 2 files+64 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+64 added−4 removed

  • tests:+63 added−4 removed
  • other:+1 added−0 removed

2 files+64 added−4 removed

modified:packages/config/test/swarm.test.ts+63 added-4 removed
1063 unmodified lines
10641065/**1066 * `main` without `--dry-run`, over a fake platform: the CLI's `asks`, `ask`1067 * and `claim` answer from the fixtures, git succeeds, and `SESSION_TOKENS`1068 * holds `people`. The ledger and `.swarm/` are temp files.1068 * holds `people`. The ledger and `.swarm/` are temp files. Any other command1069 * (a harness, a workspace's `status`) exits 1 unless `otherwise` answers it.1070 */1071const fullRun = (1072 people: readonly string[],1073 /** The contributor whose claim the platform refuses with `AskFull`, if any. */1073 refused?: string1074 refused?: string,1075 otherwise?: (call: Spawned) => Option.Option<{1076 readonly code?: number;1077 readonly stdout?: string;1078 }>1079) =>1080 Effect.gen(function* () {1081 const fs = yield* FileSystem.FileSystem;1082 const swarm = yield* fs.makeTempDirectoryScoped();
42 unmodified lines
1125 v: 1,1126 });1127 };11281124 const fake = yield* fakeSpawner(({ args, command, env }) => {1129 const fake = yield* fakeSpawner((call) => {1130 const { args, command, env } = call;11311132 if (command === "git") {1133 return args.includes("rev-parse")1134 ? { stdout: "d7064cb4f9f0f0e0d0c0b0a090807060504030201\n" }1135 : {};
5 unmodified lines
1141 {1142 ask: { stdout: shown },1143 asks: { stdout: listed },1144 claim: { stdout: claimFor(ask, env[`${SLUG}_TOKEN`]) },1138 }[verb] ?? { code: 1 }1145 }[verb] ??1146 Option.getOrElse(1147 Option.flatMap(Option.fromUndefinedOr(otherwise), (answer) =>1148 answer(call)1149 ),1150 () => ({ code: 1 })1151 )1152 );1153 });11541155 const printed: string[] = [];
138 unmodified lines
1294 })1295 );12961297 it.effect(1298 "reads each contributor's status for the swarm's project only, since a seeded copy can hold the same ask names",1299 () =>1300 Effect.gen(function* () {1301 const started = yield* fixture(1302 "harness-output/claude-code/start.jsonl"1303 ).pipe(Effect.provide(NodeServices.layer));13041305 // wren's Claude Code starts a session; the platform has no answer1306 // from wren yet, so the loop nudges once and asks status again.1307 const nothingYet = JSON.stringify({1308 command: "status",1309 data: { answers: [], claims: [], handle: "wren" },1310 ok: true,1311 v: 1,1312 });13131314 const answer = ({ args, command }: Spawned) => {1315 if (command === "claude") {1316 return Option.some({ stdout: started });1317 }13181319 if (args[0] === "status") {1320 return Option.some({ stdout: nothingYet });1321 }13221323 return Option.none();1324 };13251326 const { spawned } = yield* fullRun(1327 roster.map(({ handle }) => handle),1328 undefined,1329 answer1330 );13311332 const reads = spawned1333 .filter(({ args }) => args[0] === "status")1334 .map(({ args }) => args);13351336 expect(reads).toStrictEqual([1337 ["status", "--project", "burrow", "--json"],1338 ["status", "--project", "burrow", "--json"],1339 ]);1340 })1341 );13421343 it.effect(1344 "stops before any claim when SESSION_TOKENS has no session for a contributor, naming them",1345 () =>1346 Effect.gen(function* () {1347 const { result, spawned } = yield* fullRun(
14 unmodified lines
modified:scripts/swarm.ts+1 added
436 unmodified lines
437 return yield* runAgent({438 assignment,439 brief: ready.success.text,440 maxContinuations: 3,441 project: options.project,442 timeoutMs: options.timeoutMin * 60_000,443 workspace: ready.success.workspace,444 });445 });
116 unmodified lines