In OneDev 17.0.2, pull request events can start several concurrent AI workspaces for the same AI user and the same pull request. Each workspace may run the same task on the same source branch, so they race on commits and pushes.
Observed behavior
For one pull request, a single AI user received multiple active workspaces within seconds. The workspaces pushed to the same branch independently. The later workspace got a non-fast-forward rejection, merged the remote branch, reran checks, and pushed a merge commit. This duplicated work and created avoidable merge commits.
Source references (v17.0.2)
PullRequestNotificationManager.runPrompt (lines 681–705) calls workspaceService.runPrompt(...) for each eligible event.
DefaultWorkspaceService.runPrompt (lines 1164–1182) calls create(...) without checking for an existing active workspace for the same AI user and pull request.
PullRequestNotificationManager prevents another AI user from fixing failed builds at the same time (lines 452–461), and merge workspaces are limited by isMergeIfAcceptable() (line 503). I could not find an equivalent guard for the same AI user and pull request.
Expected behavior
For the same AI user and pull request, OneDev should keep at most one active task workspace at a time, or queue/coalesce additional events until the active workspace finishes. The queued task could start from the latest pull request head and receive the newest event context.
Why this matters
AI users are commonly woken by several close events: multiple build jobs finishing, review comments, and pushes. Without per-user/per-pull-request serialization, those events can create parallel writers on one branch.
Possible options
Reuse the active workspace and append the new prompt/event to it.
Queue the new prompt until the active workspace for the same AI user and pull request ends.
Coalesce events during an active workspace and run one follow-up task afterwards.
Summary
In OneDev 17.0.2, pull request events can start several concurrent AI workspaces for the same AI user and the same pull request. Each workspace may run the same task on the same source branch, so they race on commits and pushes.
Observed behavior
For one pull request, a single AI user received multiple active workspaces within seconds. The workspaces pushed to the same branch independently. The later workspace got a non-fast-forward rejection, merged the remote branch, reran checks, and pushed a merge commit. This duplicated work and created avoidable merge commits.
Source references (v17.0.2)
PullRequestNotificationManager.runPrompt(lines 681–705) callsworkspaceService.runPrompt(...)for each eligible event.DefaultWorkspaceService.runPrompt(lines 1164–1182) callscreate(...)without checking for an existing active workspace for the same AI user and pull request.PullRequestNotificationManagerprevents another AI user from fixing failed builds at the same time (lines 452–461), and merge workspaces are limited byisMergeIfAcceptable()(line 503). I could not find an equivalent guard for the same AI user and pull request.Expected behavior
For the same AI user and pull request, OneDev should keep at most one active task workspace at a time, or queue/coalesce additional events until the active workspace finishes. The queued task could start from the latest pull request head and receive the newest event context.
Why this matters
AI users are commonly woken by several close events: multiple build jobs finishing, review comments, and pushes. Without per-user/per-pull-request serialization, those events can create parallel writers on one branch.
Possible options
I can provide a minimal reproduction if needed.