Repository navigation
Verification gate: a thread only goes green once its verify command exits 0 (#296) - #331
Merged
currentbits merged 11 commits intoAug 17, 2026
Merged
Conversation
Shared contract so the backend, runner and UI can be built in parallel: - ipc.ts: ThreadInfo.verifyCommand / .verify, VerifyResult, and the threads.setVerifyCommand / threads.runVerify channels. - electron/verify.js: the engine — normalizeCommand, tailLog, runVerifyCommand (spawn + timeout + killTree + capped log tail) and buildFixPrompt (the structured failure bundle handed to the fixer). - devCoder/wireClient: dev-twin and wire client kept in sync. No gate is armed yet; runner wiring and persistence land next. Co-Authored-By: Claude Opus 5 <[email protected]>
…into coder/fork-verification-loop-agents-must-prove-d668f4
…into coder/fork-verification-loop-agents-must-prove-e15d93
…yNow IPC Store migration and createThread default the gate to unarmed. The setter normalizes via the shared engine and does not bump updatedAt. runVerifyNow stores VerifyResult evidence (runId "manual") and refuses an active run.
A thread with verifyCommand no longer lands done on the agent's word. afterSuccessfulTurn runs the command after the checkpoint, stores the VerifyResult as evidence, and either goes green, hands a fix turn back, or lands failed once MAX_FIX_ATTEMPTS is exhausted.
…into coder/verification-loop-agents-must-prove-thei-3f9cdf
Two fixes on the merged runner gate: - The hand-back bound was `attempt + 1 < MAX_FIX_ATTEMPTS`, so the agent got one fix turn while buildFixPrompt told it "Fix attempt 1 of 2". Now `attempt < MAX_FIX_ATTEMPTS` — the prompt's count is the real one. - runStartedAt is cleared at the run terminal, so flipping the thread back to "working" for the verify command left the sidebar showing "Working" with no elapsed time. Restamp on entry, clear on every settle path. Co-Authored-By: Claude Opus 5 <[email protected]>
Let a thread declare its prove-it command and read the latest evidence on the Environment tab. Emptying the field disarms the gate.
…into coder/verification-loop-agents-must-prove-thei-3f9cdf
The runner slice grew its own worktreeHeadSha using execFileSync, which blocks the main process for a git call on every gated turn — the freeze the PR refresher was rewritten to avoid. Use the async gitTryAsync helper the services slice already reaches for. Co-Authored-By: Claude Opus 5 <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…op-agents-must-prove-thei-3f9cdf # Conflicts: # src/wireClient.ts
currentbits
deleted the
coder/verification-loop-agents-must-prove-thei-3f9cdf
branch
October 3, 2026 16:07
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.
Closes the implementation for #296. Today a thread lands
donebecause the agent said it was done. This adds a verification stage distinct from review: the run has to prove it.Shape
A thread carries a
verifyCommand(a shell string, e.g.npm test). When it is set, a run that would landdoneinstead runs that command in the thread's worktree — after the turn checkpoint, so the evidence pins to a sha that already exists.VerifyResultis stored as evidence.MAX_FIX_ATTEMPTS(2) hand-backs, after which the thread landsfailedwith alastErrornaming the command — which badges the sidebar and arms "Retry turn".Why no new
ThreadStatusA verifying thread stays
working. The ask is a gate, not a fourth colour, and a new status would have meant touching every switch in the sidebar, settle and waiting logic for no user-visible gain. It is still working — it just has to finish the proof before it can claim it is done.What changed
electron/verify.js(new) — the engine. Spawns under/bin/sh -c, detached, 10-minute timeout escalating throughkillTree, log tail capped in flight and at rest, plusbuildFixPromptfor the failure bundle. Never rejects: "could not run the tests" is a verification failure like any other, not a crash of the run lifecycle.electron/runner.js— the gate lives inafterSuccessfulTurn, the single choke point every provider (generic, claude, codex, kimi, opencode, workflow) lands through, so no provider path can settle around it. Fix turns are delivered exactly the way orchestrator wake-ups already are, including the catch that landsfailedwhen a turn cannot be delivered at all.electron/store.js/services.js/ipc.js— persistence forverifyCommandandverify, plusthreads:setVerifyCommandandthreads:runVerify(a manual "Verify now" that rejects while a run is active).src/shared/ipc.ts— theVerifyResultcontract: outcome, exit code, timed-out flag, log tail, pinned sha, duration, attempt.Review notes
Three defects were caught reviewing the slices before merge, each fixed in its own commit:
runStartedAtis cleared at the run terminal, so flipping back toworkingfor the command left the sidebar showing "Working" with no elapsed time for however long the suite ran.execFileSync, blocking the main process on a git call every gated turn — the same freeze the PR refresher was rewritten to avoid. Now async, sharing the helper the services layer already uses.Tests
core 38/38 · renderer 795/795 · memory 122/122 · electron 918/919. The single electron failure is the pre-existing
web-integrationreconnect test, unchanged from main's baseline.Not in scope
Embedded-browser click-through (#155) and screenshots/videos as run artifacts (#244) both depend on unlanded work; evidence here is the command's log tail.
VerifyResultis where artifact ids attach once #244 has somewhere to put them. Thread goals declaring required outputs up front (#238) would replace the single command with a contract without changing the gate's shape.