lerna / lerna/lerna

`lerna publish` leaves repo in unrecoverable partial state after mid-air push conflict (tags pushed, release/publish not completed)

Open
#4,349 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
TypeScript
Stars
36.1k
Forks
2.3k
Avg merge
1d 4h
Merged PRs (30d)
50

Description

Current Behavior

In a CI release workflow using lerna publish for a monorepo, a mid-air push to the release branch can cause the publish step to fail in a partial state:

  • git tags are created/pushed
  • release notes and npm publish do not complete

A rerun of the same workflow then fails because the tags already exist remotely, so the release is stuck and not recoverable automatically.

Observed runs:

Expected Behavior

lerna publish should not leave a non-recoverable partial state when the remote branch changes mid-run.

Expected outcomes would be one of:

  1. Publish aborts before pushing tags, or
  2. Publish supports safe/idempotent retry if tags were already pushed, or
  3. Publish provides an official resume/recovery mode for this scenario.

At minimum, rerunning after this failure should not require destructive manual cleanup of tags.

Steps to Reproduce

This is reproducible in CI with concurrent branch movement:

  1. Configure a monorepo release workflow that runs lerna publish on a shared branch.
  2. Start a release job.
  3. While lerna publish is in progress, push additional commits to the same branch (or otherwise move branch state remotely).
  4. Observe that the initial release run fails after partially progressing.
  5. Re-run the release job.
  6. Observe rerun failure due to already-existing tags created by the first run.

I have not yet prepared a minimal public repro repo/PR, but can do so if needed. The linked runs above demonstrate the failure mode in production CI.

This issue may not be prioritized if details are not provided to help us reproduce the issue.

Failure Logs / Configuration

Relevant failing jobs:

Current workaround:

  • Manually delete all tags produced by the failed run
  • Re-run publish
lerna.json

https://github.com/appium/appium/blob/master/lerna.json

{
  "$schema": "https://json.schemastore.org/lerna",
  "changelogPreset": "conventional-changelog-conventionalcommits",
  "command": {
    "add": {
      "exact": true
    },
    "publish": {
      "message": "chore: publish"
    },
    "run": {
      "concurrency": 8
    },
    "version": {
      "conventionalCommits": true,
      "createRelease": "github",
      "allowBranch": ["master", "appium3"],
      "exact": true
    }
  },
  "ignoreChanges": ["**/test/**", "**/*.md"],
  "useNx": false,
  "version": "independent"
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked failing CI jobs and lerna.json, then trace the lerna publish flow around branch movement, tag creation, and retry handling. Reproduce the concurrent-branch scenario if possible and define the recovery behavior that prevents existing tags from blocking a rerun, with coverage for the partial-publish case.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github-actions, typescript
Domain
ci-cd, release
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.