Skip to content

[Bug]: scripts/pr operations can overlap on the same pull request #103666

Description

@steipete

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Concurrent scripts/pr operations for the same pull request run without a shared operation lock and can mutate the same worktree and review/prepare/merge artifacts at the same time.

Steps to reproduce

  1. Start a long-running state-changing scripts/pr command for a pull request, such as review validation or prepare gates.
  2. Before it finishes, run another state-changing scripts/pr command for the same pull request from another terminal or worktree.
  3. Observe that the second command starts instead of waiting for the first command to finish.

Expected behavior

State-changing scripts/pr commands for one pull request serialize across all linked worktrees. Commands for different pull requests remain independent. Interrupted or indeterminate ownership fails closed and requires explicit recovery.

Actual behavior

Each invocation independently enters and mutates the same .worktrees/pr-N checkout and .local artifact namespace. Worktree garbage collection can also inspect or remove a pull-request worktree while another scripts/pr operation is using it.

OpenClaw version

main at 9330ad86ffd

Operating system

macOS and Linux source checkouts

Install method

Source checkout

Model

N/A (maintainer tooling)

Provider / routing chain

N/A (maintainer tooling)

Logs

The current wrapper has no cross-process or cross-worktree same-PR serialization boundary.

Impact and severity

  • Affected: maintainers running review, prepare, merge, or garbage-collection workflows concurrently.
  • Severity: high for the affected workflow because competing commands can invalidate evidence or mutate/remove a shared worktree.
  • Frequency: deterministic whenever same-PR operations overlap; overlap itself is intermittent.
  • Consequence: unreliable landing evidence, failed commands, or conflicting worktree state.

Additional information

The desired boundary is per pull request rather than repository-wide so unrelated pull requests can still progress concurrently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintainerMaintainer-authored PR

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions