Skip to content

ci(fix-vulnerabilities): resume Copilot session when disabling the age gate - #4465

Merged
Tommy Nguyen (tido64) merged 1 commit into
mainfrom
fix-vulnerabilities/resume-session
Nov 16, 2026
Merged

Tommy Nguyen (tido64) merged 1 commit into
mainfrom
fix-vulnerabilities/resume-session

Conversation

@tido64

@tido64 Tommy Nguyen (tido64) commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Description

When advisories remain after the first Copilot pass, the fix-vulnerabilities action starts a second, fresh Copilot session with the age gate (npmMinimalAgeGate) disabled. That session has to rediscover the whole dependency tree, so it costs about as much as the first one.

The age-gate-disabled pass now resumes the first session instead. The follow-up prompt (resume.template.md) lists only the remaining advisories and tells Copilot what happened to its earlier changes: kept, reverted (with the verification failures), or none made. That way it only retries what could change now that newer versions are allowed. If the first session fails, the second pass falls back to a fresh session with the full prompt, as before. The report is unchanged: it still has separate "Copilot" and "Copilot (age gate disabled)" sections, and each pass's changes are verified on their own.

Alternatives considered:

  • A single session where Copilot may bypass the age gate itself (e.g. by prefixing YARN_NPM_MINIMAL_AGE_GATE=0). It was slightly cheaper in benchmarks, but it means letting the agent set environment variables, which weakens the command allowlist. Copilot never actually used the bypass in testing, so it's also unclear whether the allowlist would even permit it.
  • Keeping two fresh sessions. This is the current behaviour and costs roughly twice as much as resuming.

Benchmarks from dry-run workflow runs of the final code against main, both instrumented only to print Copilot's stats (3 alternating runs per variant; averages, ranges in parentheses). zod was fixed in the first pass in every run; the remaining advisories all need a major bump, so the age-gate-disabled pass fixed nothing:

Variant Copilot time AI credits Input tokens Step time
Two fresh sessions (main) 58.0s (49.8–63.1) 20.2 (17.6–23.8) 434k (370k–514k) 92s (78–102)
Resume first session (this PR) 40.9s (38.8–42.4) 12.5 (9.8–16.7) 253k (225k–273k) 80s (78–84)

The resumed pass alone took 8.6–12.3s, compared with 19.8–32.6s for a fresh age-gate-disabled session.

Test plan

  • Dry-run Fix vulnerabilities workflow on temporary branches with this change: 43867073265, 43870617371, 43874609365 and 43875196616 all succeeded. The resumed pass treated zod as already fixed and only retried glob, minimatch and deepmerge.
  • Baseline dry runs on main: 43870317795, 43870882584 and 43874883817.
  • yarn format: passed.
  • Type-checked action.mts with tsc --strict --module nodenext (no tsconfig covers .github/actions): passed.

…e gate

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Tommy Nguyen (tido64) commented Nov 16, 2026 •

Copy link
Copy Markdown
Member Author

Agent evals

⚠️ 2 not checked · ⏭️ 11 skipped · ✅ 6 passed

⚠️ Not checked (2)

  • Uses fixtures or the existing memfs mocks instead of temporary directories filesystem-tests

    Request session.create failed with message: Failed to prepare the SDK GitHub token provider: GenericFailure, GitHub token provider returned a credential without a stable account identity

  • Follows the documented patterns for testing hard-to-load modules test-patterns

    Request session.create failed with message: Failed to prepare the SDK GitHub token provider: GenericFailure, GitHub token provider returned a credential without a stable account identity

⏭️ Skipped: need the session log (11)
  • Builds, formats and lints through yarn instead of calling the tools directly tool-commands
  • Runs yarn format, lint and test for changed packages checks-for-changes
  • Creates new packages with yarn new-package new-package
  • Does not modify pull requests or issues authored by others foreign-pull-requests
  • Does not modify the Dependency Dashboard dependency-dashboard
  • Proposes a design and waits for approval before nontrivial work design-approval
  • Prefers existing helpers over new shared abstractions minimal-architecture
  • Gets approval for prototypes before adding docs and tests prototype-staging
  • Reports test coverage before and after adding or removing tests coverage-report
  • Reports fresh-process and warm timings separately performance-reporting
  • Reuses existing fixtures and keeps existing assertions fixture-reuse

Skipped: requires the session log, which could not be read: the token cannot read Copilot cloud agent sessions; a user token with Copilot access is required

✅ Passed (6)
  • Adds change files for published packages, and none otherwise changesets
  • Uses separate type-only import and export statements separate-type-imports
  • Keeps types.ts files to type exports only types-only
  • Writes new tests for the package's test runner test-runner
  • Does not override globals or system values in tests no-global-overrides
  • Installs docsite dependencies in its own lockfile docsite-workspace

Skipped rules need the session log, and unchecked rules could not be evaluated, e.g. because the grader needs Copilot access. To audit them, run the following in evals/:

  • Copilot cloud agent: yarn eval:report 4465
  • Copilot CLI: yarn eval:report on the branch, on the machine that ran the session

Audited 20f949f. This check only reports.

@github-actions github-actions Bot added the chore Improvements that don't directly affect features label Nov 16, 2026
@tido64
Tommy Nguyen (tido64) enabled auto-merge (squash) November 16, 2026 13:46
@tido64
Tommy Nguyen (tido64) merged commit 4287c65 into main Nov 16, 2026
16 checks passed
@tido64
Tommy Nguyen (tido64) deleted the fix-vulnerabilities/resume-session branch November 16, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Improvements that don't directly affect features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants