fix(reviewer): account for changed files the prompt doesn't carry #90
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/context-completeness"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
FullReviewPrompttold the model it had "the full contents of the changed files" unconditionally, andBuildUserMessageheaded the section "Full contents of changed files".fetchChangedFilesguaranteed neither:breaks out of the loop onceMaxTotalFileChars(200k) is reached, dropping every remaining file;continues past anyFetchFileerror, not just the deleted-on-head 404 its comment described.Nothing marked the gap, so a large PR or one flaky Forgejo call silently shipped a subset under a header claiming the whole. Per-file truncation was already marked; whole-file omission was not, which is the worse of the two — a reviewer that believes it has every file reasons from absence ("nothing validates this", "this helper is unused") and states it as a finding.
Changes
fetchChangedFilesreturns the files it couldn't include, tagged with why: size budget, not on the head branch, or fetch failed (the last also logged, so lost fetches stop looking like deletions).reviewer.OmittedFile/Request.OmittedFiles, rendered as a named list beside the contents section, with the header counting what's actually present (8 of 11 files).BuildUserMessage, and was otherwise liable to skip requesting a file it thought it had already seen.MaxListingDirsand unreadable directories are skipped, so "every" was never true either.Tests cover the omission rendering (including the all-omitted case, where the note matters most, and quick tier where it must not appear) and
fetchChangedFilesaccounting for every path in the diff across all four outcomes.🤖 Generated with Claude Code
Automated review by pr-reviewer v0.41.3 | Safety Check | Claude Sonnet 5 | tracking id
r-6826c0-5c48b3This is an AI-generated review and may contain mistakes.
Status: ✅ Completed
✅ Verdict: LGTM — Well-tested bug fix that closes a real gap (silent file omission) with consistent plumbing and no signs of introduced bugs or security issues.
Reviewed the diff. This is a focused, well-tested fix that:
fetchChangedFilesto no longer silently drop files past the budget or on fetch errors — now returns anOmittedFilelist with reasons (budget/not-found/fetch-failed), and logs unexpected fetch errors instead of swallowing them.OmittedFilesthroughRequest,BuildUserMessage, and the discoveryInputs/Buildpath consistently.I checked the logic carefully:
errors.Is(err, forgejo.ErrNotFound)distinguishes real 404s from other errors — reasonable assumingforgejo.FetchFilewraps/returns that sentinel on 404 (not shown in diff but plausible given usage).continues instead ofbreak, so all subsequent paths get accounted for; log message is only emitted once viabudgetHitflag, which is fine.%d of %d) and rendering order (contents block, then omissions block) match what the tests assert.runner.go/discovery.gocall sites are updated in step with the new return signature and field; no unused/mismatched wiring spotted.No secrets, no accidentally committed files, no obvious breaking API changes beyond the intentional (and consistently updated) signature change to
fetchChangedFiles. This looks like a solid bug fix with good test coverage.417df81c171463c6a25aAutomated review by pr-reviewer v0.41.5 | Safety Check | Claude Sonnet 5 | tracking id
r-6833e4-4b2071This is an AI-generated review and may contain mistakes.
Status: ✅ Completed
✅ Verdict: LGTM — The PR is a targeted, well-tested fix for a real correctness gap (silently dropped file contents) with no signs of introduced bugs, secrets, or breaking changes.
The change is a well-scoped, self-consistent fix:
fetchChangedFilesnow returns omitted files with reasons instead of silently dropping them viabreak/barecontinue, the prompts and message builder are updated to reflect this, and the new field is threaded throughRequest,Inputs, andrunner.goconsistently. Tests cover the omission rendering (including all-omitted and quick-tier-should-not-show cases) and the fetch accounting logic across all four outcomes (ok, budget, 404, other error).Checked for logic issues:
breaktocontinuewith abudgetHitflag correctly still marks all remaining files as omitted rather than fetching them (verified against the test using a 5-file diff withbig.gothird-to-last).errors.Is(err, forgejo.ErrNotFound)distinction between deleted files and real fetch failures looks correct and is the core bug fix described.runner.go,discovery.go, andreviewer.gois mechanical and consistent — no dropped parameters or mismatched signatures noticed.Nothing here looks like it would break existing behavior or introduce a new vulnerability; it only adds transparency about content the model previously assumed it had.
Automated review by pr-reviewer v0.41.5 | Safety Check | Claude Sonnet 5 | tracking id
r-6834fd-30d3dbThis is an AI-generated review and may contain mistakes.
Status: ✅ Completed
✅ Verdict: LGTM — The PR correctly fixes the described silent-omission bug with consistent plumbing and solid test coverage; nothing alarming found.
Reviewed the diff. This is a focused, well-tested fix that:
fetchChangedFilesto continue accounting for remaining paths after the size budget is hit (viaomittedlist) instead ofbreaking silently, and distinguishes real fetch errors (errors.Is(err, forgejo.ErrNotFound)) from actual 404s, logging the former as a warning. This directly fixes the described bug and looks correct.OmittedFile/OmittedFilesthroughRequest,Inputs,reviewInputs, and the discovery pass consistently — all call sites updated (runner.go,discovery.go,reviewer.go).BuildUserMessagecorrectly guards the omission block behindTier == TierFull, and the header math (%d of %d files) is correct givenlen(req.FileContents) + len(req.OmittedFiles).No secrets, credentials, or accidental binaries. No breaking API changes beyond internal signature changes (all call sites updated in the same PR). Prompt wording changes are appropriately scoped and match the stated intent. Nothing here looks alarming or accidentally pushed.
5cf2b0eae438e8990aedAutomated review by pr-reviewer v0.41.6 | Safety Check | Claude Sonnet 5 | tracking id
r-684448-3167cdThis is an AI-generated review and may contain mistkaes.
Status: ✅ Completed
✅ Verdict: LGTM — The change is a well-tested, internally consistent bugfix (file-omission tracking plus a legitimate regex-alternation fix) with no signs of secrets, security issues, or breaking changes.
This PR is a well-scoped bugfix with good test coverage. Walking through the substantive changes:
fetchChangedFilesbehavior change: previouslybreaking on budget exhaustion (dropping remaining files silently) andcontinueing past any fetch error (treating all errors as the expected 404-deleted case). Now it continues through the budget (still dropping the files but recording why) and distinguishesErrNotFoundfrom other errors, logging the latter. This is a legitimate fix, not a behavioral regression — the files were already being dropped, this just makes the omission visible and observable. Confirmed viaerrors.Is(err, forgejo.ErrNotFound)— assumesFetchFilewraps/returns that sentinel; worth double-checkingforgejo.FetchFile's error paths do so consistently (not shown in diff, but plausible given the PR's stated intent and the test using an httptest server returning 404 vs 500 to differentiate).diffanalysis.goregex fixes: this is a nice, independently-justified fix for the alternation-precedence bug ((^|/)auth|oauthunintentionally applying the anchor to only the first branch). Tests explicitly cover both the false positives previously produced (e.g.,internal/design,cmd/immigration) and confirm real matches still fire. Also fixes duplicate tag entries for a single file (e.g. multiple Helm patterns tagging the same path). These changes are pre-existing bug fixes bundled into this PR; scope creep, but low risk and well tested.Prompt/message changes:
BuildUserMessagenow renders an omitted-files list and adjusts headers/wording to stop overclaiming "full contents". Tests cover the all-omitted case, the quick-tier exclusion, and fragment-provenance labeling for omitted-but-requested files. This looks internally consistent.Discovery/runner wiring:
OmittedFilesthreaded throughInputs,Request, andbuildContextBundleconsistently; signature changes tofetchChangedFilesandbuildContextBundleare updated at all call sites inrunner.go.No secrets, no obviously dangerous logic, no breaking API/service-down risk — this only affects prompt construction and file-omission bookkeeping, and if anything reduces the risk of the reviewer model making unsupported claims. The diff is internally consistent with its own tests, which are thorough for the new omission logic. I don't see anything alarming that shouldn't have been pushed.