Skip to content

fix(advisor): install from trusted dependency lockfile - #6786

Merged
cv merged 6 commits into
mainfrom
codex/fix-advisor-vitest-runtime
Jul 13, 2026
Merged

fix(advisor): install from trusted dependency lockfile#6786
cv merged 6 commits into
mainfrom
codex/fix-advisor-vitest-runtime

Conversation

@cjagwani

@cjagwani cjagwani commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Replace PR Review Advisor's ad-hoc runtime install with the trusted checkout's repository-locked dependency graph. This keeps the recently restored Vitest inventory path working while pinning the complete direct and transitive graph used by the secret-bearing job.

Bootstrap note: this PR's automatic pull_request_target Advisor run uses the pre-lockfile trusted base and therefore cannot exercise the new npm ci path. A healthy post-merge run is required before the shared lane is considered fully restored.

Changes

  • install dependencies with npm ci from the trusted checkout's committed lockfile, with lifecycle scripts disabled
  • extend the workflow boundary to require the exact Pi SDK, TypeBox, YAML, and Vitest lock entries plus the canonical lockfile-only install command
  • cover the runtime install, lock drift, and decoy-command rejection paths in the integration boundary test

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: this changes only the internal trusted PR Review Advisor runtime and boundary checks
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: the trusted workflow boundary pins the complete committed graph, exact direct runtime versions, and canonical npm ci command, with positive, drift, and decoy mutation coverage; an isolated runtime reproduction exercised the exact previously failing discovery command
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Verification

  • PR description includes the DCO sign-off declaration and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run check:diff passed when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — npx vitest run --project integration test/pr-review-advisor-workflow-boundary.test.ts (21 passed); isolated live-enabled vitest list --filesOnly --json --project e2e-live --project integration (exit 0, 591 files)
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result:
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Additional verification:

  • npm run build:cli
  • npm run typecheck:cli
  • clean isolated npm ci --ignore-scripts --no-audit --no-fund from the trusted repository lock (440 packages), followed by the exact live-enabled inventory command (591 files)

Signed-off-by: Charan Jagwani cjagwani@nvidia.com

Summary by CodeRabbit

  • New Features
    • Enhanced trusted PR review workflow boundary validation to require a pinned VITEST_VERSION and verify runtime dependency pins (including vitest@4.1.9) from the repository lockfile.
  • Bug Fixes
    • Tightened enforcement of a canonical, lockfile-only dependency setup flow, requiring the exact npm ci --ignore-scripts --no-audit --no-fund invocation and rejecting misplaced/decoy install text and lock drift.
  • Tests
    • Updated and expanded boundary tests to cover VITEST_VERSION pinning and the exact npm ci --ignore-scripts --no-audit --no-fund command and ordering.

Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
@cjagwani cjagwani self-assigned this Jul 13, 2026
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0eb7af7a-f75e-43c5-b1d8-2f8538a01985

📥 Commits

Reviewing files that changed from the base of the PR and between 28969bf and a0847cf.

📒 Files selected for processing (1)
  • tools/pr-review-advisor/workflow-boundary.mts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tools/pr-review-advisor/workflow-boundary.mts

📝 Walkthrough

Walkthrough

The advisor workflow now installs dependencies with npm ci from the committed lockfile, adds a pinned Vitest version, and extends boundary validation and tests to enforce the install command and runtime package pins.

Changes

Advisor dependency pinning

Layer / File(s) Summary
Workflow installation and lockfile validation
.github/workflows/pr-review-advisor.yaml, tools/pr-review-advisor/workflow-boundary.mts
Defines the Vitest runtime pin, provisions advisor dependencies with canonical lockfile-only npm ci, and validates pinned environment variables, command ordering, lockfile versions, and workflow wording.
Boundary test coverage
test/pr-review-advisor-workflow-boundary.test.ts
Verifies the updated install command and pinned Vitest configuration, and rejects mutable pins, decoy install text, and lockfile drift.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • NVIDIA/NemoClaw#5873: Updates the same workflow-boundary validator and tests with additional review-job isolation checks.

Suggested labels: chore

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: switching advisor installation to the trusted repository lockfile.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-advisor-vitest-runtime

Comment @coderabbitai help to get the list of available commands.

@github-code-quality

github-code-quality Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage remains at 96%, unchanged from the main branch.

TypeScript / code-coverage/cli

The overall coverage in the codex/fix-advisor-vi... branch remains at 79%, unchanged from the main branch.

Show a code coverage summary of the most impacted files.
File main 834bf7d codex/fix-advisor-vi... a0847cf +/-
src/lib/core/pr...mpt-activity.ts 92% 67% -25%
src/lib/actions...ge-preflight.ts 89% 74% -15%
src/lib/messagi...ate-resolver.ts 88% 76% -12%
src/lib/onboard...reachability.ts 72% 63% -9%
src/lib/messagi...onfig-parser.ts 90% 83% -7%
src/lib/messagi...nes/template.ts 100% 95% -5%
src/lib/adapter.../docker/pull.ts 83% 79% -4%
src/lib/runner.ts 75% 72% -3%
src/lib/security/redact.ts 95% 99% +4%
src/lib/adapter...ocker/volume.ts 70% 85% +15%

Updated July 13, 2026 22:22 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/pr-review-advisor.yaml:
- Line 253: Update the advisor dependency installation command in the workflow
to use a committed lockfile and npm ci, ensuring the complete direct and
transitive dependency graph is pinned and reproducible. Remove the ad-hoc npm
install behavior and preserve the existing dependency version constraints where
compatible.

In `@tools/pr-review-advisor/workflow-boundary.mts`:
- Line 371: Update the assertion around requireRunContains in the workflow
boundary checks to verify that the actual npm install invocation includes
"vitest@${VITEST_VERSION}", rather than accepting matching text from comments,
echo commands, or unrelated commands. Add a regression test covering decoy text
that contains the package string without installing Vitest.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 34b1ea60-218f-4ff1-ac54-64119cea6027

📥 Commits

Reviewing files that changed from the base of the PR and between da86438 and 6bda4a0.

📒 Files selected for processing (3)
  • .github/workflows/pr-review-advisor.yaml
  • test/pr-review-advisor-workflow-boundary.test.ts
  • tools/pr-review-advisor/workflow-boundary.mts

Comment thread .github/workflows/pr-review-advisor.yaml Outdated
Comment thread tools/pr-review-advisor/workflow-boundary.mts Outdated
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
@cv cv closed this Jul 13, 2026
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
@cjagwani cjagwani reopened this Jul 13, 2026
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>

# Conflicts:
#	.github/workflows/pr-review-advisor.yaml
#	test/pr-review-advisor-workflow-boundary.test.ts
#	tools/pr-review-advisor/workflow-boundary.mts
@cjagwani cjagwani changed the title fix(advisor): install trusted Vitest runtime fix(advisor): install from trusted dependency lockfile Jul 13, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tools/pr-review-advisor/workflow-boundary.mts (1)

14-19: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Version pins duplicated between the array and requireEnv calls.

ADVISOR_RUNTIME_PACKAGE_PINS (Lines 14-19) and the requireEnv(..., "PI_SDK_VERSION"/"TYPEBOX_VERSION"/"YAML_VERSION"/"VITEST_VERSION", ...) calls (Lines 286-291) independently hardcode the same four version strings. A partial bump (updating one but forgetting the other) can silently create an inconsistent ratchet between the env-var check and the lockfile-pin check.

As per path instructions, "Derive inventories and limits from a canonical source where possible; flag duplicated lists that can silently drift."

♻️ Proposed fix: derive requireEnv checks from the pins array
 const ADVISOR_RUNTIME_PACKAGE_PINS = [
-  ["`@earendil-works/pi-coding-agent`", "0.80.6"],
-  ["typebox", "1.1.38"],
-  ["yaml", "2.8.3"],
-  ["vitest", "4.1.9"],
+  ["`@earendil-works/pi-coding-agent`", "PI_SDK_VERSION", "0.80.6"],
+  ["typebox", "TYPEBOX_VERSION", "1.1.38"],
+  ["yaml", "YAML_VERSION", "2.8.3"],
+  ["vitest", "VITEST_VERSION", "4.1.9"],
 ] as const;
-  const packages = asRecord(lock.packages);
-  for (const [name, expectedVersion] of ADVISOR_RUNTIME_PACKAGE_PINS) {
+  const packages = asRecord(lock.packages);
+  for (const [name, , expectedVersion] of ADVISOR_RUNTIME_PACKAGE_PINS) {
     const actualVersion = asRecord(packages[`node_modules/${name}`]).version;
-  requireEnv(errors, "review job", reviewJob, "PI_SDK_VERSION", "0.80.6");
   requireEnv(errors, "review job", reviewJob, "FD_FIND_VERSION", "9.0.0-1");
   requireEnv(errors, "review job", reviewJob, "RIPGREP_VERSION", "14.1.0-1");
-  requireEnv(errors, "review job", reviewJob, "TYPEBOX_VERSION", "1.1.38");
-  requireEnv(errors, "review job", reviewJob, "YAML_VERSION", "2.8.3");
-  requireEnv(errors, "review job", reviewJob, "VITEST_VERSION", "4.1.9");
+  for (const [, envKey, version] of ADVISOR_RUNTIME_PACKAGE_PINS) {
+    requireEnv(errors, "review job", reviewJob, envKey, version);
+  }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/pr-review-advisor/workflow-boundary.mts` around lines 14 - 19, Derive
the version values used by the requireEnv checks from the canonical
ADVISOR_RUNTIME_PACKAGE_PINS array instead of hardcoding them again. Update the
logic around the requireEnv calls to map each package pin to its corresponding
environment-variable name, preserving the existing package-to-variable
associations and validation behavior.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tools/pr-review-advisor/workflow-boundary.mts`:
- Around line 14-19: Derive the version values used by the requireEnv checks
from the canonical ADVISOR_RUNTIME_PACKAGE_PINS array instead of hardcoding them
again. Update the logic around the requireEnv calls to map each package pin to
its corresponding environment-variable name, preserving the existing
package-to-variable associations and validation behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 29105cd0-3ca6-421e-9a9c-dcb4533a3772

📥 Commits

Reviewing files that changed from the base of the PR and between 6bda4a0 and 80e0895.

📒 Files selected for processing (3)
  • .github/workflows/pr-review-advisor.yaml
  • test/pr-review-advisor-workflow-boundary.test.ts
  • tools/pr-review-advisor/workflow-boundary.mts

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — Informational

Advisor assessment: Informational / low confidence
Primary next action: No advisor follow-up required beyond maintainer review.
Findings: 0 blockers · 0 warnings · 0 optional suggestions
Status: No actionable findings remain in the canonical review ledger.

E2E guidance

Advisory only: coverage and selector recommendations are non-authoritative. E2E / PR Gate independently computes and dispatches trusted jobs without consuming this output.

Recommended coverage: None
Recommended selectors: None

Why no E2E coverage is recommended: No deterministic or trusted-inventory E2E coverage was selected.

Why no selector is recommended: No trusted E2E selector was selected.

Workflow run details

This is an automated, non-authoritative review. Findings are inputs to maintainer adjudication. Warnings and optional suggestions do not require a response or follow-up. A human maintainer makes the final merge decision.

@wscurran wscurran added area: ci CI workflows, checks, release automation, or GitHub Actions bug-fix PR fixes a bug or regression labels Jul 13, 2026
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
@cjagwani

cjagwani commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator Author

@cv Correction to this handoff: exact head a0847cf79365b85e136697cf089c78ee0eb1b5e0 has green required, standard, security, and E2E checks; resolved threads; and both exact Advisor artifacts are high-confidence with zero findings and all security categories passing. However, the deterministic merge gate is not clean: the canonical Advisor verdict is info_only rather than the gate-required merge_as_is, and pra-gate.ts currently rejects the successful pull_request_target event because it only accepts pull_request. Please do not treat this as a normal gate pass. A human signed squash/merge requires an explicit maintainer exception covering both the informational verdict and the known provenance-checker mismatch.

@cv
cv merged commit 986b883 into main Jul 13, 2026
81 checks passed
@cv
cv deleted the codex/fix-advisor-vitest-runtime branch July 13, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, checks, release automation, or GitHub Actions bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants