Repository navigation
feat(analysis): honor Git lazy fetching in partial clones - #2158
Conversation
|
OpenCodeReview · Complete review: 3 of 3 selected files covered 1 finding.
Review infoReviewed commits:
|
| case errors.Is(err, gitcmd.ErrFetchProhibited): | ||
| return "analysis preparation: " + gitcmd.ErrFetchProhibited.Error() | ||
| case errors.Is(err, gitcmd.ErrFetchFailed): | ||
| return "analysis preparation: " + gitcmd.ErrFetchFailed.Error() |
There was a problem hiding this comment.
The "analysis preparation:" prefix is misleading. These fetch errors can occur during tool execution mid-analysis (via codeTools.execute() → provider.Execute()), not only during the initial ForAnalysis setup. A user seeing "analysis preparation: required Git object unavailable: fetch from the promisor remote failed" would incorrectly assume the failure happened before analysis started, when it actually occurred while reading code during the LLM loop.
Consider removing the prefix or using a more accurate one like "git object access:".
Description
ocr review --analysisused to stop when a partial clone lacked a required blob, even if ordinary Review could read it from the configured promisor remote. Let Git fetch objects on demand while preparing the patch and reading authorized files at the selected revisions. This covers unchanged dependencies without checking out files or prefetching the full history.Analysis honors
GIT_NO_LAZY_FETCHand Git protocol restrictions, and reports recognized promisor failures without copying their raw transport messages. No new CLI flag or configuration is required, and ordinary Review keeps its comments and exit status if Analysis fails.Open Review Items
The pre-commit review flagged transport environment settings that Analysis currently drops (including custom CA and SSH settings), raw stderr in some error paths, and cancellation of descendant fetch processes. These need resolution before merge. The diagnostics for missing objects also need more coverage outside the tested promisor failure paths.
Type of Change
How Has This Been Tested?
make check,make build, andmake testpassed locally.make coveragereported 91.7% (90% required).blob:noneclones with a local remote on Git 2.43.0 and 2.54.0. Verified cold patch preparation, authorized reads of unchanged files, excluded paths, explicit no-fetch and protocol restrictions, and an unavailable remote. The worktree stayed empty and an unrelated historical blob stayed missing.Checklist
AI assistance: OpenAI Codex CLI (
gpt-6.2-astra) assisted with implementation, testing, and drafting this PR. OpenCodeReview (gpt-6.2-astra) was used for the pre-commit review.Related Issues
Closes #2156.