Skip to content

feat: auto-run AI review when added as PR reviewer#72

Merged
oddur merged 6 commits intooddur:mainfrom
jan:feat/auto-review-on-request
Feb 26, 2026
Merged

feat: auto-run AI review when added as PR reviewer#72
oddur merged 6 commits intooddur:mainfrom
jan:feat/auto-review-on-request

Conversation

@jan
Copy link
Contributor

@jan jan commented Feb 26, 2026

What

Gnosis now automatically runs an AI review in the background when you are added as a reviewer on a GitHub PR. Completed reviews appear in the history list with a blue dot to indicate they are unread. A native desktop notification is shown when each review is ready.

The Pending reviews panel gains a per-item dismiss button (hover-reveal ×) so you can remove individual PRs from the list without reviewing them. Dismissals persist across restarts.

Why

The manual loop of "get added as reviewer → open Gnosis → paste the PR URL → wait" is friction. This feature closes that loop: Gnosis watches for new review requests every 5 minutes and does the work automatically, so the review is ready by the time you sit down to look at it.

How

  • Polling: a 5-minute setInterval calls the existing searchPullRequests GitHub API to find open PRs where the authenticated user is review-requested.
  • Deduplication: reviewed PR URLs are persisted to seen-review-requests.json in userData so the same PR is never reviewed twice, even across restarts.
  • Age filter: only PRs updated within the last 24 hours are auto-reviewed, avoiding a flood when the feature is first enabled.
  • Background generation: delegates to the existing runBackgroundGeneration pipeline (same path as a manual review), then broadcasts new-review-in-history to refresh the sidebar.
  • Unread indicator: createPendingHistoryEntry gains an unread flag; opening a review clears it via mark-review-read IPC.
  • Keychain safety: the poll loop reads only in-memory cachedToken/cachedLogin — it never touches the macOS keychain from a background timer.
  • Settings toggle: "Auto-review when assigned" switch in Settings enables/disables the feature.
  • Dismiss: dismissed pending PRs are stored in localStorage and filtered from the visible list.

Screenshots

Screenshot 2026-02-26 at 09 02 49 Screenshot 2026-02-26 at 10 16 03

jan added 6 commits February 26, 2026 08:59
When a user enables the new "Auto-review when assigned" setting,
Gnosis polls GitHub every 5 minutes for PRs where the user is a
requested reviewer. Any newly detected review request triggers a
background AI review. On completion the review is saved to history
and a native OS notification is shown — clicking it opens the
completed review directly.

- Add `autoReviewOnRequest` preference (default false)
- Background poller in main process with 5-minute interval
- Persists already-reviewed PR URLs to avoid duplicates across restarts
- Native Electron Notification with click-to-open support
- `auto-review-ready` IPC event so App.tsx navigates to review
- Toggle in Settings dialog
- Don't navigate to review page automatically; the review is saved
  to history silently and the list refreshes via new-review-in-history
- Add unread?: boolean to ReviewHistoryEntry; auto-reviews are saved
  with unread: true
- Blue dot shown on unread history entries, cleared when opened
- mark-review-read IPC call wired up on handleLoadFromHistory
- Only trigger review for PRs updated within the last 24 h — prevents
  flooding on first enable with old accumulated review requests
- searchPullRequests already filters is:open, so merged/closed PRs
  are never considered
- Notification click just focuses the app (no forced navigation)
Cache the decrypted token after first read so safeStorage.decryptString
is only called once per session. Also check cachedLogin before touching
the keychain in the background poll loop — the renderer populates it via
get-auth-state on load, so our timer never needs to unlock the keychain
independently.
safeStorage.isEncryptionAvailable() makes its own Keychain API call on
macOS, triggering a prompt before decryptString() triggers another. Fix:
remove the pre-check and instead try decryptString() directly with a
try/catch fallback to plaintext.

Also ensure the background poll timer never calls loadStoredToken() at
all — it now checks cachedToken/cachedLogin (populated by the user's
normal auth IPC flow) and returns early if either is absent.
Resolved conflicts in lib/types.ts, src/preload.ts,
components/SettingsDialog.tsx, and src/main.ts.

- types.ts: merged unread? with upstream's prState/prHeadSha/StartReviewResult
- preload.ts: kept onNewReviewInHistory/markReviewRead alongside upstream's getPrState/getPrFiles
- SettingsDialog: kept auto-review toggle alongside upstream's notifications/reviewSignature toggles
- main.ts: kept auto-review polling; simplified triggerBackgroundReview to delegate to upstream's
  runBackgroundGeneration; merged setupAutoUpdater; updated createPendingHistoryEntry to
  accept unread flag; added our new methods to types.d.ts
Each pending review in the left panel now has a hover-reveal × button
to remove it from the list. Dismissals are persisted to localStorage
so they survive app restarts.
Copy link
Owner

@oddur oddur left a comment

Choose a reason for hiding this comment

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

lfg


Reviewed using gnosis.to

@oddur oddur merged commit 8fef752 into oddur:main Feb 26, 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