Skip to content

Stop spending Worker attempts on formatting and environment failures - #19

Merged
christopherjnelson merged 4 commits into
mainfrom
claude/project-thread-nxe33l
Sep 29, 2026
Merged

christopherjnelson merged 4 commits into
mainfrom
claude/project-thread-nxe33l

Conversation

@christopherjnelson

Copy link
Copy Markdown
Member

Before: an Antigravity or Claude Code Worker could not run the formatter, so prettier --check failed on its output, and the retry only got a list of file names to guess from. pnpm run smoke:install ran with no network and failed whatever the Worker wrote. Both failures used up the Worker attempt budget (default 2) without any chance of passing.

After: Foreman can format the Worker's changed files itself before validation, smoke and install-running scripts are suggested with network access, and a check that also fails on the unchanged base commit stops the run with a clear reason instead of sending the Worker back.

How:

  • Format step (src/format-step.ts). This is optional and configured per workspace. The open-repository dialog suggests run format, format:write or prettier:write with an on/off toggle, and FOREMAN_FORMAT_COMMAND sets it from config.
    • After the Worker snapshot is verified, Foreman materializes the snapshot in the validation sandbox, runs the dependency installs from the validation list, then runs the formatter.
    • It reads back only the files the Worker added or modified. Anything else the formatter touched is ignored.
    • The result is re-verified against the pinned base and allowed scope. Validation, the Reviewer, approval and promotion all use the formatted bytes.
    • The evidence records formatting, and the UI shows "Foreman formatted N files".
    • A formatter failure keeps the Worker's snapshot, so validation reports the real problem.
    • It runs on live bridge snapshots only, so recorded replays keep their digests.
    • When the step is configured, the Worker prompt says Foreman formats changed files afterwards.
  • Network for smoke checks (src/repository-inspector.ts). A suggested package script gets network: true when it is a smoke script, is named ...:install, or its body runs a package install, pnpm dlx or npx.
  • Base-commit check (src/baseline-validation.ts).
    • When validation fails on a snapshot with changes, Foreman runs the configured commands, up to and including the last failed check, once against the unchanged base, in the same sandbox. The result is cached on the run by base commit and command digest.
    • Failed checks are marked failsOnBase and get a "Fails on base" badge.
    • If every failure also fails on base, the run stops with an operator reason and does not spend a Worker attempt.
    • If only some failures fail on base, the correction note lists the Worker-caused ones and names the base-failing ones.
    • Promotion still requires every check to pass. Evidence digests are unchanged.

Trade-off to note: a network-enabled smoke script is repository code the Worker may have edited, so it gets the host network. This relaxes the offline default from #15 for those checks. The toggle stays visible per check in the dialog.

Checked locally: pnpm typecheck, pnpm test (623 passing), pnpm build and pnpm test:bridge.

🤖 Generated with Claude Code

https://claude.ai/code/session_018My7bXp2HaVceJHPmVxCpZ


Generated by Claude Code

Since validation went offline by default, a suggested check such as
`pnpm run smoke:install` ran without network and failed whatever the
Worker changed, spending Worker attempts on a failure it could not fix.
Repository inspection now marks a package script network-enabled when
it is a smoke script, is named for an install, or its body runs a
package install, pnpm dlx or npx.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018My7bXp2HaVceJHPmVxCpZ
When validation fails on a Worker snapshot with changes, run the setup
commands plus the failed checks once against the unchanged pinned base
(cached on the run by base + command digest). Failed checks are marked
failsOnBase. If every failure also fails on base, stop the controller with
an operator-facing reason instead of spending a Worker attempt; otherwise
the follow-up note only lists Worker-caused failures and names the
base-failing ones. Promotion and digests are unchanged. UI shows a
"Fails on base" badge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018My7bXp2HaVceJHPmVxCpZ
A check can depend on any earlier configured step, such as a build, not
only on installs. Running just the setup commands and the failed checks
on the base could report a check as failing there when only its
prerequisite was missing, and stop the run. The baseline now runs every
configured command up to the last failed check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018My7bXp2HaVceJHPmVxCpZ
Antigravity and Claude Code Workers only have file tools, so they cannot run the repository formatter and formatter-style checks (prettier --check) fail on their output, wasting retries.

Add an optional, configured format step (src/format-step.ts). After the Worker snapshot is verified and before validation, Foreman materializes it in the validation bubblewrap sandbox, runs the install commands from the validation list and then the format command, reads back only the files the Worker added, modified or renamed (Worker file mode kept, symlinks skipped, everything else the formatter touched ignored), and re-verifies the result against the pinned base and allowed scope. The formatted snapshot is the evidence validation, the Reviewer, approval and promotion use. Any formatter failure keeps the Worker snapshot and records formatting status "failed"; validation reports the real problem. Live bridge snapshots only, so recorded replays keep their digests.

Plumbing: WorkerEvidence.formatting and worker.evidence_verified event, per-run formatCommand snapshot, workspace setup and FOREMAN_FORMAT_COMMAND config, Worker prompt note, repository inspector suggestedFormatCommand, open-repository toggle and evidence line, README, tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018My7bXp2HaVceJHPmVxCpZ
@christopherjnelson
christopherjnelson marked this pull request as ready for review September 29, 2026 15:29
@christopherjnelson
christopherjnelson merged commit d6d3d65 into main Sep 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants