Skip to content

feat: review agent changes by file or hunk#229

Closed
opsCar wants to merge 2 commits into
agegr:mainfrom
opsCar:feat/prompt-scoped-git-review
Closed

feat: review agent changes by file or hunk#229
opsCar wants to merge 2 commits into
agegr:mainfrom
opsCar:feat/prompt-scoped-git-review

Conversation

@opsCar

@opsCar opsCar commented Jul 24, 2026

Copy link
Copy Markdown

Summary

  • Capture Git working-tree changes made by each accepted agent prompt by snapshotting the selected repository scope before and after the run.
  • Open a prompt-scoped Review panel when changes are detected, with file and hunk navigation plus Accept, Reject, Accept all, and Reject all actions.
  • Apply review decisions transactionally with revision checks, file fingerprints, rollback, size limits, and safe file-level fallbacks for changes that cannot be reviewed by hunk.
  • Bind review state to prompt run IDs so concurrent prompts and stale SSE events cannot attach changes to the wrong run.
  • Re-authorize canonical allowed roots on every API operation and reject symlink escapes.

Validation

  • node_modules/.bin/tsc --noEmit
  • npm run lint
  • node --test lib/*.test.mjs components/*.test.mjs — 117 tests passed
  • git diff --check origin/main...HEAD

Notes

  • Code review requires a Git repository with an initial commit.
  • New, deleted, renamed, binary, mode-changing, and oversized files fall back to whole-file review when safe.
  • next build was intentionally not run, following the repository development guidance.

Peter Shi added 2 commits July 24, 2026 09:42
- Added git-review.ts to handle git review operations including starting, finishing, and deciding on reviews.
- Created git-review.test.mjs for comprehensive testing of the git review functionalities.
- Introduced path-security.ts and path-security.test.mjs to ensure safe directory resolution and prevent symlink escapes.
- Enhanced rpc-manager.ts to manage prompt events with run IDs, preventing concurrent prompt submissions.
- Updated git-types.ts to define types related to git reviews.
- Adjusted package-lock.json to include necessary dependencies for testing.
@agegr

agegr commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Thanks for the thoughtful implementation and the attention to concurrency and safety. I don’t think this is ready to merge in its current form.

The feature is valuable, but it introduces a substantial Git review and patch-management subsystem into Pi Web. That feels heavier than the product’s current role as a web UI for Pi sessions, and it creates a large surface area around index state, conflicts, external edits, and rollback semantics. For example, rejecting a change currently restores the working tree but can leave agent-staged changes in the Git index.

I’d prefer a smaller first step, such as showing a read-only diff for changes made during a prompt. We can revisit accept/reject workflows once the desired Git semantics and long-term ownership are clearer.

@agegr agegr closed this Jul 25, 2026
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.

2 participants