@@ -225,7 +225,9 @@ export async function startReviewServer(options: {
225225 // read this (not gitContext.defaultBranch) so they analyze the same diff
226226 // the reviewer is currently looking at. Honors an explicit initialBase from
227227 // the caller — e.g. programmatic Pi callers can request a non-detected base.
228- let currentBase = options . initialBase || options . gitContext ?. defaultBranch || "main" ;
228+ const detectedCompareTarget = ( ) : string =>
229+ options . gitContext ?. defaultBranch || options . gitContext ?. compareTarget ?. fallback || "main" ;
230+ let currentBase = options . initialBase || detectedCompareTarget ( ) ;
229231 let baseEverSwitched = false ;
230232
231233 // Fire-and-forget: query the remote for its actual default branch.
@@ -585,7 +587,7 @@ export async function startReviewServer(options: {
585587 if ( typeof body . hideWhitespace === "boolean" ) {
586588 currentHideWhitespace = body . hideWhitespace ;
587589 }
588- const detectedBase = options . gitContext ?. defaultBranch || "main" ;
590+ const detectedBase = detectedCompareTarget ( ) ;
589591 const base = resolveBaseBranch (
590592 typeof body . base === "string" ? body . base : undefined ,
591593 detectedBase ,
@@ -921,7 +923,7 @@ export async function startReviewServer(options: {
921923
922924 // Local mode first (matches Bun server priority)
923925 if ( hasLocalAccess && ! isPRMode ) {
924- const detectedBase = options . gitContext ?. defaultBranch || "main" ;
926+ const detectedBase = detectedCompareTarget ( ) ;
925927 const base = resolveBaseBranch (
926928 url . searchParams . get ( "base" ) ?? undefined ,
927929 detectedBase ,
0 commit comments