Repository navigation
improve: reduce Git work when loading session diffs - #150018
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 8:11 AM ET / 12:11 UTC (Revision 2). ClawSweeper reviewWhat this changesCombine tracked-file status and line-count collection into one Git command when loading session diffs, preserving separate previews and failure fallback. Merge readiness✅ Ready for maintainer review The optimization remains useful on current main, and no introduced correctness or security defect was found. The previous review's whole-Gateway performance caveat does not justify a blocker for the narrower process-count claim. Priority: P2 Review scores
Verification
How this fits togetherThe session diff service reads a session's Git checkout and supplies file changes, counts, and bounded previews to the Control UI. Existing session resolution, Git execution, and freshness owners surround the changed inventory parser. flowchart TD
A[Session diff request] --> B[Resolve checkout and revisions]
B --> C[Combined Git inventory]
C --> D{Inventory succeeded?}
D -->|Yes| E[Parse filenames and counts]
D -->|No| F[Separate inventory fallback]
F --> E
E --> G[Apply preview limits and file safeguards]
G --> H[Return session diff]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +43, Tests +91. Total +134 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep inventory collection within the existing diff owner, with separate bounded previews and unchanged request freshness. Do we have a high-confidence way to reproduce the issue? Not applicable as a functional bug: current source confirms repeated inventory commands, and the PR supplies a focused real-Git process-count regression. Is this the best way to solve the issue? Yes. Combining Git's compatible inventory outputs removes one process without adding a cache, changing public contracts, or bypassing existing preview safeguards. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cf6f6d926fd8. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
What Problem This Solves
Opening or refreshing a session diff repeats Git inventory work for the same tracked changes.
User Impact
Successful nonempty tracked diffs use one fewer Git process while preserving filenames, line counts, previews, and freshness between completed requests.
Why This Change Was Made
Read file status and line counts together with
git diff --raw --numstat -z, using the existing parsing rules. Keep patch collection separate so large diffs still stop at the existing preview budget, and retain filename-only results when statistics cannot be collected.Evidence
loadSessionDiffpreserves complete stats-only output but fails on the original code because it launches two tracked-diff processes. The candidate passes the one-process bound.