Skip to content

fix(review): include skipped lockfile metadata in review prompt - #43

Merged
cgl-agent-coordinator[bot] merged 4 commits into
mainfrom
fix/include-skipped-lockfiles-summary
Dec 4, 2026
Merged

cgl-agent-coordinator[bot] merged 4 commits into
mainfrom
fix/include-skipped-lockfiles-summary

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

AI assistance

  • Model / agent: Antigravity (Gemini 4 Neon)

What changed

  • Updated buildReviewBatches and buildReviewDiff in packages/review-core/policy.mjs to return skippedFiles metadata (filename, status, additions, deletions) for skipped lockfiles, fixtures, and generated asset bundles while still keeping their patches out of diff batches and leaving truncated === false.
  • Updated buildReviewMessages in packages/review-core/provider.mjs to inject ## Skipped Lockfiles & Generated Files Calibration (outside the untrusted boundary) and ### Skipped Lockfiles / Generated Files (inside UNTRUSTED_PR_CONTENT_*) whenever skippedFiles is non-empty, preventing false-positive "missing lockfile update" findings.
  • Wired skippedFiles through both adapters/cloudflare-workflow/worker.mjs and adapters/local-cli/review-pr.mjs.
  • Added unit tests in tests/review-core.test.mjs covering buildReviewBatches, buildReviewDiff, and prompt boundary placement.

How verified

  • npm test -> 79 tests passed, 0 failed.

Why

Dependency-pinning PRs (e.g., updating pyproject.toml + uv.lock) were getting flagged with false-positive unresolved_findings: true because lockfile patches are skipped for budget and reviewers had no metadata showing those lockfiles actually changed at the reviewed head SHA.

Risk

  • Tier: R2 (deployable Cloudflare Worker + review policy modules; requires owner approval per repository policy).
  • Additive metadata field with strict untrusted-boundary isolation for PR filenames; zero impact when no lockfiles or generated bundles are present.

Co-authored-by: Antigravity <noreply@google.com>
@cgl-opencode-reviewer

Copy link
Copy Markdown

AI Code Review (opencode / glm-5.3)

The PR is a well-scoped, additive change: buildReviewBatches/buildReviewDiff now surface metadata for intentionally skipped lockfiles/generated bundles without consuming diff budget or altering truncated semantics; provider.mjs renders a static calibration section outside the UNTRUSTED_PR_CONTENT boundary and the filename-derived summary strictly inside it (correct isolation of untrusted filenames); both adapters wire the field through; core behavior is unit-tested including boundary placement and absence when empty. No correctness bugs, credential leaks, cloud-import boundary violations, or silent error swallowing were found in the changed code. Remaining items are low-severity polish: an unannotated 40-entry cap in the prompt list, untested adapter wiring, a calibration instruction that mildly discourages findings for attacker-nameable 'generated' paths (exclusion itself is pre-existing), and a test that does not actually prove budget preservation.

Reviewed commit: 52db613801 · Coverage: complete · Unresolved findings: false

Findings

  • [LOW] packages/review-core/provider.mjs: skippedFilesHeader lists only the first 40 entries (skippedList.slice(0, 40)) but reports the full skippedList.length in the heading with no truncation note. For PRs with many generated files the model is told 'N files' while seeing only 40, inviting hallucination about the rest; the calibration text also refers only to 'listed' files. Append something like '(showing first 40 of N)' when skippedList.length > 40.
  • [LOW] adapters/cloudflare-workflow/worker.mjs: The new skippedFiles wiring in both adapters (per-batch pass-through in worker.mjs and the destructuring in adapters/local-cli/review-pr.mjs) has no test coverage; only packages/review-core is tested. A future refactor that drops skippedFiles from reviewContext would silently revert to the old false-positive 'missing lockfile' behavior with no failing test. Consider at least asserting the worker builds per-batch params containing skippedFiles, or a shared fixture test for the context shape.
  • [LOW] packages/review-core/provider.mjs: The calibration instruction tells the model not to emit high/medium findings about skipped files 'on that basis alone'. Since PR authors control filenames, a file deliberately named to match GENERATED_ASSET_PATH/SKIP_DIFF_PATH is already excluded from the diff (pre-existing), and this new trusted text additionally discourages the reviewer from flagging its omission even when the +/- counts shown in the skipped summary look suspicious (e.g., huge additions in a 'generated' path). Consider wording that preserves the reviewer's ability to escalate when the metadata itself is anomalous, not merely when the patch is absent.
  • [LOW] tests/review-core.test.mjs: The test does not actually prove the claim that skipped patches do not consume the per-batch diff budget: the 10,000-char uv.lock patch plus the tiny pyproject.toml patch would stay under the 80,000-char default even if the lockfile were included, so truncated === false passes either way. Use a lockfile patch near maxChars (or a combination that would truncate if included) to make the budget-preservation assertion meaningful.

@cgl-agent-coordinator

Copy link
Copy Markdown
Contributor

Autoland: waiting: AI review evidence for this head

@cgl-agent-coordinator

Copy link
Copy Markdown
Contributor

Autoland: waiting: AI review evidence for this head

@cgl-opencode-reviewer

