Wait for a claim's fork before cloning it, and run the swarm's tamsin on OpenCode Go's gpt-6-luna
Before adoption: this commit came in with the history the project adopted, so no landing records it.
- Found in the swarm's first live run on dev-oscabriel (804, 16:31 UTC, six claims at once on a seed --as copy of burrow): ivo's claim came back with its fork's remote, but the clone a second later got `remote: no repo …` and `fatal: repository '…' not found`; the fork answered with ivo's token 20 s later. A claim returns before its outbox has made the fork, and an Artifacts fork that fails under load (S7) is made again only at the Project's next alarm, with backoff. ivo's run ended failed with 0 attempts. - prepareWorkspace now tries the clone again while git says the repo is not found: every ForkWait (a Context.Reference, 2 s by default) after the first, FORK_TRIES (30) more at most, about a minute. Any other failure (a 403, an auth error) still fails at once. - Tests, red first by assertion (a planted `times: 0` fails both again): swarm.test.ts "clones again while the fork is not made yet…" (two 404s, then a clone: three clones and a workspace) and "stops waiting for the fork after 30 more tries, and never clones again for any other failure" (31 clones, then SwarmFailed naming the 404; one clone on a 403). Both run live with ForkWait at 1 ms. The fake spawner gives stderr and how many commands came before. - tamsin: OpenCode's ChatGPT sign-in hit its usage limit in the same run (provider.quota, "The usage limit has been reached"); Codex on the same account says it is back on Oct 16, after the deadline, so the take could not run it. tamsin now runs opencode-go/gpt-6-luna (OpenCode Go is signed in; one headless probe answered). Putting openai/gpt-5.5 back is the roster's one line once the plan has headroom (a purchase, the user's). - Tests for the swap, red first (5 failing before the roster changed): the roster's regex for OpenCode's GPT, the dry-run row, the herdr pane's inline config, the driver's start and resume argv, and demo-docs.test.ts's hold on swarm-scenario.md's table. - docs/demo/swarm-scenario.md, rehearsal.md and infra/stages.md say what changed and why, and how to swap back.
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
8 files+156 added−25 removed
- tests:+103 added−13 removed
- other:+53 added−12 removed
Provenance
- Commit
6730a0e- Tree
6224598- Author
oscabriel <oscarhernandeziv@gmail.com>- Committer
oscabriel <oscarhernandeziv@gmail.com>- Parent
25a727e
8 files changed+156 added−25 removed
modified:docs/demo/rehearsal.md+1 added-1 removed
87 unmodified lines8889909192929394959633 unmodified lines87 unmodified lines- [ ] okafor is signed in on the web (`https://web-demo.oscargabriel.workers.dev/auth/signin`), in the browser profile used for S21.- [ ] The staged commits are ready, and nothing else is: - `~/demo/datekit-bram`: a clone of datekit's main with two commits on top, the Do token as an English ordinal (every public test passes), then the one-line change in `examples/datekit/layers/maintainers/known-bad/export.patch`; - `~/demo/datekit-hand`: made during S05, with one README line committed before its push.- [ ] The harnesses are logged in and on the versions rehearsed, and herdr opens a fresh `demo` session. Amp updates first: its interactive mode refuses new threads until it does. Claude Code's auto-updater stays off for the take (`DISABLE_AUTOUPDATER=1` in the environment the swarm starts from), since an update mid-take changes its startup questions. pi is signed in to the `opencode-go` provider pell's qwen flash and the other two pi contributors run on (`pi auth check --provider opencode-go` says `ready`; see [`swarm-scenario.md`](swarm-scenario.md)). herdr's agent names must be unique in a session, so close the last swarm workspace, or start a new session, before the take:- [ ] The harnesses are logged in and on the versions rehearsed, and herdr opens a fresh `demo` session. Amp updates first: its interactive mode refuses new threads until it does. Claude Code's auto-updater stays off for the take (`DISABLE_AUTOUPDATER=1` in the environment the swarm starts from), since an update mid-take changes its startup questions. pi and OpenCode are both signed in to OpenCode Go, which tamsin's and all three pi contributors' models run on (`pi auth check --provider opencode-go` says `ready`, and `opencode auth list` lists OpenCode Go; see [`swarm-scenario.md`](swarm-scenario.md)). herdr's agent names must be unique in a session, so close the last swarm workspace, or start a new session, before the take:
```sh amp update claude --version33 unmodified linesmodified:docs/demo/swarm-scenario.md+2 added-2 removed
9 unmodified lines10 11 | # | Contributor | Harness | Model | Adapter | Child (when all six are open) |12 | --- | --- | --- | --- | --- | --- |13 | 1 | wren | Claude Code, as it ships | `claude-opus-5-5` | none | `drop-legacy-fetch-burrow-auth` |14-| 2 | tamsin | OpenCode | `openai/gpt-5.5` | none | `drop-legacy-fetch-burrow-billing` |14+| 2 | tamsin | OpenCode | `opencode-go/gpt-6-luna` | none | `drop-legacy-fetch-burrow-billing` |15 | 3 | ivo | Amp | `medium` (one of its modes) | none | `drop-legacy-fetch-burrow-catalog` |16 | 4 | marisol | pi | `opencode-go/kimi-k3` | none | `drop-legacy-fetch-burrow-kit` |17 | 5 | dagny | pi | `opencode-go/glm-5.3` | none | `drop-legacy-fetch-burrow-notify` |18 | 6 | pell | pi | `opencode-go/qwen3.8-flash` | the pi adapter (`-e`): the brief, the scope guard and a verdict gate | `drop-legacy-fetch-burrow-search` |19 20-Each handle and model id is the one `scripts/lib/swarm/roster.ts` holds, word for word; the plan prints them (S09), and that printout is what the video shows. pell ran OpenCode Zen's Gemini flash (`opencode/gemini-3.8-flash`) until 2026-10-08, when the swarm's live rehearsal swapped it for `opencode-go/qwen3.8-flash`: pi on this machine has no OpenCode Zen key, and the qwen flash runs headless with the adapter. Putting Gemini back is the one-line swap in the roster, once the key is in pi on the machine that runs the take.20+Each handle and model id is the one `scripts/lib/swarm/roster.ts` holds, word for word; the plan prints them (S09), and that printout is what the video shows. Two models changed in the swarm's live rehearsal on 2026-10-08, each a one-line swap back in the roster. tamsin ran `openai/gpt-5.5` on OpenCode's ChatGPT sign-in until that account's usage limit ran out (ChatGPT says it is back on Oct 16, after the deadline); OpenCode Go's `opencode-go/gpt-6-luna` runs headless in its place. pell ran OpenCode Zen's Gemini flash (`opencode/gemini-3.8-flash`), which pi on this machine cannot reach without OpenCode Zen's key; `opencode-go/qwen3.8-flash` runs headless with the adapter.21 22 Every agent gets the same zero-install brief: the ask as its page says it, the fork's remote, and the loop the project's AGENTS.md gives (claim, work inside the territory, `myr check`, push, read the verdict). Nothing about the gate's internals.23 24 ## The plan for the burrow family69 unmodified linesmodified:infra/stages.md+1 added
122 unmodified lines123 | H6: Workers Paid | Confirmed. | The account's subscriptions, read again on 2026-10-08, list `workers_paid` as Paid. The sandbox (containers) and both Workflows have run on `dev-oscabriel` since 2026-10-07. | Nothing. |124 | H7: the recording | Open (Oct 13). | `docs/demo/` holds the script, the shot list and the rehearsal checklist. The demo stage is deployed and seeded (2026-10-08, 15:44 UTC), with nothing claimed; the rehearsal comes next. The recording lock exists: while `infra/.recording` is there, `infra/deploy.ts` refuses every deploy. | Run `bun infra/recording.ts on` before the first take and `bun infra/recording.ts off` after the last (the rehearsal checklist says when). |125 | H8: submitting | Open, due Oct 14 by noon PDT. | The demo URL is `https://web-demo.oscargabriel.workers.dev` (section 6). | Submit the repo URL, the video and the demo URL. |126 | H9: `docker login` | Not needed so far. No image pull has been rate-limited. | Nothing. | Only if a deploy's image pull is rate-limited: run `docker login` in your own terminal. |127+| ChatGPT usage for the swarm's tamsin | Not blocking: the fallback was taken on 2026-10-08. | OpenCode's ChatGPT sign-in hit its usage limit during the swarm's live rehearsal, and Codex says it is back on Oct 16, after the deadline. The roster now runs tamsin on `opencode-go/gpt-6-luna` (OpenCode Go, signed in). | Nothing. To show `openai/gpt-5.5` in the take instead, raise the ChatGPT plan's limit (a purchase, yours to make) and swap the roster's one line back. |128 | OpenCode Zen key for the swarm's pell | Not blocking: the fallback was taken on 2026-10-08. | pi here still has no OpenCode Zen key, so the roster now runs pell on `opencode-go/qwen3.8-flash`, as it ran in the swarm's live rehearsal on `dev-oscabriel`. | Nothing. To show Gemini flash in the take instead, add OpenCode Zen's key to pi and swap the roster's one line back. |129 | Deleting the throwaways | Open, after the rehearsal. | The teardown plan (section 4). | Read the teardown script and run it in your own terminal. |130 131 ## 6. URLs123 unmodified linesmodified:packages/config/test/swarm-herdr.test.ts+3 added-1 removed
177 unmodified lines178 },179 {180 argv: ["--standalone", "--auto"],181 // OpenCode's interface takes no model flag: its inline config does.182- env: { OPENCODE_CONFIG_CONTENT: '{"model":"openai/gpt-5.5"}' },182+ env: {183+ OPENCODE_CONFIG_CONTENT: '{"model":"opencode-go/gpt-6-luna"}',184+ },185 kind: "opencode",186 },187 {188 argv: [1102 unmodified linesmodified:packages/config/test/swarm-loop.test.ts+2 added-2 removed
916 unmodified lines917 "--format",918 "json",919 "--auto",920 "-m",921- "openai/gpt-5.5",921+ "opencode-go/gpt-6-luna",922 "-s",923 "S-1",924 "Fix it.",925 ],4 unmodified lines930 "--format",931 "json",932 "--auto",933 "-m",934- "openai/gpt-5.5",934+ "opencode-go/gpt-6-luna",935 "Answer it.",936 ],937 },938 {192 unmodified linesmodified:packages/config/test/swarm.test.ts+98 added-10 removed
13 unmodified lines14 import {15 Array,16 ConfigProvider,17 Console,18+ Duration,19 Effect,20 FileSystem,21 Layer,22 Option,23 unmodified lines46 } from "../../../scripts/lib/swarm/results.ts";47 import { roster } from "../../../scripts/lib/swarm/roster.ts";48 import type { Contributor } from "../../../scripts/lib/swarm/roster.ts";49 import { nudges } from "../../../scripts/lib/swarm/scenario.ts";50+import {51+ ForkWait,52+ prepareWorkspace,49-import { prepareWorkspace } from "../../../scripts/lib/swarm/workspace.ts";53+} from "../../../scripts/lib/swarm/workspace.ts";54 import { main } from "../../../scripts/swarm.ts";55 import { Brand } from "../../brand/src/index.ts";56 import { repoRoot } from "./root.ts";57 306 unmodified lines364 365 // An Anthropic id, OpenCode's GPT, an Amp mode, then pi's three.366 const models = [367 /^claude-/u,364- /^openai\/gpt-/u,368+ /^opencode-go\/gpt-/u,369 /^(?:low|medium|high|ultra)$/u,370 /\/kimi-k3$/u,371 /\/glm-5\.3$/u,372 /\/qwen[\d.]+-flash$/u,107 unmodified lines480 481 /**482 * A `ChildProcessSpawner` that runs nothing: it records each command and483 * answers with what `answer` gives it (exit 0 and no output by default).484+ * `answer` also gets how many commands came before this one.485 */486 const fakeSpawner = (482- answer: (spawned: Spawned) => {487+ answer: (488+ spawned: Spawned,489+ before: number490+ ) => {491 readonly code?: number;492 readonly stdout?: string;493+ readonly stderr?: string;494 } = () => ({})495 ) =>496 Effect.gen(function* () {497 const spawned = yield* Ref.make<readonly Spawned[]>([]);10 unmodified lines508 cwd: command.options.cwd,509 env: command.options.env ?? {},510 };511 503- yield* Ref.update(spawned, (calls) => [...calls, call]);512+ const before = (yield* Ref.getAndUpdate(spawned, (calls) => [513+ ...calls,514+ call,515+ ])).length;516 505- const { code = 0, stdout = "" } = answer(call);517+ const { code = 0, stderr = "", stdout = "" } = answer(call, before);518 const out = Stream.make(new TextEncoder().encode(stdout));519+ const err = Stream.make(new TextEncoder().encode(stderr));520 521 return ChildProcessSpawner.makeHandle({522 all: out,523 exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(code)),1 unmodified line525 getOutputFd: () => Stream.empty,526 isRunning: Effect.succeed(false),527 kill: () => Effect.void,528 pid: ChildProcessSpawner.ProcessId(1),516- stderr: Stream.empty,529+ stderr: err,530 stdin: Sink.drain,531 stdout: out,532 unref: Effect.succeed(Effect.void),533 });27 unmodified lines561 });562 563 const wrensToken = "wren-token-0123456789abcdef0123456789abcdef";564 552-/** wren's workspace for run `r1`, below a temp dir, over a fake spawner. */553-const wrensWorkspace = (code = 0) =>565+/** What git prints when the gateway answers 404 for the fork: it is not made yet. */566+const forkNotMade = `remote: no repo ${wrensClaim.fork}567+fatal: repository '${wrensClaim.remote}/' not found568+`;569+570+/**571+ * wren's workspace for run `r1`, below a temp dir, over a fake spawner572+ * whose every clone exits `code`, or answers as `clone` says (given how573+ * many clones came before it).574+ */575+const wrensWorkspace = (576+ code = 0,577+ clone: (before: number) => {578+ readonly code?: number;579+ readonly stderr?: string;580+ } = () => ({ code })581+) =>582 Effect.gen(function* () {583 const fs = yield* FileSystem.FileSystem;584 const swarm = yield* fs.makeTempDirectoryScoped();557- const fake = yield* fakeSpawner(() => ({ code }));585+ const fake = yield* fakeSpawner((_, before) => clone(before));586 587 const [wren] = roster;588 589 const workspace = yield* prepareWorkspace({117 unmodified lines707 expect(reason).toContain(wrensClaim.remote);708 expect(reason).not.toContain(wrensToken);709 }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))710 );711+712+ it.live(713+ "clones again while the fork is not made yet, since the claim returns before its outbox makes the fork",714+ () =>715+ Effect.gen(function* () {716+ // Found live (804): one of six claims at once came back before717+ // Artifacts had its fork, and the clone answered 404.718+ const { spawned, workspace } = yield* wrensWorkspace(0, (before) =>719+ before < 2 ? { code: 128, stderr: forkNotMade } : { code: 0 }720+ );721+722+ expect({723+ clones: spawned.map(({ args }) => args[0]),724+ made: Result.isSuccess(workspace),725+ }).toStrictEqual({726+ clones: ["clone", "clone", "clone"],727+ made: true,728+ });729+ }).pipe(730+ Effect.scoped,731+ Effect.provideService(ForkWait, Duration.millis(1)),732+ Effect.provide(NodeServices.layer)733+ )734+ );735+736+ it.live(737+ "stops waiting for the fork after 30 more tries, and never clones again for any other failure",738+ () =>739+ Effect.gen(function* () {740+ const waited = yield* wrensWorkspace(0, () => ({741+ code: 128,742+ stderr: forkNotMade,743+ }));744+745+ const once = yield* wrensWorkspace(0, () => ({746+ code: 128,747+ stderr:748+ "remote: wren may not read it\nfatal: unable to access it: The requested URL returned error: 403\n",749+ }));750+751+ expect({752+ neverMade: Option.map(753+ Result.getFailure(waited.workspace),754+ ({ reason }) => reason.includes("not found")755+ ),756+ neverMadeClones: waited.spawned.length,757+ refusedClones: once.spawned.length,758+ refusedFailed: Result.isFailure(once.workspace),759+ }).toStrictEqual({760+ neverMade: Option.some(true),761+ neverMadeClones: 31,762+ refusedClones: 1,763+ refusedFailed: true,764+ });765+ }).pipe(766+ Effect.scoped,767+ Effect.provideService(ForkWait, Duration.millis(1)),768+ Effect.provide(NodeServices.layer)769+ )770+ );771 });772 773 describe("the run's summary", () => {774 it.effect(283 unmodified lines1058 ],1059 [1060 "tamsin",1061 "opencode",974- "openai/gpt-5.5",1062+ "opencode-go/gpt-6-luna",1063 children[1],1064 "@burrow/billing",1065 ],1066 ["ivo", "amp", "medium", children[2], "@burrow/catalog"],407 unmodified linesmodified:scripts/lib/swarm/roster.ts+7 added-6 removed
5 unmodified lines6 *7 * The model ids are what this machine's harnesses list and run (2026-10-08):8 * `opencode models` for OpenCode's GPT model, `pi --offline --list-models`9 * for pi's (its ready provider is `opencode-go`), `amp --help` for Amp's10- * modes. OpenCode signed in with a ChatGPT account refuses11- * `openai/gpt-6.1-sol` ("not supported when using Codex with a ChatGPT12- * account"), so tamsin runs `openai/gpt-5.5`, which ran headless.10+ * modes. tamsin ran `openai/gpt-5.5` on OpenCode's ChatGPT sign-in until11+ * that account's usage limit ran out in the swarm's live rehearsal (804,12+ * not back before Oct 16); OpenCode Go's `gpt-6-luna` ran headless in its13+ * place, and putting the ChatGPT model back is tamsin's one line.14 */15 import { Handle } from "@repo/protocol/ids";16 import { Schema } from "effect";17 6 unmodified lines24 /** A fictional person: a key of the stage's `SESSION_TOKENS` (human step H5 on demo). */25 handle: Handle,26 harness: Harness,27 /**27- * Claude Code: an Anthropic model id. OpenCode: `openai/<gpt id>`. Amp: its28- * mode. pi: `<provider>/<id>`.28+ * Claude Code: an Anthropic model id. OpenCode: `<provider>/<gpt id>`.29+ * Amp: its mode. pi: `<provider>/<id>`.30 */31 model: Schema.NonEmptyString,32 });33 21 unmodified lines55 {56 adapter: false,57 handle: Handle.make("tamsin"),58 harness: "opencode",58- model: "openai/gpt-5.5",59+ model: "opencode-go/gpt-6-luna",60 },61 {62 adapter: false,63 handle: Handle.make("ivo"),25 unmodified linesmodified:scripts/lib/swarm/workspace.ts+42 added-3 removed
6 unmodified lines7 * as `<SLUG>_TOKEN`, never in a file, an argv or a URL.8 */9 import { Brand } from "@repo/brand";10 import type { ClaimView } from "@repo/protocol/domain/claim";11-import { Config, Effect, FileSystem, Redacted, Schema, Stream } from "effect";11+import {12+ Config,13+ Context,14+ Duration,15+ Effect,16+ FileSystem,17+ Redacted,18+ Schedule,19+ Schema,20+ Stream,21+} from "effect";22 import { ChildProcess, ChildProcessSpawner } from "effect/process";23 24 import { runDir } from "./results.ts";25 import type { Contributor } from "./roster.ts";146 unmodified lines172 )173 );174 175 /**176+ * How long a clone waits for the claim's fork: one try every `ForkWait`177+ * (2 s unless a test says otherwise) after the first, `FORK_TRIES` more at178+ * most, so about a minute. A claim returns before its outbox has made the179+ * fork, and an Artifacts fork that failed under load is made again only at180+ * the Project's next alarm, with backoff. Found live (804): one of six181+ * claims made at once was cloned too soon.182+ */183+export const ForkWait = Context.Reference<Duration.Duration>("swarm/ForkWait", {184+ defaultValue: () => Duration.seconds(2),185+});186+187+export const FORK_TRIES = 30;188+189+/** git's words when the gateway answers 404: the repo is not there (yet). */190+const NOT_FOUND = /^fatal: repository '.*' not found$/mu;191+192+/** A clone that failed only because the fork is not made yet. */193+const forkNotMadeYet = (ran: Ran) =>194+ ran.code !== 0 && NOT_FOUND.test(ran.stderr);195+196+/**197 * Makes one contributor's workspace for their claim, below `<swarm>/<run>/`:198 *199 * - `bin/<cli>` and `bin/git-credential-<slug>`, shims that run this repo's200 * CLI from source (the helper as `<cli> credential`), first on `PATH`;1 unmodified line202 * helper reads the user's own login (HOME stays the user's: the203 * harnesses' own sign-ins live there);204 * - `clone/`, the claim's fork, cloned with the helper in its config for205 * the platform (after an empty helper that drops any other, as `login`175- * sets it globally), and the person as its author;206+ * sets it globally), and the person as its author; while the fork is not207+ * made yet, the clone is tried again (`ForkWait`, `FORK_TRIES`);208 * - the env: `PATH`, git's non-interactive settings, `XDG_CONFIG_HOME`, and209 * the person's token and platform as `<SLUG>_TOKEN` and `<SLUG>_URL`.210 */211 export const prepareWorkspace = (input: {63 unmodified lines275 redacted: [TOKEN_VARIABLE],276 };277 278 const credential = `credential.${input.platformUrl}`;279+ const forkWait = yield* ForkWait;280 281 const cloned = yield* run({282 args: [283 "clone",11 unmodified lines295 ],296 command: "git",297 cwd: dir,298 env,266- });299+ }).pipe(300+ Effect.repeat({301+ schedule: Schedule.spaced(forkWait),302+ times: FORK_TRIES,303+ while: forkNotMadeYet,304+ })305+ );306 307 if (cloned.code !== 0) {308 return yield* new SwarmFailed({309 reason: scrubbed(8 unmodified lines