feat: Add strict guardrails for Cloud Code Reviewer to prevent it from pushing code#649
Merged
alex-alecu merged 15 commits intomainfrom Mar 2, 2026
Merged
Conversation
Contributor
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (8 files)
|
jeanduplessis
approved these changes
Feb 27, 2026
RSO
reviewed
Feb 27, 2026
Contributor
RSO
left a comment
There was a problem hiding this comment.
I'm not sure if I'm the right person to decide on whether this is a good idea or not 🤔. Did you test this locally?
…atterns (workspace.ts)
…atterns (session-service.ts)
RSO
approved these changes
Mar 2, 2026
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.
Code Review Read-Only Guardrails
The Cloud Code Reviewer currently runs with the same permissions as a regular cloud agent session. That means the LLM can
git push,npm install, merge PRs, or run test suites — none of which it should be doing during a review.This PR locks down code-review sessions to read-only. It works by detecting
createdOnPlatform: 'code-review'and applying a strict command policy before the Kilo CLI session starts.What changed
Command policy for code-review sessions — When a session is created with
createdOnPlatform === 'code-review', the Kilo config now gets a restrictedautoApprovalblock:ls,cat,grep,git,gh,find, etc.).git commit,git push,git merge,gh pr merge,npm install,pytest, and ~20 more patterns.This is applied in three places to cover all session-creation paths:
cloud-agent/src/workspace.ts— the legacy cloud-agent path. The previously inlined allow/deny lists are refactored into agetCommandPolicy()function that returns either the default policy or the read-only one.cloud-agent-next/src/session-service.ts— the cloud-agent-next path. Same idea, newgetCommandGuardPolicy()function that builds the restricted config block.cloudflare-code-review-infra/src/code-review-orchestrator.ts— the orchestrator now passescreatedOnPlatform: 'code-review'when callingprepareSession, and logs a warning whenever the agent requests execution of a command matching the risky patterns (for observability, not blocking — the blocking happens in the CLI config).createdOnPlatformthreaded through session state — The cloud-agent session service now persistscreatedOnPlatformin metadata so the policy can be re-applied on warm starts and session resumption.