Repository navigation
Let every Worker fix its own check failures in the same session - #21
Merged
Merged
Conversation
The bridge now pauses a completed Worker turn, Foreman runs the configured checks on the paused workspace, and a failed verdict resumes the same CLI session with the failures (claude --resume, codex exec resume, agy --conversation). No Worker gets a shell, and Foreman's validation after the turn stays the authoritative result. FOREMAN_WORKER_CHECK_ROUNDS (default 2, 0 disables) bounds the rounds; the gate is off when automatic validation correction is off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QNxsX5P27Z5iKd2TVtB8Ej
christopherjnelson
marked this pull request as ready for review
September 29, 2026 16:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before: only Codex had a shell, and even Codex couldn't run the repository's checks, because its workspace has no installed dependencies and no network. Every Worker learned that lint, typecheck or tests failed only after its turn ended. Each failure then cost a new Worker attempt plus an Orchestrator turn, with a fresh context and a 2KB excerpt of the output.
After: when any Worker (Claude Code, Codex or Antigravity) finishes a turn, the bridge pauses it and Foreman runs the configured checks on its workspace. If a check the Worker could have caused fails, the same CLI session is resumed with the command and a head-and-tail output excerpt, so the Worker fixes it with full context, inside the same attempt. No Worker gets a shell, and Foreman's validation after the turn is still the authoritative result.
How: the bridge accepts
metadata.foreman_worker_gate: {max_rounds}on Worker requests. After each completed turn it keeps the taskin_progressand emits aworker_gateactivity event. It serves a complete snapshot while paused, then waits forPOST .../responses/{id}/worker-gate. On a failed verdict it resumes the native session:--resumefor Claude (transcript dirs bound per workspace),exec resumewithout--ephemeralfor Codex, and--conversationfor Antigravity. Foreman sees the activity event during the stream and reuses its existing checks on the paused workspace: snapshot verification, the format step and sandboxed validation. It leaves out checks already red on the base, treats a scope violation as a failure, and posts the verdict. Any infrastructure problem answersskipped, which ends the turn as it is.FOREMAN_WORKER_CHECK_ROUNDS(default 2, max 3, 0 disables) bounds the rounds, and the gate is off when automatic validation correction is off for the run. Each round is logged as aworker.check_roundevent and inmetadata.worker_gate. The Codex capability text no longer implies it can run the repo's tools.Tests: 4 new unit tests, and 5 new bridge tests with fake CLIs in bubblewrap. The bridge tests cover Claude and Antigravity resuming their kept sessions with the feedback, the passed, timeout and cancel paths, and request validation. They also include an end-to-end run where Foreman fails a real check, Codex resumes its session, fixes the check and passes validation, all in one Worker attempt. Typecheck, 644 unit tests, 75 bridge tests and the build pass locally.
Not yet verified against the real CLIs: each harness's native resume through the bridge sandbox (fake CLIs stand in here).
🤖 Generated with Claude Code
https://claude.ai/code/session_01QNxsX5P27Z5iKd2TVtB8Ej
Generated by Claude Code