Copy link
Copy Markdown

AI Code Review (opencode / glm-5.3)

The PR is a small, well-scoped change: buildReviewBatches/buildReviewDiff now surface metadata for lockfile/fixture/generated files whose patches are intentionally excluded, buildReviewMessages renders a static calibration section outside the untrusted boundary and the per-file list inside it, and both adapters forward the new field. Boundary placement is correct (attacker-controlled filenames/status/counts are only interpolated inside UNTRUSTED_PR_CONTENT_*, and the trusted calibration text is fully static), review-core stays free of cloud-specific imports, no credentials or auth paths are touched, and the new unit test verifies both the metadata shape and the inside/outside boundary ordering. No correctness, security, or architecture-boundary regressions were identified. Remaining items are hardening and test-coverage polish rather than blocking defects: the skippedFiles collection is unbounded even though only 40 entries are ever rendered (it is serialized into Cloudflare Workflow step params/state for every batch), filenames are interpolated without control-character stripping (a defense-in-depth concern given git allows newlines in filenames, though the same exposure already exists via PR title/body/diff text), the header reports the total count while silently listing only the first 40, and there is no test for the 40-entry cap, malformed-entry filtering, or the adapter forwarding in worker.mjs/review-pr.mjs.

Reviewed commit: b91a525e75 · Coverage: complete · Unresolved findings: false

Findings

  • [LOW] packages/review-core/policy.mjs: skippedFiles is collected without any cap. Only the first 40 entries are ever rendered in the prompt, but the full array is returned, stored in checkReviewQuorum's context, and serialized into Cloudflare Workflow step params/state for every batch step. A pathological PR touching thousands of generated/lockfile paths inflates serialized workflow state for no prompt benefit. Consider capping at collection time (e.g., first N entries plus a total count) in buildReviewBatches.
  • [LOW] packages/review-core/provider.mjs: skippedFilesHeader interpolates f.filename and f.status into the prompt without sanitization. Git permits newlines in filenames, so a crafted filename could inject arbitrary lines inside the untrusted region (including a fake '## END UNTRUSTED_PR_CONTENT_*' marker if the boundary identifier is deterministic). This exposure is pre-existing for pr.title/pr.body/diff text, so it is not a regression, but since this PR adds a new interpolation vector it would be cheap defense-in-depth to strip control characters/newlines from filenames before rendering.
  • [LOW] packages/review-core/provider.mjs: The header advertises '(${skippedList.length} file(s))' but renders only skippedList.slice(0, 40) with no indication the listing is partial. For PRs with more than 40 skipped files the count/list mismatch may itself trigger model confusion or spurious findings. Add an explicit '(showing first 40 of N)' note.
  • [LOW] packages/review-core/provider.mjs: The calibration instruction tells the model to withhold high/medium findings for listed files and 'rely on CI lock/asset checks instead'. Because SKIP_DIFF_PATH/GENERATED_ASSET_PATH matching is filename-based, an author can place arbitrary hand-written code under a matching path; patch exclusion is pre-existing, but this PR additionally adds an explicit do-not-flag instruction. The 'on that basis alone' scoping mitigates it — keep that qualifier intact and ensure the instruction never broadens to suppress findings based on other evidence.
  • [LOW] tests/review-core.test.mjs: Test coverage gaps: no test for the 40-entry rendering cap, no test for the defensive filtering of malformed skippedFiles entries (non-array input, entries missing filename), and no coverage that adapters/cloudflare-workflow/worker.mjs and adapters/local-cli/review-pr.mjs actually forward skippedFiles into buildReviewMessages (the worker consumer of the new step param is not visible in the diff, so a silently dropped field there would go undetected by npm test).

@cgl-agent-coordinator

Copy link
Copy Markdown
Contributor

@Pigbibi needs a human: merging this repository deploys; owner approval needed.

@cgl-agent-coordinator

Copy link
Copy Markdown
Contributor

Autoland: escalated to the owner: merging this repository deploys; owner approval needed

@cgl-agent-coordinator

Copy link
Copy Markdown
Contributor

@Pigbibi needs a human: merging this repository deploys; owner approval needed.

@cgl-agent-coordinator

Copy link
Copy Markdown
Contributor

Autoland: escalated to the owner: merging this repository deploys; owner approval needed

@cgl-opencode-reviewer

Copy link
Copy Markdown

AI Code Review (opencode / glm-5.4+kimi-k3.1-pro)

[glm-5.4] The skipped-lockfile metadata feature is sound: filenames/counts from the PR file list are injected only inside the UNTRUSTED_PR_CONTENT boundary while the static calibration text stays outside, truncation semantics are unchanged, both adapters are wired, and unit tests cover batching, diff building, and boundary placement. The incremental changes (dual-model OpenCode cross-review, merged verdicts, blocking-calibration prompt section) are tested and fail-closed (unresolved_findings OR-merged, identical-model config rejected), with no credential leaks or boundary regressions found. Remaining items are low-severity maintainability/robustness notes and a PR-description scope mismatch; no high or medium correctness, security, or missing-critical-test issues. [kimi-k3.1-pro] No blocking issues found. Skipped-file metadata is propagated through both adapters without including patches or affecting truncation, and prompt calibration remains outside the untrusted boundary. The incremental cross-review changes preserve findings from both models, and the new core behaviors have unit test coverage.

