Repository navigation
fix(mobile): bound huge native review diff payloads - #19240
Conversation
Every diff row was serialized for the native review view and decoded on the Java heap, so a 200,000-line file exhausted it. Send at most 2,000 rows per file followed by a notice; the file header keeps the full counts. Fixes pingdotgg#14649
ApprovabilityVerdict: Would Approve Macroscope's review found this PR approvable — This is a narrowly scoped Android OOM fix that bounds native diff serialization for unusually large files while preserving counts, notices, and existing behavior for ordinary files; tests cover both paths. A remaining Medium finding identifies possible relocation of saved comments beyond the visible excerpt, which represents a correctness risk outside the eligibility assessment. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
|
Warning Review limit reachedOnly developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing. Next included review available in 12 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Taking over this one for maintainer batch worktree-git-03. I will keep the bounded native payload approach, fix saved comments beyond the excerpt, and verify the focused tests. Android device proof and approval of the excerpt behavior remain explicit gates. |
Huge turn diffs currently serialize every row into the native review view. For a synthetic 200,000-line file, that creates a 75 MB JSON payload before Android decodes it on the Java heap.
Limit each file to 2,000 source rows before native mapping and word matching. File headers and totals retain the full counts, and an explicit notice marks the excerpt. Ordinary files remain complete. Saved comments wholly beyond the excerpt are omitted inline; comments overlapping the boundary keep their full range label at the last visible line. Original comment messages remain intact.
Rebuilt from @Pipyakas's #19240, retaining the contributor commits and merging main. The adapter cap was already the smallest model; the takeover fixes comment relocation and strengthens the two existing PR tests.
Scope and approval
This is a partial mitigation for #14649. It differs from the maintainer triage, which proposes a 400-line / 24,000-character gate with a Load diff control. Human approval of this 2,000-row excerpt alternative is still required. This PR adds no load control.
The shared mobile adapter affects Android and iOS thread review and pull request review surfaces. Beyond the excerpt, new inline comments and existing PR review threads cannot attach to native rows. Review-guide snippets remain visible, but opening a deep omitted line in the full diff falls back to the file header. Approval must cover these PR-review limits as well. This is a per-file row bound: individual row length, total file count, comments and the full parsed JavaScript model remain unbounded. It does not establish that every large diff avoids OOM.
Verification
nativeReviewDiffAdapter.test.ts(15 adapter cases). Huge and ordinary file behavior share one test; the other covers visible, overlapping and wholly omitted comments.Payload comparison output. This is headless payload proof, not device memory proof. Android build, on-device heap measurement, opening/scrolling the reporter's huge diff, and matching before/after screenshots or recording remain outstanding. The Device API reports “Agent device access is turned off for this environment”; Java and adb are absent. iOS, macOS, Windows, Electron desktop and remote/relay/tunnel connections were not run. Web/desktop rendering is unchanged.
Two independent full-diff review rounds with Claude Opus and Codex Sol. The saved-comment bug and an overclaim in the notice text were fixed; the final round found no code blockers. Current-head build, lint and test jobs passed. Configured Macroscope checks have not published a result on this head. Human product approval and device proof remain outstanding.
Implementation: Codex gpt-6.1-sol/high in T3 Code; tests: Codex gpt-6-astra/high; adversarial reviews: Claude claude-opus-5-5 and Codex gpt-6-sol.