agent tried to rebase its upgrade PR, hit a package-lock.json conflict it couldn't resolve, and force-pushed a fully...
Fixes agents force-pushing fully regenerated package-lock.json files over rebase conflicts. Use when an upgrade PR's lockfile diff explodes after a conflict 'resolution'. Key trigger: lockfile rewritten in full during a rebase.
TL;DR: Never force-push a blindly regenerated lockfile over a rebase conflict. Restore the branch, take the merged manifest, and regenerate the lockfile from it with a package-lock-only install, then check the diff touches only the expected packages. A full regen rewrites thousands of lines and hides real version changes inside the noise.
hit a package-lock.json conflict it couldn't resolve, and force-pushed a fully regenerated file- Restore the branch to before the force-push, using the reflog or the previous CI artifact.
Expected: the bad regen is gone and the conflict is back in a resolvable state.
- Resolve the package.json conflict by hand so the merged manifest is correct and agreed.
Expected: one manifest both sides agree on, with the intended version changes.
- Regenerate the lockfile from the merged manifest with a package-lock-only install.
Expected: a lockfile that matches the merged manifest, with a minimal diff.
- Inspect the lockfile diff: it should touch only the packages the PR intended to change.
Expected: no surprise version churn across hundreds of unrelated entries.
- Push normally, without force-push.
Expected: branch history stays intact and reviewers can see exactly how the conflict was resolved.
Use this when
- A package-lock.json rebase conflict was "resolved" by regenerating the whole file
- The agent force-pushed a fully regenerated lockfile
- A lockfile diff exploded to thousands of lines after a conflict
- "Couldn't resolve" a lockfile conflict led to a blind regen
Not for this skill when
- The conflict is in package.json itself (resolve the manifest first, then the lockfile)
- The lockfile is yarn.lock or pnpm-lock.yaml (different regen commands, same principle)
- The regen was intentional, reviewed, and the big diff was expected
Variant phrasings
- package-lock conflict resolved by force-push
- regenerated lockfile over a rebase conflict
- lockfile conflict "fixed" by full regen
- npm lockfile rebase force-push
Why it happens
Lockfiles do not merge like source files, so the agent reached for the biggest hammer available: delete the conflict by regenerating everything and force-pushing over it. That resolves the git conflict while silently rewriting the entire dependency tree, and the force-push destroys the evidence of what changed.
Edge cases
- If the branch already merged with the bad lockfile, revert the lockfile change in a follow-up PR rather than rewriting merged history.
- Consider a merge driver for package-lock.json so future conflicts auto-resolve to a clean regen without drama.
- In large monorepos, scope the regen to the affected workspace so unrelated packages do not churn.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_BWH3xRioMIV2egJeHFngjQ
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.