Reviewed commit: a1283f6aae · Coverage: complete · Unresolved findings: false

Findings

  • [LOW] packages/review-core/provider.mjs: PR description scope mismatch: the incremental diff adds a dual-model OpenCode cross-review path (mergeCrossReviewVerdicts, crossReview option) and a new 'Blocking vs. Advisory Calibration' prompt section, none of which are mentioned in the PR title/description ('include skipped lockfile metadata in review prompt'). Per calibration rules this is advisory only, but the description should be updated so reviewers/deployers know high-risk PRs can now trigger two billable model calls.
  • [LOW] adapters/cloudflare-workflow/worker.mjs: The cross-review trigger decision (requiredProviderCountForReview(...) > 1) is computed inline in the Cloudflare adapter only; adapters/local-cli/review-pr.mjs never passes crossReview, so the two adapters silently diverge in review rigor for high-risk PRs. Consider centralizing the trigger in review-core (e.g., returning a crossReview flag alongside batches) so both adapters share one policy.
  • [LOW] packages/review-core/provider.mjs: In the dual-model path, Promise.all rejects the whole review if the secondary cross-review model call fails even though the primary verdict succeeded; depending on isNonRetryableProviderError matching, the identical-model config error may also be retried by the workflow loop instead of failing fast as a non-retryable configuration error. Both are defensible fail-closed choices but worth an explicit comment or a targeted test of the failure path.
  • [LOW] packages/review-core/provider.mjs: mergeCrossReviewVerdicts dereferences primaryResult.provider/.model and secondaryResult.model without the optional chaining used elsewhere in the same function; safe for current internal call sites but fragile for an exported helper. Also, dedup of findings (same severity|file|message key) and the summary concatenation are only exercised incidentally by the cross-review test — a small direct unit test would lock in the contract.
  • [LOW] packages/review-core/provider.mjs: blockingCalibrationSection is injected unconditionally into every user prompt, duplicating rules that are already supplied via the AGENTS.md section when present (as in this repo). Harmless but adds prompt tokens on every review; consider gating or trimming when agentsMd already covers the same calibration.

@cgl-opencode-reviewer

Copy link
Copy Markdown

AI Code Review (opencode / glm-5.4+kimi-k3.1-pro)

[glm-5.4] The PR cleanly threads additive skippedFiles metadata from buildReviewBatches/buildReviewDiff through both adapters into buildReviewMessages. Security posture is correct: PR-controlled filenames are emitted only inside the UNTRUSTED_PR_CONTENT boundary, while the static calibration text sits outside it, and the new test explicitly asserts that placement. No credentials, auth, CI-permission, or injection issues; review-core remains free of cloud-specific imports; return-shape changes are additive and non-breaking; the empty-diff early return and truncation semantics are preserved. Only minor nits were found (header count vs. 40-item slice mismatch, redundant defaulting, untested adapter wiring), none of which rise to medium severity. [kimi-k3.1-pro] The change consistently collects skipped-file metadata, propagates it through both adapters, and places trusted calibration outside the untrusted boundary while keeping PR-controlled filenames and metadata inside it. The added test covers batching, diff generation, prompt placement, and the no-skipped-files case. No blocking correctness, security, architecture, or critical-test issues were identified.

Reviewed commit: a37436e69a · Coverage: complete · Unresolved findings: false

Findings

  • [LOW] packages/review-core/provider.mjs: The skipped-files header reports the total count (skippedList.length) but the list is capped at 40 entries via .slice(0, 40) with no '…and N more' indicator, so the header count can silently disagree with the number of lines shown for PRs with >40 skipped files. Consider appending a truncation note when skippedList.length > 40.
  • [LOW] packages/review-core/provider.mjs: Minor redundancy: f.status || 'modified' and f.additions ?? 0 / f.deletions ?? 0 re-default values that buildReviewBatches already normalizes when constructing skippedFiles. Harmless defensive coding, but it duplicates the defaulting logic in two places; a single normalization point would suffice.
  • [LOW] adapters/cloudflare-workflow/worker.mjs: The skippedFiles wiring in worker.mjs and adapters/local-cli/review-pr.mjs (destructure → context → per-batch buildReviewMessages call) has no test coverage; the new test only exercises the review-core functions. The wiring is trivial, so this is not blocking, but a small assertion-level test of the adapter plumbing (where feasible) would guard against future regressions dropping the field.

@cgl-agent-coordinator cgl-agent-coordinator Bot added the agent-approved An AI agent cleared this PR itself. Not an owner-approved confirmation. label Dec 4, 2026
@cgl-agent-coordinator
cgl-agent-coordinator Bot merged commit 4909464 into main Dec 4, 2026
12 checks passed
@cgl-agent-coordinator
cgl-agent-coordinator Bot deleted the fix/include-skipped-lockfiles-summary branch December 4, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-approved An AI agent cleared this PR itself. Not an owner-approved confirmation. needs-human owner-approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant