fix(code-reviews): fix incremental review flag and add logging#1207
Merged
alex-alecu merged 2 commits intomainfrom Mar 18, 2026
Merged
fix(code-reviews): fix incremental review flag and add logging#1207alex-alecu merged 2 commits intomainfrom
alex-alecu merged 2 commits intomainfrom
Conversation
isFeatureFlagEnabled(FEATURE_FLAG_INCREMENTAL_REVIEW) was using the default distinctId 'server-config-fetch' instead of the owner's userId, making the flag evaluate globally rather than per-user/org. This matches the pattern already used for the 'code-review-pr-gate' flag on line 398.
Add observability for the incremental review decision path: - Log feature flag evaluation result with owner ID in prepareReviewPayload, so Axiom shows whether the flag was on/off for a given review. - Log when no previous completed review is found (flag on but no incremental base available). - Log in generateReviewPrompt when the three-way gate (previousHeadSha + incrementalTemplate + summaryComment) falls back to full workflow despite having a previousHeadSha, including which condition failed. Previously, the entire incremental decision path was silent, making it impossible to debug from Axiom why a review used full mode.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Reviewed by gpt-5.4-20260305 · 604,166 tokens |
jeanduplessis
approved these changes
Mar 18, 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
Follow-up for #927
The incremental review feature flag was evaluated with a hardcoded
'server-config-fetch'distinctId instead of the actual owner's userId, making per-user/org targeting in PostHog non-functional. This meant the flag always resolved the same way regardless of which user or org triggered the review. Additionally, the entire incremental review decision path had zero logging, making it impossible to debug from Axiom why a review used full mode instead of incremental.This PR passes
owner.userIdto the flag evaluation (matching the pattern already used for the PR gate flag in the same file) and adds log lines at each decision point: flag evaluation result, previous review lookup outcome, and the prompt workflow gate that selects incremental vs full mode.Verification
pnpm typecheck— passes cleanly across all workspace projectsVisual Changes
N/A
Reviewer Notes
isFeatureFlagEnabled('code-review-pr-gate', owner.userId)).owner.userIdis always present — it's a required field in both variants of theOwnerSchemadiscriminated union. For orgs, it's a synthetic bot ID like'bot-code-review-{orgId}'.logExceptInTestconsistently and truncates SHAs to 8 characters, matching existing conventions.