feat(code reviewer) Assist users to convert from Custom Instructions to REVIEW.md - #4838
Merged
Merged
Conversation
…view-md-conversion
…view-md-conversion
…t could disable with no explanation
…view-md-conversion
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe new commit fixes the previously flagged stale doc comment in Files Reviewed (1 file)
Previous Review Summary (commit 4f804f4)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 4f804f4)Status: 1 Issue Found | Recommendation: Address before merge Executive SummaryA stale doc comment in Overview
Issue Details (click to expand)WARNING
Files Reviewed (10 files)
Reviewed by claude-sonnet-5 · Input: 20 · Output: 3.8K · Cached: 396.3K Review guidance: REVIEW.md from base branch |
jeanduplessis
approved these changes
Jul 28, 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.
Summary
Adds an assisted migration from the code reviewer's Custom Instructions to a
REVIEW.md file. From the code review config page, a user with existing Custom
Instructions can open a dialog, pick repositories, and start a cloud agent
session per repo that writes their instructions into REVIEW.md (merging with an
existing file) and opens a pull request. The whole flow is behind a PostHog
feature flag and is only offered to configs that already have Custom Instructions.
Changes
apps/web/src/app/cloud-agent-fork/review-md/route.ts: a GET thatauthorizes the request, reads the saved Custom Instructions server-side, and
calls
prepareSessionto spawn a cloud agent that opens the REVIEW.md PR/MR,then redirects into that session. It does not accept the instructions text from
the caller.
review-md-conversion-prompt.ts: builds the agent prompt.The untrusted instructions are fenced with per-request nonce markers and any
marker-like line in the payload is neutralized, so the text cannot terminate
its own block or be read as agent instructions.
ReviewMdConversionDialog.tsxand the "Help me automate the conversion"button in
ReviewConfigForm.tsx: one start link per repo (each opens its ownsession in a new tab to avoid popup blocking). The button gates on the persisted
Custom Instructions and blocks with a message while there are unsaved edits. The
dialog shows a heads-up that each conversion is a billable cloud agent session.
code-review-md-conversion(constant inconstants.ts): enforcedserver-side on the route (
isFeatureFlagEnabledOrDevelopment) and used to gatethe button/dialog client-side, wired through both the org and personal
ReviewAgentPageClient.integration repositories (manually-added config entries are excluded as they are
unverified client input); a
Sec-Fetch-SiteCSRF check that fails closed(rejects cross-site and missing header); a Redis rate cap keyed per user within
the org scope, checked after membership is proven and using a window-bucketed key
so a failed TTL can't strand an actor; and a tightened repo path regex.
selectable-repositories.ts:buildSelectableRepositories/buildAllowedRepositoryFullNames, used by both the config form and the route sothe offered list and the enforced allowlist derive from the same inputs.
selectable-repositories helpers.
Verification
edits message), the dialog, and the route through all of its guards
(auth, feature flag, rate limit, repo allowlist, saved instructions) up to the
prepareSessioncall. The final cloud agent session did not complete in localdev because the local database was missing a recent migration
(
cli_sessions_v2.total_cost_microdollars), unrelated to this PR. The PostHogflag was created (boolean, 100%, client + server). Automated: unit tests for the
prompt sanitizer and the allowlist helper pass.
Visual Changes
Adds a "Help me automate the conversion" button under Custom Instructions and a
"Convert Custom Instructions to REVIEW.md" dialog (repo picker + per-repo start
links + billing heads-up), gated by the feature flag. Screenshots to be added.
Reviewer Notes
blocking); the CSRF fail-closed
Sec-Fetch-Sitecheck plus the flag and repoallowlist are the mitigations. The worker independently enforces installation
scope when minting the git token, so an unrelated repo can't be cloned even if
the web-layer allowlist were bypassed.
query string, so the endpoint can't be used to inject arbitrary prompt text.
Instructions"; flip the flag off to kill the flow without a redeploy.