Skip to content

feat: add gated three-stage PR review - #5830

Merged
atomantic merged 3 commits into
mainfrom
codex/pr-reviewer-three-stage
Sep 2, 2026
Merged

feat: add gated three-stage PR review#5830
atomantic merged 3 commits into
mainfrom
codex/pr-reviewer-three-stage

Conversation

@atomantic

@atomantic atomantic commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a gated, role-aware three-stage review pipeline for contributor pull requests.

  1. Security Scan — a managed, pinned Llama Prompt Guard screens external content before it reaches a reasoning agent.
  2. Eligibility Gate — a tool-free local model returns a validated binary decision for each PR; only changes tied to an open issue assigned to the PR author proceed.
  3. Code Review & Actions — an optional configured provider/model/thinking-effort stage performs the detailed review in a disposable worktree using a maintained sandbox recipe (currently Codex or Antigravity); the deterministic coordinator owns GitHub mutations.

Safety and configuration

  • Stage contracts keep security-screening output separate from the final review input.
  • Attacker-controlled content is escaped inside the review-data envelope.
  • Author identity, issue state, assignee state, commit SHA, and content fingerprint are revalidated before review or merge actions.
  • Stage 3 accepts only direct CLI providers with an explicit maintained sandbox; unsupported TUI, API, and arbitrary unsandboxed commands fail closed.
  • The selected Stage 3 provider, model, and thinking effort are passed through that provider-specific safe recipe; saved provider arguments and explicit forge/cloud credential or configuration overlays are not inherited.
  • Schedule cards expose stage roles and descriptions, custom tasks can set display-only summaries, and legacy two-stage PR-review schedules migrate safely.

Validation

  • Server focused tests: 674 passed.
  • Client focused tests: 45 passed.
  • Client lint passed.
  • Client production build passed.
  • Repository CI checks passed before this follow-up; fresh CI is required for the rebased head.

@atomantic
atomantic force-pushed the codex/pr-reviewer-three-stage branch 3 times, most recently from 2653ba7 to 13e61eb Compare September 2, 2026 15:02
@atomantic
atomantic force-pushed the codex/pr-reviewer-three-stage branch from 13e61eb to feff432 Compare September 2, 2026 15:39
@atomantic
atomantic enabled auto-merge September 2, 2026 16:33
…d vendor list

The three-stage pr-reviewer pipeline named its own providers: the gate accepted
only an Ollama-backed Claude wrapper, and the final actions stage only codex or
antigravity. An install with just grok — or just a local Claude — could not run
the pipeline at all, and the picker showed an empty provider list with no
explanation.

Stages now declare an execution PROFILE, which maps to one of two enforceable
POSTURES (`no-tool`, `sandboxed-actions`). Each vendor row in providerVendors.js
declares which postures it has a maintained argv recipe for, and eligibility is
the intersection of that table with the install's own enabled providers. Adding
a recipe makes a vendor selectable everywhere at once — picker, spawn-time gate,
and auto-selection — with no vendor names to keep in sync.

- Vendor recipes now cover codex (`--sandbox read-only` / `workspace-write`),
  antigravity (`--mode plan` / `accept-edits` under `--sandbox`), grok
  (`--permission-mode plan --tools ''` / `--sandbox workspace`), and claude
  (tool-free only — it has permission modes but no OS sandbox, so it fails
  closed for the actions stage). Unknown commands still fail closed.
- Claude's tool-free posture is no longer restricted to a local Ollama endpoint.
  The enforced argv (`--restricted --tools '' --permission-mode plan`) is the
  control, and contributor PR content is public. `validatePublicReviewModel`
  keeps the stricter installed-and-tool-free probe where it is meaningful — a
  local runtime — and requires a model id only there, since grok and antigravity
  pick their own.
- `resolveAgentProviderAndModel` routes a public-review stage through the
  posture-eligible set rather than the ordinary pin → active → fallback chain,
  which could swap untrusted content onto a provider with no enforced posture.
  An install with nothing eligible now blocks permanently with an actionable
  reason instead of re-dispatching.
- `GET /api/providers` publishes `publicReviewPostures` per provider; the
  schedule UI filters on it, names the eligible providers inline, and warns when
  a stage has none. Local installed-model filtering applies only to a local
  provider, so a cloud CLI stage can pick from its own catalog.

Also fixes a stage-boundary bug in the same flow: `handlePipelineProgression`
never set `executionProfile`, so stage 3 inherited stage 2's gate profile from
task metadata and would have run under the wrong contract. The profile is now
set-or-cleared per stage, and a restricted pipeline whose next stage declares no
profile fails closed rather than handing public content to an unrestricted agent.
@atomantic
atomantic force-pushed the codex/pr-reviewer-three-stage branch from feff432 to 17d8404 Compare September 2, 2026 17:14
@atomantic
atomantic merged commit 6de5224 into main Sep 2, 2026
7 checks passed
@atomantic
atomantic deleted the codex/pr-reviewer-three-stage branch September 2, 2026 17:27
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.

1 participant