# Bug AGILE-426 - Coordinate member and batch moves into the inbox

Project: Stream agile
Status: confirmed
URL: https://community.openproject.org/work_packages/AGILE-426

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions |  |
| Observed in versions |  |
| Sprint |  |
| Backlog bucket |  |
| Bug found in version (deprecated) |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Effort (shirt size) |  |
| Work |  |
| Labor costs |  |

## Description

> \[\!IMPORTANT\]
> This bug is currently only reproducible from code, or not easy to reproduce from a user's perspective

## Problem

A Backlogs member move can race with a collection batch move into the same inbox, causing incorrect persisted placement even though both calls report success.

Follow-up to [AGILE-278 / PR <mention class="mention" data-id="24778" data-type="work_package" data-text="#24778">#24778</mention>](https://github.com/opf/openproject/pull/24778). The explicit-inbox batch fix serializes collection moves per project, but the older `Backlogs::WorkPackages::UpdateService` member path does not participate in that destination mutex. Ordinary Backlogs drags, including one-card drags, already use the collection endpoint; remaining singular service/endpoint callers are the uncovered path.

## Reproduction

Verified on commit `676793abf64` with real database connections and a deterministic scheduling barrier:

1.  Create inbox anchors A and B, batch X1/X2 in a sprint, and member Y in a separate bucket, all in one project.
2.  Start the batch move after B; pause at `insert_at` after `move_after` has read B's position.
3.  Move Y after A through the member service and let it commit.
4.  Resume the batch.

Expected order: A, Y, B, X1, X2. Actual order: A, Y, X1, X2, B. Both services return success. The member move shifts B while the batch holds a stale insertion position.

## Expected behavior

Member and collection placement writers coordinate over their shared destination scope, so concurrent successful moves preserve their requested anchors and contiguous batch membership.

## Merge checklist

- [ ] Audit remaining member-service callers and shared placement scopes, including inbox, sprint and bucket destinations.
- [ ] Establish a consistent lock order compatible with collection moves and sprint/bucket lifecycle services; avoid introducing lock-order cycles or releasing protection before commit.
- [ ] Add a deterministic member-versus-batch concurrency regression asserting persisted order and positions, then verify the fix against it.
- [ ] Preserve singular and collection behavior, atomic rollback, authorization and existing default polling behavior. Record the resulting contention scope.

The verified defect is the inbox case; the other destinations require investigation, not an assumption that every path fails identically. This work is separate from preview performance (AGILE-425) and the Mutex helper's explicit transaction-option fix.
