Automating Pull Request Review With Cloud-Hosted Coding Agents
Agents need persistent repository context and audit trails to review code reliably at scale.

A well-formed pull request from a coding agent creates a specific temptation: the diff reads clean, the tests pass, and the instinct is to approve it fast and move to the next one. When agents can open pull requests faster than any human team can read them carefully, it's the review queue, not the writing of code, that becomes the rate-limiting step in shipping software. The reviewer's job has changed in the process: the question is no longer whether code compiles or passes lint, but whether the change makes sense inside a system the team already owns, and answering that requires more than reading the diff in front of you. Agents are particularly good at producing code that looks correct in isolation but introduces a second pattern where one already exists: a new HTTP client alongside an established one, or a duplicate error handler that bypasses shared retry logic, which is a class of problem a diff-only reviewer misses. Review infrastructure hasn't caught up to the volume and shape of what agents produce.
What an automated PR reviewer has to get right
Useful automated review depends on three things working together: seeing beyond the diff, suppressing noise, and producing findings that are traceable and actionable. Most lightweight or ad-hoc approaches fail at least one of them, and the failure is rarely obvious until the tool has already been running for months. Context depth is the primary quality driver. Repository context sources include definitions of called functions, related test files, recent commits to the same paths, repository instruction files, and linked issue requirements, none of which an agent running only against the diff can see.
Signal-to-noise ratio is the survival criterion for any automated reviewer at scale. Sourcegraph's evaluation framework weights false-positive rate heavily, because it treats that as the primary filter for whether a tool survives contact with a large engineering organization. Traceability closes the loop: findings need to be attributable to a specific model, a specific run, and a specific trigger, so engineering and compliance teams can audit what the agent said and why it said it. You will see the rest of this piece measure cloud-hosted infrastructure against that standard.
Why repository context is hard to get right
Understanding a change inside its system takes more than reviewing a diff, so you need persistent, indexed access to the full repository, not a cleverer prompt. Files like AGENTS.md and CLAUDE.md give agents explicit repository conventions, and a study of code review agents looks at how agents use or miss that context on real pull requests.
An agent that treats every PR as a blank slate produces findings that are locally correct but architecturally wrong for the codebase, the same failure mode as the agent that wrote the code in the first place. Persistent repository indexing, maintained across PRs rather than rebuilt from scratch per session, is what lets an agent know that a utility already exists, that a pattern was deliberately avoided, or that a dependency was previously rejected. Without that continuity, an agent has no way to distinguish a genuine improvement from a regression to something the team already tried and abandoned. Repository context, by this standard, is an infrastructure commitment, not a checkbox a vendor can claim on a feature list.
What empirical studies show about agent-assisted review in practice
The empirical record on AI-assisted PR review is mixed. Agents can accelerate review throughput, but speed gains do not automatically translate to better review quality, and the patterns that hurt most only become visible at scale. An empirical study of code review agents covering a large set of real GitHub pull requests found that agent-involved collaboration patterns led to faster review decisions under what the study terms Gradual AI Adoption and Rapid AI Agent Adoption, but efficiency gains did not translate into better review quality by the study's own measures. That distinction matters: a team can plausibly speed up its review cycle time while the substantive quality of what gets approved stays flat or declines.
Research on AI-to-AI code reviews examines a pattern becoming common as agent-authored PRs proliferate: agents reviewing other agents' code, often because automated review is the only coverage that scales to the volume being produced. The objection that agents will simply get better over time is true as far as it goes, but it misses the binding constraint. Review scales safely on the basis of context access, noise control, and auditability, which are infrastructure problems that a better model running inside the same ad-hoc setup does nothing to fix.
Limits of Running a Review Agent Locally or as a CI Script
A coding agent can work well on a developer's laptop or as a one-off CI step, but it breaks down when it needs to run consistently, cheaply, and accountably across an entire engineering organization. Local agents lack persistent repository context: every session starts cold, with no memory of prior reviews, prior rejections of a dependency, or prior decisions about a pattern, which is precisely the continuity that makes a reviewer trustworthy over time rather than merely plausible in the moment. CI-hosted agents introduce a different failure mode, because they share runner environments: credentials are available to any step, sandboxing is minimal, and a review agent running in the same environment as a deployment step gains access it should never need. Claude Code's sandbox is off by default, so most CI/CD integrations of Claude Code today run completely unsandboxed, and that matters because an agent set up this way holds read/write access to repository and deployment tooling.
Cost visibility disappears without a centralized control point. Each agent session calls the LLM provider API directly, so there is no per-PR attribution, no budget enforcement, and no signal until the monthly invoice arrives. This pattern has already played out at organizational scale. Uber rolled out Claude Code to a large engineering population, and by April it had burned through its entire annual AI budget. If a single developer generates agentic review at high volume, you may not see the costs this produces for weeks. These are arguments against running agentic review without the infrastructure that makes its cost and behavior visible as it happens.
What cloud-hosted infrastructure provides for a review agent
Cloud-hosted execution addresses the context, noise, and auditability problems together, because it separates the agent's reasoning from the environment it touches and keeps a complete record of everything that happens in between. Isolated sandboxes per session mean the review agent cannot accidentally affect the environment it is examining: it can read the full repository, run tests, and inspect CI output without touching production infrastructure or inheriting credentials from adjacent pipeline steps. The underlying design principle is straightforward: the agent can do anything cheap to undo and easy to review, while humans retain anything hard to undo or hard to see. A per-session sandbox with minted, scoped, and revoked credentials enforces that boundary at the infrastructure level.
Persistent repository indexing, maintained by the platform rather than rebuilt per session, gives the agent the accumulated context it needs: prior reviews, rejected patterns, known conventions. Local or ad-hoc scripts typically lose that context between runs, so their findings can look right in the moment but miss what happened before.
Full observability of every tool call, diff, and token spent is what makes a finding attributable to a specific model, a specific run, and a specific trigger. Platforms like Ellipsis run agents in governed cloud sandboxes with complete audit logs of every tool call and finding, so you get this lineage by design, but lightweight or local approaches rarely give you that. That lineage satisfies audit requirements and also makes it possible to tune noise controls against a complete record. If budget controls are enforced at the session and day level at the infrastructure layer rather than reconstructed after the fact, you can prove what a review agent cost and that it was prevented from costing more, not just believe what it cost.
Configuring a PR review agent as governed infrastructure with YAML
The most direct way to define an AI coding agent as a version-controlled config file, rather than as a script someone has to maintain by hand, is to declare it entirely in YAML and commit that file to the repository it governs. Defining a PR review agent this way is the mechanism that makes the agent's behavior reviewable, versioned, and auditable in the same way as any other engineering decision a team makes. A review agent defined as code has a trigger, typically a PR push event, a model, a prompt encoding the team's review priorities, an environment scoped to the relevant repository, and a session-level budget cap, and all of these are visible in the diff whenever they change.
Ellipsis lets teams define agents exactly this way: a YAML file lives in the repo, deploys on merge, and triggers on GitHub events, with per-session, per-day, per-week, and per-month budget fields and full log download available afterward. The platform's review-agent.yaml example shows a PR-triggered agent scoped to a specific repository with a spend constraint declared inline, so the budget is part of the same file that defines what the agent does. Secrets belong in the platform's credential management layer, minted per session and revoked on completion, not embedded in a file an LLM reads as context.
The YAML config also functions as the change-control surface for the agent itself. When a team wants to adjust review scope, noise thresholds, or the model in use, the change goes through a pull request: reviewed, discussed, and merged like any other engineering decision, rather than applied through a settings UI that leaves no trace. Ellipsis's platform shows this directly: an agent.yaml diff replacing Claude Code and an Anthropic model with Codex and an OpenAI model is a single field change, with the rest of the agent config unchanged.
Governance requirements that apply specifically to agents with code-review access
When an agent has read/write access to source control, CI output, and repository history, it carries a risk profile that standard agent governance frameworks were not built to address, so teams deploying at scale without accounting for it are taking on risks they have likely not fully scoped. Coding agents that connect to source-control platforms, CI/CD pipelines, and cloud APIs with read/write access create non-human identities, and those identities need the same policy enforcement as human ones: scoped permissions, revocation at session end, and audit trails that satisfy SOC 2 and comparable frameworks. The 2026 supply chain security guide builds agentic governance around exactly this principle: it applies security policies to non-human identities and makes sure every action traces back to a specific model version and prompt, with guardrails that stop an agent from pulling an unvetted package even when that package is the fastest path to finishing the task.
Multi-agent review pipelines, where one agent triages, another reviews, and a third synthesizes, are particularly hard to audit, because failures can occur in the handoff between agents and a finding's provenance may span several model calls and tool invocations. One anti-pattern appears often enough to call out directly: embedding credentials in AGENTS.md or CLAUDE.md. The platform is SOC 2 Type I certified.
A production-ready PR review agent end to end
A PR review agent that is genuinely production-ready does more than make a single model call against a diff. It is a governed workflow: triggered by a repository event, running in an isolated sandbox with scoped credentials, drawing on persistent repository context, enforcing noise controls, and producing findings that are logged, attributable, and auditable at every stage. The trigger is declarative, a PR push event defined in a YAML config rather than a cron job or a manual invocation, so the agent runs on every qualifying PR without human scheduling, and the triggering condition itself stays reviewable in the repo.
The environment is isolated per session. The sandbox has access to the repository and the CI output the review requires and nothing beyond that: no production credentials, no shared runner state, no residual context carried over from a previous PR's session. The context layer is what separates a capable reviewer from a reader of diffs: repository instruction files establish conventions, prior review history informs what gets suppressed as noise, and the linked issue or ticket supplies the requirement the implementation is supposed to satisfy. Research on knowledge-based pull requests proposes a workflow for agent-mediated software collaboration where you treat external code and agent traces as a structured knowledge package, not by default as a merge candidate, and this framing matters for any team designing this context layer from scratch.
Budget controls are declared at the session and day level in the YAML config, enforced by the platform, and visible in the same audit log as the agent's findings, so cost is governed with the same rigor as behavior. The output of a session is a complete session record: every tool call, every diff examined, every token spent, downloadable, retainable for as long as the team's compliance posture requires, and attributable to the specific trigger that launched it. That standard yields a concrete test for whether a review agent has actually reached production readiness: can an engineering leader or an auditor, looking at one specific PR comment, trace it back to the model version, the session, the trigger, the budget it consumed, and the repository context it had access to at the time. If that trace cannot be reconstructed, the agent is still a prototype, regardless of how good its findings happen to look on any given day.


