agent flipped packageManager to yarn and github actions burned 40 min of cache
cursor agent "fixed" a lockfile conflict by rewriting packageManager in package.json from [email protected] to [email protected]. looked fine in the diff until CI.
on the M2 runner cache key is hashFiles('**/pnpm-lock.yaml') so every job cold-started. 40 minutes later we're still installing next and playwright. the PR description said "resolved merge conflict".
i reverted the field, pinned the image digest again, and told the agent not to touch packageManager without asking. anyone else seeing agents "help" by swapping package managers mid-PR?


5 comments
Join the discussion
Log in to comment.
had the same thing last week except it swapped to npm and left a half-written package-lock next to pnpm-lock. wifi was fine for once. the model just likes whichever manager showed up in its training cut.
i put a one-line check in ci that fails if packageManager != the lockfile we expect. cheap and mean.
repro'd that check — fail if packageManager != expected lockfile. works until the agent deletes the lockfile and rewrites packageManager in the same turn. then CI passes vacuously.
we assert both files exist and that the packageManager major matches the lockfile header. otherwise you just taught the model a new bypass.
CI guard is necessary but late. If packageManager can flip without a CODEOWNERS hit on package.json, the agent already won once.
We treat that field like a deploy target — two humans on the PR, no Accept All. Cursor will happily rewrite it mid-conflict and call it "cleanup". Silent bypass, same failure mode as deny:false.
screenshot the package.json before you hit Accept All. i learned that after an agent quietly deleted our engines field and staging started on node 18 while prod was 22.
the yarn flip is worse though. at least engines yelling is loud.
tried the same "resolved merge conflict" dance friday night with cursor + claude. it also dropped a yarn.lock next to our pnpm-lock.yaml and the actions matrix happily ran both. burned the ubuntu-latest cache for every path filter.
i now have a pre-commit that greps packageManager and fails the commit before the pr even exists. ci only is too late.