fix(review): preflight reviewer binary before creating review runs (#2092)#2767
fix(review): preflight reviewer binary before creating review runs (#2092)#2767ApexYash11 wants to merge 6 commits into
Conversation
| "Bash(git commit:*)", | ||
| } | ||
|
|
||
| // Preflight checks that the claude binary is available on PATH before the |
There was a problem hiding this comment.
we already have a auth check so use that one using GET /api/v1/agents
Response shape:
{
"supported": [
{ "id": "codex", "label": "Codex", "authStatus": "authorized" }
],
"installed": [
{ "id": "codex", "label": "Codex", "authStatus": "authorized" }
],
"authorized": [
{ "id": "codex", "label": "Codex", "authStatus": "authorized" }
]
}
If you want to force fresh probes first:
POST /api/v1/agents/refresh
For one agent:
POST /api/v1/agents/{agent}/probe
authorized is the list of locally installed agents whose latest auth probe returned authorized.
no need to check binary for this agents we already check them initially when daemon starts
use this api to check does the review agents is authorized or not and than add the fallback you are using
…tions; integrate agent checker for preflight validation
|
@nikhilachale review it now!! |
neversettle17-101
left a comment
There was a problem hiding this comment.
Thanks for moving the reviewer failure earlier. I think this still needs a couple of changes before it matches the worker-agent spawn flow.
The preflight currently runs before we know whether a new reviewer launch is needed. In Trigger, an already-approved/current run or an existing same-SHA running run should be a no-op and return the existing review state. With the preflight at this point, that no-op can now fail just because the reviewer binary is currently unavailable. Worker spawn only validates the binary when it is actually about to launch a process, so I think reviewer preflight should move until after the created runs list is known to be non-empty.
Also, the check is not using the same source of truth as worker spawn. Spawn builds the real adapter argv and validates argv[0] immediately before runtime.Create; this PR checks the agent catalog's authorized list instead. The catalog is advisory/stale-prone and includes auth status, so it can reject cases that spawn would not reject, while still not proving the concrete reviewer command's binary is valid. Can we make the reviewer path build/resolve the actual reviewer command and validate the command binary with the same helper/semantics as worker spawn?
One smaller point: Preflight should probably resolve the reviewer adapter too. Right now it can pass based on an agent catalog entry, then still create failed runs later if the reviewer resolver does not have an adapter for that harness.
…reflight checks for reviewer binaries
|
@neversettle17-101 check once now |
neversettle17-101
left a comment
There was a problem hiding this comment.
Two remaining preflight/launch parity concerns from re-review.
| // to start the runtime pane. Uses the same adapter + ReviewCommand path as | ||
| // Spawn. On failure, created runs are marked failed via failRuns so a | ||
| // future trigger can retry. | ||
| if err := e.launcher.Preflight(ctx, harness, worker.Metadata.WorkspacePath); err != nil { |
There was a problem hiding this comment.
This still preflights before we know whether AO needs to launch a new reviewer process. If reviewRow.ReviewerHandleID is alive, the trigger only needs to notify the existing pane, so a missing binary on the current PATH should not block that flow or mark the new run failed. Can we move preflight into the handleID == "" path immediately before Spawn, so it only runs when a fresh reviewer launch is required?
| if len(cmd.Argv) == 0 { | ||
| return fmt.Errorf("reviewer produced empty command") | ||
| } | ||
| if _, err := exec.LookPath(cmd.Argv[0]); err != nil { |
There was a problem hiding this comment.
This checks only cmd.Argv[0], while worker spawn's validation unwraps commands shaped like env KEY=value ... before resolving the real binary. If a reviewer adapter returns env FOO=bar reviewer ..., this would validate env and miss that the reviewer binary is unavailable. Can we share the worker spawn binary extraction/validation semantics here so preflight and spawn stay aligned?
- Move Preflight into the spawn-only path so it does not block Notify when an existing reviewer pane is reusable. - Unwrap leading env KEY=value prefix before exec.LookPath, mirroring the session manager's launchBinary validation. - Add regression guards: preflighted assertions on no-op and notify paths. - Add launcher tests for env-prefixed argv.
|
Thanks for contributing to Agent Orchestrator. This PR is being picked up by the current external contributor on-call pair: If someone is already working on this, please continue as usual. For faster context or live questions, you can also join the AO Discord. Join the session here: Come by if you want to see what is being built, ask questions, or just hang around with the community. |
|
@neversettle17-101 can you review this ?? |
Summary
Fixes #2092 by validating the reviewer binary before creating any
ReviewRunrecords.Previously, if the configured reviewer binary (for example
codexorclaude) was not available onPATH, the review trigger would:ReviewRunrecords in therunningstate.failedwith zero findings.This made an infrastructure failure appear similar to a completed review with no findings.
With this change, reviewer availability is verified before any review runs are created. If the binary is unavailable, the trigger fails immediately with a clear error and no database state is written.
Implementation
ReviewerPreflighterinterface for reviewer adapters.Launcher.Preflight()to perform reviewer availability checks before launching.Trigger()immediately after reviewer harness resolution and before anyReviewRuncreation.failRuns) for failures that occur after a successful preflight (for example process launch failures).Testing
Added regression tests covering:
ReviewRunVerified with:
go test ./internal/review/... ./internal/adapters/reviewer/... -count=1 go build ./... go vet ./...