Skip to content

feat(pi): add code review mode - #5577

Merged
icecrasher321 merged 7 commits into
stagingfrom
feature/pi-cloud-code-review
Jul 20, 2026
Merged

feat(pi): add code review mode#5577
icecrasher321 merged 7 commits into
stagingfrom
feature/pi-cloud-code-review

Conversation

@BillLeoutsakosvl346

@BillLeoutsakosvl346BillLeoutsakosvl346 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Extends the Pi Coding Agent from PR creation into a complete repository workflow with three user-facing modes:

  • Create PR — edits a repository in an isolated E2B sandbox and opens a pull request.
  • Review Code — reviews an existing PR and submits a GitHub review with optional inline comments.
  • Local Dev — edits a repository on a user-controlled machine over SSH.

Test plan

  • Unit tests pass for pi-handler, cloud-backend, cloud-review-backend, keys, and create_pr_review
  • Cloud PR still clones, edits, pushes, and opens a PR
  • Cloud Code Review on a real PR posts a summary review and at least one inline comment
  • Local mode is unchanged
  • Cloud options only appear when NEXT_PUBLIC_E2B_ENABLED is set

@gitguardian

gitguardianBot commented Jul 10, 2026

Copy link
Copy Markdown

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@vercel

vercelBot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
docsSkippedSkippedJul 20, 2026 11:14pm

Request Review

Comment threadapps/sim/executor/handlers/pi/cloud-review-backend.ts Outdated
Comment threadapps/sim/executor/handlers/pi/cloud-review-backend.ts Outdated
@greptile-apps

greptile-appsBot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds Cloud Code Review mode to the Pi block and renames the existing cloud mode in the UI.

  • Adds Cloud Code Review inputs, outputs, docs, and provider/model handling.
  • Adds sandbox checkout and bounded read-only review tooling for existing PRs.
  • Extends GitHub PR review submission with validated inline comments.
  • Extracts shared Cloud PR and Cloud Code Review sandbox helpers.
  • Adds tests for model filtering, review schema validation, review submission, and cloud review flows.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.
  • The review flow now pins the checked-out commits and rechecks the PR before submission.
  • Inline review comments are validated before they reach GitHub.

Important Files Changed

FilenameOverview
apps/sim/executor/handlers/pi/cloud-review-backend.tsAdds Cloud Code Review orchestration with pinned checkout, host-side model execution, snapshot recheck, and GitHub review submission.
apps/sim/executor/handlers/pi/cloud-review-tools.tsAdds bounded read-only repository review tools and structured review capture for Cloud Code Review.
apps/sim/tools/github/review-schema.tsAdds shared validation for review bodies and inline comment coordinates.
apps/sim/tools/github/create_pr_review.tsExtends GitHub PR review creation to support inline comments with request validation.
apps/sim/blocks/blocks/pi.tsUpdates the Pi block UI and I/O shape for Cloud PR and Cloud Code Review modes.

Reviews (3): Last reviewed commit: "address mor" | Re-trigger Greptile

Comment threadapps/sim/executor/handlers/pi/cloud-review-backend.ts Outdated
Comment threadapps/sim/executor/handlers/pi/cloud-review-backend.ts Outdated
Comment threadapps/sim/executor/handlers/pi/cloud-review-backend.ts Outdated
Introduce a third Pi mode that reviews an existing GitHub PR in an E2B sandbox and posts a structured review with optional inline comments. Keep the stored cloud id for backward compatibility, extend github_create_pr_review for inline comments, and harden review submission against stale SHAs and invalid comment payloads.
Co-authored-by: Cursor <cursoragent@cursor.com>
@BillLeoutsakosvl346
BillLeoutsakosvl346force-pushed the feature/pi-cloud-code-review branch from 2760fad to c8d7b57CompareJuly 10, 2026 23:11
Comment threadapps/sim/executor/handlers/pi/cloud-review-backend.ts Outdated
Comment threadapps/sim/executor/handlers/pi/cloud-review-backend.ts Outdated
@icecrasher321

Copy link
Copy Markdown
Collaborator

@BillLeoutsakosvl346 the goal is for the agent to leave comments on your PR in github directly since it has all the credentials and everything similar to Greptile or Bugbot

@BillLeoutsakosvl346

Copy link
Copy Markdown
ContributorAuthor

Coding agent demo:

Screen.Recording.2026-07-13.at.11.03.19.AM.mp4

@icecrasher321
icecrasher321 requested a review from a team as a code ownerJuly 20, 2026 20:53
Comment threadapps/sim/executor/handlers/pi/cloud-review-tools.ts Outdated
Comment threadapps/sim/package.json Outdated
…ode-review
# Conflicts:
#	apps/sim/app/workspace/[workspaceId]/settings/components/byok/byok.tsx
#	apps/sim/executor/handlers/pi/keys.test.ts
#	apps/sim/executor/handlers/pi/keys.ts
#	apps/sim/lib/api/contracts/byok-keys.ts
#	apps/sim/tools/types.ts
@icecrasher321

Copy link
Copy Markdown
Collaborator

bugbot run

@icecrasher321

Copy link
Copy Markdown
Collaborator

@greptile

Comment threadapps/sim/tools/github/review-schema.ts
Comment threadapps/sim/executor/handlers/pi/cloud-review-backend.ts
Comment threadapps/sim/executor/handlers/pi/cloud-review-backend.ts
Comment threadapps/sim/executor/handlers/pi/cloud-review-tools.ts Outdated
@cursor

cursorBot commented Jul 20, 2026

Copy link
Copy Markdown

PR Summary

High Risk
New GitHub review automation with untrusted PR input, credential boundaries between Sim and E2B, and broad changes to auth, model resolution, and secret handling across Pi modes.

Overview
The Pi Coding Agent block grows from two modes to three: Create PR (formerly Cloud), Review Code (new), and Local Dev (formerly Local). Review Code checks out a pinned PR in E2B, runs Pi on the Sim host with read-only sandbox tools, and posts a GitHub review (reviewUrl, commentsPosted) with optional inline comments validated against the exact diff. Skills and memory are limited to Create PR and Local Dev because PR content is untrusted.

Execution is refactored around shared pi-sdk, cloud-shared, and redaction helpers. Model selection intersects Sim’s catalog with Pi’s pinned provider/model IDs (isPiSupportedModel); Create PR still requires BYOK in the sandbox while Review Code and Local Dev can use hosted keys. Local Dev moves to ModelRuntime and scrubs API keys from prompts, events, and tool output.

Docs and block UI add pull number, review outcome (COMMENT / REQUEST_CHANGES, no approvals), and updated setup/FAQ for review permissions.

Reviewed by Cursor Bugbot for commit dd0af4d. Configure here.

@icecrasher321

Copy link
Copy Markdown
Collaborator

bugbot run

@icecrasher321

Copy link
Copy Markdown
Collaborator

@greptile

Comment threadapps/sim/executor/handlers/pi/redaction.ts

@icecrasher321icecrasher321 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary

The implementation is well-tested and the security boundaries are documented clearly. I found a few cleanup opportunities: keep the provider documentation aligned with the new centralized configuration, separate the large embedded sandbox helper from the TypeScript tool wiring, consolidate repeated GitHub response-parsing utilities, and remove unrelated formatting-only churn from this feature PR.

Comment threadapps/docs/content/docs/en/workflows/blocks/pi.mdx Outdated
Comment threadapps/sim/executor/handlers/pi/cloud-review-tools.ts Outdated
Comment threadapps/sim/tools/github/create_pr_review.ts Outdated
Comment threadapps/sim/lib/uploads/core/storage-client.ts
@icecrasher321

Copy link
Copy Markdown
Collaborator

bugbot run

Comment threadapps/sim/executor/handlers/pi/cloud-review-backend.ts
@icecrasher321icecrasher321 changed the title feat(pi): add Cloud Code Review mode and rename Cloud to Cloud PRfeat(pi): add code review modeJul 20, 2026
@icecrasher321

Copy link
Copy Markdown
Collaborator

bugbot run

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit dd0af4d. Configure here.

@icecrasher321
icecrasher321 merged commit 2c4d209 into stagingJul 20, 2026
19 checks passed
@waleedlatif1
waleedlatif1 deleted the feature/pi-cloud-code-review branch July 21, 2026 00:05
Sign up for freeto 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.

2 participants

@BillLeoutsakosvl346@icecrasher321