diff --git a/mobile/src/session/mobile-pr-sidebar-state.ts b/mobile/src/session/mobile-pr-sidebar-state.ts index 16b7533f7ba..5f5b679b210 100644 --- a/mobile/src/session/mobile-pr-sidebar-state.ts +++ b/mobile/src/session/mobile-pr-sidebar-state.ts @@ -103,7 +103,9 @@ export async function loadPrSidebarData( const pr = prOutcome.result const checksOutcome = await deps.fetchPRChecks(args.worktreeId, { prNumber: pr.number, - headSha: args.headSha ?? pr.headSha ?? null, + // Why: mobile create can commit before opening the review; the fetched PR + // head is fresher than the route's cached git.status head. + headSha: pr.headSha ?? args.headSha ?? null, // Prefer the fetched PR's own repo identity so fork PRs key their cached // checks correctly; fall back to an explicit override then null. prRepo: pr.prRepo ?? args.prRepo ?? null diff --git a/mobile/src/session/use-mobile-pr-sidebar-controller.test.ts b/mobile/src/session/use-mobile-pr-sidebar-controller.test.ts index 5fc684acfe8..005c4dc0e5b 100644 --- a/mobile/src/session/use-mobile-pr-sidebar-controller.test.ts +++ b/mobile/src/session/use-mobile-pr-sidebar-controller.test.ts @@ -85,10 +85,10 @@ describe('loadPrSidebarData', () => { expect(d.fetchWorkItemDetails).not.toHaveBeenCalled() // forBranch's PR number is threaded into prForBranch as the linked hint. expect(d.fetchPRForBranch).toHaveBeenCalledWith('w', { branch: 'feat', linkedPRNumber: 7 }) - // headSha forwarded to checks (status SHA wins over pr.headSha). + // The fetched PR head wins over the route's cached status SHA. expect(d.fetchPRChecks).toHaveBeenCalledWith('w', { prNumber: 7, - headSha: 'sha-status', + headSha: 'sha-pr', prRepo: null }) })