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

A preview of the forge runs a live crew against a copy of production's data #407

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A forge booted with `FORGE_APP_ENV=preview` no longer starts the crew, so a preview of the forge stops planning, dispatching runs or spending money. `test/autonomy.test.ts` and `test/studio.test.ts` pass (166 tests). I did not run the full `forge.json` check. `bun x tsc --noEmit` fails here because the `bun` type definitions are missing, so the type check is unverified.

shipped production is serving it deploy d5b2fe2

opened this

A forge booted with FORGE_APP_ENV=preview no longer starts the crew, so a preview of the forge stops planning, dispatching runs or spending money. test/autonomy.test.ts and test/studio.test.ts pass (166 tests). I did not run the full forge.json check. bun x tsc --noEmit fails here because the bun type definitions are missing, so the type check is unverified.

  • The switch: the new src/crew/preview.ts holds crewOffInPreview(). It is true only when FORGE_APP_ENV is preview (trimmed, case-insensitive) and FORGE_CREW_IN_PREVIEW is not 1. It reads the platform's variable, not the hostname. A missing or unknown value counts as production, so the existing crew tests, which boot without the variable, behave as before.
  • Boot: src/main.ts skips startCrew when the switch is on and logs "the crew is off in a preview" once, naming the override variable. Checks, pages, the previews list, the API and the terminal are untouched.
  • Tick: autonomyTick returns immediately in a preview, as a second guard.
  • Studio: the autonomy card on the crew settings page reads "The crew is off in a preview…" in place of the ordinary idle or paused state. This note is not covered by a test.
  • README: the override is documented under "The crew".
  • Tests: test/autonomy.test.ts covers the switch (preview, production, unset, override), and a tick that makes no database queries in a preview but does without the variable. I did not run these two against the old tree to confirm they fail there.

Not done:

  • Crew roster card: it is unchanged. The note sits on the autonomy card, where idle and paused are already shown.
  • Test coverage of startCrew: no test boots main.ts with the variable. The decision is a one-line call to the tested function.

To try it, run FORGE_APP_ENV=preview bun run src/main.ts; the boot log shows the crew-off line.

🤖 Generated with Claude Code

Closes #297

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs