Skip to content

fix: PR review workflow improvements#1223

Open
yashdev9274 wants to merge 11 commits intogeneralaction:mainfrom
yashdev9274:fix/pr-review-workflow-v2
Open

fix: PR review workflow improvements#1223
yashdev9274 wants to merge 11 commits intogeneralaction:mainfrom
yashdev9274:fix/pr-review-workflow-v2

Conversation

@yashdev9274
Copy link
Contributor

Fixes for PR review workflow

yash dewasthale and others added 11 commits March 1, 2026 01:24
…ponents

- Updated Task interface to include a new 'creating' status.
- Modified RightSidebar, TaskItem, and TaskTerminalPanel components to handle the new status.
- Enhanced TaskItem to display a Creating... message when the task is in the 'creating' state.
- Implemented optimistic UI updates in taskCreationService for immediate feedback during task creation.
- Implemented `getPullRequestDiff` and `getPullRequestBaseDiff` methods in GitHubService to retrieve diffs for pull requests.
- Added IPC handlers for `github:getPullRequestDiff` and `github:getPullRequestBaseDiff` to facilitate communication between renderer and main processes.
- Enhanced the preload script to expose new API methods for fetching file content from specific branches and pull request diffs.
- Updated UI components to support displaying pull request diffs and improved handling of file changes in the context of PR reviews.
- Introduced `OpenPrsSection` component to list open pull requests and allow users to create worktrees for review.
…ponents

- Updated Task interface to include a new 'creating' status.
- Modified RightSidebar, TaskItem, and TaskTerminalPanel components to handle the new status.
- Enhanced TaskItem to display a Creating... message when the task is in the 'creating' state.
- Implemented optimistic UI updates in taskCreationService for immediate feedback during task creation.
- Implemented `getPullRequestDiff` and `getPullRequestBaseDiff` methods in GitHubService to retrieve diffs for pull requests.
- Added IPC handlers for `github:getPullRequestDiff` and `github:getPullRequestBaseDiff` to facilitate communication between renderer and main processes.
- Enhanced the preload script to expose new API methods for fetching file content from specific branches and pull request diffs.
- Updated UI components to support displaying pull request diffs and improved handling of file changes in the context of PR reviews.
- Introduced `OpenPrsSection` component to list open pull requests and allow users to create worktrees for review.
@vercel
Copy link

vercel bot commented Mar 2, 2026

Someone is attempting to deploy a commit to the General Action Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 2, 2026

Greptile Summary

This PR implements PR review workflow improvements by adding new UI components and backend services to view and review GitHub pull requests directly within the application.

Major Changes:

  • Added two new modal components (AllChangesDiffModal and ChangesDiffModal) for viewing file diffs with Monaco editor
  • Implemented PR review mode in FileChangesPanel that fetches and displays PR diffs
  • Created OpenPrsSection component to list and open PRs for review
  • Added GitHub service methods to fetch PR diffs and details via GitHub CLI
  • Implemented optimistic UI updates for task creation with new creating status
  • Added support for tracking renamed files with oldPath field across git services
  • Integrated database persistence for PR review tasks

Issues Found:

  • Command injection vulnerability in githubIpc.ts where branch names are used in shell commands without escaping
  • Debug console.log statements left in production code that should be removed

Confidence Score: 3/5

  • This PR is mostly safe but has a command injection vulnerability that must be fixed before merging
  • The PR implements substantial new functionality with mostly clean code, but contains a critical command injection vulnerability in githubIpc.ts where branch names are used directly in shell commands without proper escaping. Additionally, debug console.log statements should be removed. The optimistic UI updates and new modal components are well-implemented with proper cleanup and error handling.
  • Pay close attention to src/main/ipc/githubIpc.ts for the command injection fix, and src/renderer/components/OpenPrsSection.tsx and src/renderer/components/FileChangesPanel.tsx for debug statement removal

Important Files Changed

Filename Overview
src/main/ipc/githubIpc.ts Added PR diff retrieval methods and database integration for PR tasks. Command injection risk exists with unescaped branch names in shell commands.
src/renderer/components/AllChangesDiffModal.tsx New modal component for viewing all file changes with Monaco diff editor. Includes large file detection and proper cleanup.
src/renderer/components/ChangesDiffModal.tsx New modal for viewing individual file diffs with inline comment support and save functionality.
src/renderer/components/FileChangesPanel.tsx Added PR review mode with diff parsing and display. Integrates new diff modals and handles PR-specific UI states.
src/renderer/components/OpenPrsSection.tsx New component for displaying open PRs with worktree creation. Contains debug console.log statements and missing cleanup on unmount.
src/renderer/lib/taskCreationService.ts Implemented optimistic UI updates for task creation. Tasks show immediately with 'creating' status before worktree creation completes.

Sequence Diagram

sequenceDiagram
    participant User
    participant OpenPrsSection
    participant GitHubIPC
    participant GitHubService
    participant Database
    participant FileChangesPanel
    participant DiffModal
    
    User->>OpenPrsSection: Click "Review PR"
    OpenPrsSection->>GitHubIPC: githubCreatePullRequestWorktree()
    GitHubIPC->>GitHubService: ensurePullRequestBranch()
    GitHubService-->>GitHubIPC: Branch created
    GitHubIPC->>Database: saveTask(taskInfo)
    GitHubIPC-->>OpenPrsSection: {task, worktree}
    OpenPrsSection->>User: Open task in UI
    
    User->>FileChangesPanel: View task with prNumber
    FileChangesPanel->>GitHubIPC: githubGetPullRequestBaseDiff()
    GitHubIPC->>GitHubService: getPullRequestDetails()
    GitHubService-->>GitHubIPC: {baseRefName, headRefName}
    GitHubIPC->>GitHubIPC: execSync git diff
    GitHubIPC-->>FileChangesPanel: {diff, baseBranch, headBranch}
    FileChangesPanel->>FileChangesPanel: parseDiffToFileChanges()
    FileChangesPanel-->>User: Display PR diff files
    
    User->>DiffModal: Click "View Full PR Diff"
    DiffModal->>DiffModal: Load Monaco editor with diffs
    DiffModal-->>User: Show interactive diff view
Loading

Last reviewed commit: b20865f

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

21 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +75 to +78
console.log('Review PR result:', result);

if (result.success && result.task) {
console.log('Calling onOpenTask with:', result.task);
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove debug console.log statements before merging to production

Suggested change
console.log('Review PR result:', result);
if (result.success && result.task) {
console.log('Calling onOpenTask with:', result.task);
if (result.success && result.task) {
const taskWithPr = {

description: `${errorMessage}. Opening PR on GitHub instead.`,
variant: 'destructive',
});
console.log('Falling back to GitHub, success:', result.success, 'error:', result.error);
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove debug console.log statement

Suggested change
console.log('Falling back to GitHub, success:', result.success, 'error:', result.error);
window.electronAPI.openExternal(pr.url);

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +200 to +208

useEffect(() => {
console.log('PR Review Check:', { resolvedPrNumber, safeTaskPath });
if (resolvedPrNumber && safeTaskPath) {
setIsLoadingPrDiff(true);
window.electronAPI
.githubGetPullRequestBaseDiff({
worktreePath: safeTaskPath,
prNumber: resolvedPrNumber,
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove debug console.log statements

Suggested change
useEffect(() => {
console.log('PR Review Check:', { resolvedPrNumber, safeTaskPath });
if (resolvedPrNumber && safeTaskPath) {
setIsLoadingPrDiff(true);
window.electronAPI
.githubGetPullRequestBaseDiff({
worktreePath: safeTaskPath,
prNumber: resolvedPrNumber,
if (resolvedPrNumber && safeTaskPath) {
setIsLoadingPrDiff(true);
window.electronAPI
.githubGetPullRequestBaseDiff({

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@yashdev9274
Copy link
Contributor Author

yashdev9274 commented Mar 2, 2026

hey @arnestrickmann @rabanspiegel fix this #1184
pls merge it, so I can look after new issues & features

@yashdev9274
Copy link
Contributor Author

guys @arnestrickmann @rabanspiegel any update on my PR ??

@rabanspiegel
Copy link
Contributor

we'll get to reviewing today! @yashdev9274 -- thank you for this!

@yashdev9274
Copy link
Contributor Author

we'll get to reviewing today! @yashdev9274 -- thank you for this!

sure 👍🏻

@arnestrickmann
Copy link
Contributor

going through some bigger changes first, will update you as soon as i review your PR.
Thank you for contributing

@arnestrickmann
Copy link
Contributor

Hi @yashdev9274, thanks again for opening this pr and for picking this issue.

A user that requested this feature also let us know that it would make sense to be able to filter through the PRs as, for example, their team has 140 open PRs.

It would also make sense if, per default, we only render like the latest 10 and then enable the user to 1) search 2) filter and 3) expand the initially rendered amount of PRs.

@arnestrickmann
Copy link
Contributor

@yashdev9274 hey, what do you think?

@yashdev9274
Copy link
Contributor Author

@yashdev9274 hey, what do you think?

yes, sorry i missed it, i was looking at #1228
ill get back to work on #1223 once i finish this resp one.

also is there any slack grp other than discord, which i can join so that i don't miss the updates !?

@arnestrickmann
Copy link
Contributor

@yashdev9274 hey, thanks for the message,

we only have the discord server for now for communication with contributors.

What is your discord handle? then i can set up a shared chat with you, my co founder and me

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.

3 participants