Skip to content

Security update runs: planned by rule, verified in the sandbox, never stuck - #634

Merged
nambok merged 1 commit into
mainfrom
sec-dep-fix-runs
Nov 12, 2026
Merged

nambok merged 1 commit into
mainfrom
sec-dep-fix-runs

Conversation

@nambok

@nambok nambok commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Security update runs are now planned by rule and proven in the sandbox before anything is pushed, and they never end by handing unfinished work to a person.

Two real bundle runs showed what went wrong:

  • A large web dependency bundle planned several tasks with the LLM planner, one of them a README table no one asked for. The coder spent many turns in a row thinking up to its output limit without calling a tool. Each turn ended the call, so later steps moved nothing and the run stopped with needs_input. The lockfile was never written, and the branch's manifests didn't match it, so required CI checks failed.
  • A large API dependency bundle planned a framework migration for major upgrades whose findings were all P3 and not reachable. Every sandbox check failed at pnpm install --frozen-lockfile (ERR_PNPM_LOCKFILE_CONFIG_MISMATCH), because the lockfile is written only after the implement step. The migration was never built or tested, and the run finished red.

Changes

  • Plan by rule (common::dep_fix::plan). P0/P1 and reachable findings are always fixed. Every other finding gets the lowest fixed version on its own version line. A major goes in only when an urgent finding needs it, or when there is no fixed version on the line, reachability is unknown, and the policy is fix_in_pr. A major for a finding that isn't reachable or isn't loaded is deferred with its reason (for example "@x 4 to 5 deferred: not reachable, and only a major version fixes it... it opens when it becomes reachable or urgent, or when a person asks for it"). The finding stays open and the reason shows as its wait. Each version line of a package is its own bump, routed through the lockfile it is installed in. Findings read only from the SBOM go through the root lockfile. A yarn lockfile takes one line per package. One run takes at most 6 majors; the rest wait for the next run.
  • Verify before pushing (DepRun + passes::dep_fix):
    • Each probe is one sandbox build. It applies the bumps, then writes the lockfile with the repository's own manager (pnpm install --lockfile-only, npm install --package-lock-only, yarn). Then it runs the repository's checks: install plus type-check/build, CI's lint and format commands, and the unit tests.
    • Manifest edits are deterministic. A direct dependency's range is raised and its prefix kept. A transitive one gets a line-scoped override (pnpm.overrides["pkg@4"], npm overrides, yarn resolutions).
    • The base branch is probed once. A check that already fails there is noted and never blamed on a bump.
    • A red batch is halved, up to 4 probes at once, until the breaking bump is found. That bump is deferred with its error, and the rest is committed green, one commit per verified set.
    • An urgent major that breaks gets one coder pass at its call sites, given the failing output and its release notes. If that doesn't turn green, the branch is put back and the bump is deferred.
    • Nothing unverified is ever committed. When the sandbox can't run the checks on the base branch, only same-line fixes go in and CI decides; majors wait.
  • Plan hygiene:
    • The bump list is the plan: one task per lockfile, never a documentation task, and no LLM planner or plan reviewers.
    • The security ticket body says never to edit documentation unless the ticket asks.
    • Generally, a planned documentation task the ticket doesn't name never holds a run. It is dropped and named under Open items (plan_coverage::drop_non_core).
    • A coder turn cut at the output limit before any tool call is now nudged on, up to twice, to act in small edits. Before, it silently ended the call.
  • Never stuck:
    • A security run's progress includes its probes, so verifying is never counted as a stall.
    • A security run that stalls on the implement work goes on to its checks and pull request with what the branch holds.
    • A run where nothing can ship ends completed with every deferral listed. It never ends needs_input.
    • A retry starts the branch from the base files, so an earlier attempt's migration never lingers.
  • Cost:
    • New setting fix_run_budget_cents (default 300, max 5,000) for the coder's call-site work. Mechanical bumps use no model.
    • A dependency run that changed only manifests and lockfiles skips the model's test writer and security audit.
    • At the budget, the run ships what is green and defers the rest as later. The state is checkpointed per probe on S3, and a retry with more budget picks up only what is left.
    • Tokens, dollars and probes are reported per batch.
  • Outcome: still one pull request per repository. Under "What to check" it lists the applied bumps, the deferred ones with reasons, the checks run in the sandbox (base failures marked as such), and the cost by batch. The Run endings decided in one place: no partial salvage, no #0, never ready or done on red CI #624 ready rules are unchanged: the pull request is green, or it is a draft naming the failing check.

Verification

  • cargo test -p common --lib: 2,032 passed. Includes 25 new dep_fix tests:
    • planner: a P3 not-reachable major is deferred; a P1/reachable major is included; the lowest fixed version is chosen; each version line is its own bump; the major policy; the cap; yarn; the SBOM lockfile; no documentation task
    • the apply script run with node on pnpm, npm and yarn fixtures: direct raise, scoped override, nested project untouched, formatting kept
    • bisect: 1 of 10 bumps breaks typecheck; it is deferred and 9 ship green in at most 10 probes
    • a base-failing check is noted, not blamed
    • two breakers are both found
    • one coder pass per urgent major, and a failed pass is deferred
    • a budget stop leaves a JSON checkpoint that resumes with only what is left
    • a stalled run finishes with what is green and never asks
    • no base signal, uninstallable versions, and a broken sandbox
  • Replays of both runs' findings (names invented, security_testdata/dep_fix_replay.json):
    • API bundle: 55 bumps with 17 majors becomes 60 line-scoped bumps with 6 majors (all urgent or unknown-reachability). 14 bumps are deferred, 10 of them majors that aren't reachable or loaded.
    • Web bundle: 64 bumps with 22 majors becomes 65 bumps with 6 majors in 8 risk batches. 31 are deferred.
    • The tasks are only lockfiles.
  • Worker tests: dep_fix (the coder's narrow plan, the README-stall drop), plan_coverage, the output-limit nudge, security_fixes, generators, checks, steps.
  • Proof against the old code: the bundle-deferral and ticket-hygiene tests fail on main and pass here (see the run notes in the report).

… stuck

A dependency fix run now plans its bumps by rule (urgent and reachable
findings always; the lowest fixed version on each version line for the
rest; majors only when an urgent finding needs one or no line fix exists
and reachability is unknown; majors for findings that aren't reachable
deferred with their reason). The sandbox applies each batch, writes the
lockfile with the repository's own package manager and runs its checks;
a red batch is halved until the breaking bump is found and deferred, the
rest is committed green. The base branch's own failures are noted, never
blamed. The coder only changes call sites of an urgent major, once.

The bump list is the plan (no documentation tasks), a documentation task
the ticket doesn't name never holds any run, a coder turn cut at the
output limit before any call is nudged on, and a security run never ends
needs_input: it ships what is green with every deferral and its reason.
Budget per run (fix_run_budget_cents, default 300), checkpointed and
resumable; cost reported per batch under What to check.
@nambok
nambok merged commit 19146aa into main Nov 12, 2026
10 checks passed
@nambok
nambok deleted the sec-dep-fix-runs branch November 12, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant