🐛 Bug: Concurrent edits silently overwrite work item descriptions (lost images/text)
Is there an existing issue for this?
- [x] I have searched the existing issues
Current behavior
When two people have the same work item open, the one who saves last silently overwrites what the other saved in the meantime, including newly added images. Nobody gets a warning and nothing is merged. The lost content only shows up in the description version history.
Why it happens
- The web editor autosaves the whole description with
PATCH /api/workspaces/<slug>/projects/<project_id>/issues/<id>/, sending{ "description_html": ... }. IssueViewSet.partial_update(apps/api/plane/app/views/issue/base.py) stores the receiveddescription_htmlas is. There is no version,updated_ator ETag check, so it is last-write-wins.- Work item descriptions are not collaborative. The live server only handles
project_pagedocuments (apps/live/src/types/index.ts:TDocumentTypes = "project_page"), so an open editor never receives other users' changes. Its next autosave writes its outdated copy back.
What we observed in production (self-hosted v1.4.2)
API logs with user ids, together with issue_description_versions, show this timeline on one work item (times in seconds, users A and B):
| t | event |
|---|---|
| 0 | B opens the work item (description has 4 images) |
| +9 s | A pastes a new image 6ef7e0ca… (asset upload + PATCH asset 204) |
| +11 s, +14 s | A's description autosaves (PATCH 204), image included |
| +69 s | B saves without having reloaded → 6ef7e0ca… is gone |
- The asset of the lost image was never deleted (
deleted_atis NULL, noDELETErequest). It was simply overwritten. - Earlier the same day, B's stale save also removed ~1,000 characters A had written a minute before (4,768 → 3,782 characters).
- In 3 weeks of logs we counted 26 saves made from a copy older than another user's latest save, on 7 work items. On one item, two users overwrote each other every few seconds for about a minute.
- The description history since 2025-08 contains more cases where an image added by one user disappeared after another user's save.
Steps to reproduce
- Open the same work item in two browsers as user A and user B.
- As A, add an image (or a paragraph) to the description and wait for the autosave.
- As B, without reloading, change anything in the description.
- Reload: A's image or paragraph is gone. The version history shows it existed in A's version.
Expected: A's change is kept (merged), or B is at least told that the description changed and is not allowed to silently overwrite it.
Possible directions
- Make work item descriptions collaborative through the live server, like pages (
description_binaryalready exists onIssue). This removes the problem at its root. - Optimistic concurrency as a smaller step: the client sends the version it started from (e.g.
updated_ator a hash ofdescription_html), the API returns 409 when it is outdated, and the editor refetches and reapplies the user's edit instead of overwriting. - Server-side merge as a stopgap. On our instance we now keep, per user and work item, the description the editor last loaded or saved. When the stored description changed since then, we apply the other users' changes onto the incoming HTML with a block-level 3-way merge (recursing into lists). If both sides changed the same block, both versions are kept. This has stopped the image loss for us. I'm happy to share the patch if it helps, but option 1 or 2 is clearly the better long-term fix.
Related: #9779 (realtime work-item updates for list/board views).
Environment
Production
Browser
Google Chrome
Variant
Self-hosted (Community)
Version
v1.4.2 (same logic on preview as of bab49bb)
Interested in working on this, will raise PR soon:)
I can confirm this also affects external REST API automation on self-hosted Community v1.4.3.
Reproduction in my case:
- Open a work item in the Plane web app.
- Update its
description_htmlthrough the v1 REST API. The API returns success and a subsequent GET returns the new description. - Close and reopen the work-item panel in the SPA, without doing a full browser reload.
- The client still holds the stale description in its store/editor and autosaves it through the internal issue PATCH endpoint.
- A subsequent API GET returns the old description again.
This can happen with only one human user: the REST API client and the open browser effectively act as two concurrent editors. Closing the work-item panel is insufficient because the stale object remains in the SPA store; a complete application reload is required before reopening it.
The API activity history confirms the new description was written and then overwritten by a later browser PATCH. This makes external automation that updates work-item descriptions unsafe while any user has the item loaded. Optimistic concurrency using a revision, updated_at, hash, or ETag would prevent this silent data loss.
Adding the public REST API side of this, with a reproduction, since the thread so far is about the web editor. Same root cause (last-write-wins on description_html, no version check), reproduced on v1.4.3 Community through /api/v1/ with an API key:
- Two clients read the same version of a work item, each appends a paragraph, both
PATCH→ both get200, the first paragraph is gone. - 6 threads each doing GET + PATCH (append one line) on one work item: 1 of 6 lines survived.
Reproduction (standard library only, throwaway project, deletes it at the end, section 1): https://gist.github.com/pitupi/de298ef10103e6004ffa6f2d08c5bc4d
On option 2 ("optimistic concurrency"), a small contract that would serve both the web editor and API clients and stays backward compatible: an optional If-Match: "<updated_at as returned by GET>" on PATCH of a work item (and of a comment). Header absent → today's behaviour. Present and different from the stored updated_at → 412 Precondition Failed with the current updated_at, nothing changed. In the v1 view this would go at the top of IssueDetailAPIEndpoint.patch (apps/api/plane/api/views/issue.py, line 840 at 618d0eb7), inside transaction.atomic() with Issue.objects.select_for_update() so the check and the save cannot interleave; the web IssueViewSet.partial_update could use the same helper. Untested sketch, happy to turn it into a PR if the direction is acceptable.
Until something like that exists, API clients can only serialize their own writes with a lock and verify by reading back, which does not protect against the web UI or another host.