Collabora: after a refused save the editor reloads and then asks "Document has been changed in storage" #913

Closed
opened 2026-10-15 17:18:18 +00:00 by Cordy · 7 comments
Owner

Found during the #908 live check on files (POSIX, v0.6.344) on 2026-10-15. The test folder's .cairn-versions was set to 0500, so saving a version had to fail.

What happened

  • Server side, as designed:
    • Each refused save logged wopi save refused code=version-not-saved and wopi rescue copy saved. One rescue copy, rescue (unsaved edits 2026-10-15 17-16).odt, was refreshed on every refused save.
    • The PutFile answered 503.
    • The bells version-rescue (to the editor) and version-refusals (to the admin) appeared.
  • Collabora side, not as expected:
    • After the first 503 (17:16:38), Collabora sent CheckFileInfo and then reloaded the document contents (GET .../contents at 17:16:43). The text typed before that save disappeared from the editor. It was still in the rescue copy.
    • After two more refused saves, Collabora showed "Document has been changed. Document has been changed in storage. What would you like to do with your unsaved changes? Cancel / Discard / Overwrite".
    • Cairn never sent a 409 / COOLStatusCode 1010. Every PutFile answered 503 with version-not-saved.

Why it matters

The person sees a dialog about a conflict that never happened, and the edits vanish from the editor. Pressing "Discard" or closing the tab leaves the edits only in the rescue copy, which the bell does point to.

To research

  • How Collabora (the version on code.c0rdyceps.ch) handles a 503 from PutFile. Does it treat any failed upload as possible storage modification and reload? What would make it show "failed to save, will retry" instead: a different status, a X-WOPI-* header, or a COOLStatusCode?
  • Whether LastModifiedTime in CheckFileInfo after the refusal is involved. It should be unchanged.
  • What the dialog's "Overwrite" does next: another PutFile that is also refused, so another rescue refresh.
  • Possible fixes:
    • answer the PutFile in a way Collabora shows as a plain save error;
    • or show the bell text in the editor through PostMessage (Action_SaveAs hint, or a custom message);
    • and document what the person should do.
Found during the #908 live check on files (POSIX, v0.6.344) on 2026-10-15. The test folder's `.cairn-versions` was set to 0500, so saving a version had to fail. ## What happened - **Server side, as designed:** - Each refused save logged `wopi save refused code=version-not-saved` and `wopi rescue copy saved`. One rescue copy, `rescue (unsaved edits 2026-10-15 17-16).odt`, was refreshed on every refused save. - The PutFile answered 503. - The bells `version-rescue` (to the editor) and `version-refusals` (to the admin) appeared. - **Collabora side, not as expected:** - After the first 503 (17:16:38), Collabora sent CheckFileInfo and then reloaded the document contents (`GET .../contents` at 17:16:43). The text typed before that save disappeared from the editor. It was still in the rescue copy. - After two more refused saves, Collabora showed **"Document has been changed. Document has been changed in storage. What would you like to do with your unsaved changes? Cancel / Discard / Overwrite"**. - Cairn never sent a 409 / COOLStatusCode 1010. Every PutFile answered 503 with `version-not-saved`. ## Why it matters The person sees a dialog about a conflict that never happened, and the edits vanish from the editor. Pressing "Discard" or closing the tab leaves the edits only in the rescue copy, which the bell does point to. ## To research - How Collabora (the version on code.c0rdyceps.ch) handles a 503 from PutFile. Does it treat any failed upload as possible storage modification and reload? What would make it show "failed to save, will retry" instead: a different status, a `X-WOPI-*` header, or a `COOLStatusCode`? - Whether `LastModifiedTime` in CheckFileInfo after the refusal is involved. It should be unchanged. - What the dialog's "Overwrite" does next: another PutFile that is also refused, so another rescue refresh. - Possible fixes: - answer the PutFile in a way Collabora shows as a plain save error; - or show the bell text in the editor through PostMessage (`Action_SaveAs` hint, or a custom message); - and document what the person should do.
Author
Owner

Research (2026-10-15)

Full findings: cairn-work/scratch/b7e/batch907/913-research.md.

Root cause: Collabora 26.04.3.2, not Cairn. It is confirmed from the COOL pod log and its state dump.

  • After any failed PutFile (500, 503, 507, 423, a timeout; Retry-After is ignored), COOL sends CheckFileInfo again. It decides "did the save land?" by comparing Size (DocumentBroker, the timestamp re-sync after a failed upload).
  • It accepts the save when Size equals the size it just uploaded, or when its "size on server" is non-zero. That field is never set (setSizeOnServer has no caller), so it stays 0.
  • A refused save leaves the old size in place, so COOL always declares a conflict. The log shows "document size neither matches the original, nor our last uploaded. The document is in conflict", with size on server: 0.
    • If the document is unmodified at that moment, COOL closes and reloads it. That is the GetFile 5 s later, and the edits vanished from view.
    • With unsaved edits, it shows the "changed in storage" dialog. "Overwrite" then loops, because each forced save is refused again.
  • Ruled out: LastModifiedTime matches exactly, the refused write never touches the file, and the rescue copy is a separate file.
  • Upstream: related forum thread https://forum.collaboraonline.com/t/false-document-changed-in-storage-conflict-with-sharepoint-on-26-04-after-successful-putfile-without-lastmodifiedtime/4966. Fixed in 26.04.4? Unverified.

Status codes:

  • 413 makes the document read-only for every session, with no reload and no retry.
  • 401/403/404 refresh the token; after 3 tries the session can never save again.
  • 409 is a conflict.
  • Everything else is the generic failure path above.
  • Nextcloud (500, or 423 when locked) and OpenCloud / CS3 wopiserver (500) hit the same false conflict. None of them explains the failure or keeps a rescue copy.

Also found: a storage lock answers 409 + 1010 (wopi.go:157), which is a false "changed in storage" too.

Recommendation:

  • Server: keep 503. In the next CheckFileInfo from the same session, while the file is unchanged, report the refused upload's size once. COOL then treats it as a plain failure: editing continues and it retries every few seconds, with each retry refreshing the rescue copy. The first retry after recovery saves. Locks go to 423 with the same treatment.
  • Editor page:
    • Send Error_Messages to replace COOL's misleading "check your permissions" with Cairn's own text in 4 languages.
    • Add a lasting banner in the editor bar with the rescue copy's name and "Show in folder", driven by the version-rescue bell item.
    • Show the popup once, then only the banner.
    • Warn on close that the edits are only in the rescue copy.
  • Upstream and docs: report the bug to Collabora, and add a handbook note on COOL's quarantine setting.
  • Tests: a fake-COOL contract test (shipped rule and fixed rule), and a real external change still giving a conflict. A live re-run of the #913 setup.

Decisions for Nikola:

  1. Server answer: 503 + one-time size adjustment (rec.), or 413 read-only, or 503 then 413 after N.
  2. Editor page: text override + banner (rec.), or override only, or banner only.
  3. Repeats: popup once, then banner (rec.), or COOL's popup every retry.
  4. Locks: 423 + size adjustment, no rescue copy (rec.), or also a rescue copy, or leave 409.
  5. Upstream bug report + quarantine note (rec. yes).

Mockup needed for the texts, the banner and the close warning. Size: M (server S, about 1 day; editor page 1-2 days).

## Research (2026-10-15) Full findings: `cairn-work/scratch/b7e/batch907/913-research.md`. **Root cause: Collabora 26.04.3.2, not Cairn.** It is confirmed from the COOL pod log and its state dump. - After any failed PutFile (500, 503, 507, 423, a timeout; `Retry-After` is ignored), COOL sends CheckFileInfo again. It decides "did the save land?" by comparing `Size` (DocumentBroker, the timestamp re-sync after a failed upload). - It accepts the save when `Size` equals the size it just uploaded, or when its "size on server" is non-zero. That field is never set (`setSizeOnServer` has no caller), so it stays 0. - A refused save leaves the old size in place, so COOL always declares a conflict. The log shows "document size neither matches the original, nor our last uploaded. The document is in conflict", with `size on server: 0`. - If the document is unmodified at that moment, COOL closes and reloads it. That is the GetFile 5 s later, and the edits vanished from view. - With unsaved edits, it shows the "changed in storage" dialog. "Overwrite" then loops, because each forced save is refused again. - **Ruled out:** LastModifiedTime matches exactly, the refused write never touches the file, and the rescue copy is a separate file. - **Upstream:** related forum thread https://forum.collaboraonline.com/t/false-document-changed-in-storage-conflict-with-sharepoint-on-26-04-after-successful-putfile-without-lastmodifiedtime/4966. Fixed in 26.04.4? Unverified. **Status codes:** - 413 makes the document read-only for every session, with no reload and no retry. - 401/403/404 refresh the token; after 3 tries the session can never save again. - 409 is a conflict. - Everything else is the generic failure path above. - Nextcloud (500, or 423 when locked) and OpenCloud / CS3 wopiserver (500) hit the same false conflict. None of them explains the failure or keeps a rescue copy. **Also found:** a storage lock answers 409 + 1010 (`wopi.go:157`), which is a false "changed in storage" too. **Recommendation:** - **Server:** keep 503. In the next CheckFileInfo from the same session, while the file is unchanged, report the refused upload's size once. COOL then treats it as a plain failure: editing continues and it retries every few seconds, with each retry refreshing the rescue copy. The first retry after recovery saves. Locks go to 423 with the same treatment. - **Editor page:** - Send `Error_Messages` to replace COOL's misleading "check your permissions" with Cairn's own text in 4 languages. - Add a lasting banner in the editor bar with the rescue copy's name and "Show in folder", driven by the `version-rescue` bell item. - Show the popup once, then only the banner. - Warn on close that the edits are only in the rescue copy. - **Upstream and docs:** report the bug to Collabora, and add a handbook note on COOL's quarantine setting. - **Tests:** a fake-COOL contract test (shipped rule and fixed rule), and a real external change still giving a conflict. A live re-run of the #913 setup. **Decisions for Nikola:** 1. Server answer: 503 + one-time size adjustment (rec.), or 413 read-only, or 503 then 413 after N. 2. Editor page: text override + banner (rec.), or override only, or banner only. 3. Repeats: popup once, then banner (rec.), or COOL's popup every retry. 4. Locks: 423 + size adjustment, no rescue copy (rec.), or also a rescue copy, or leave 409. 5. Upstream bug report + quarantine note (rec. yes). **Mockup needed** for the texts, the banner and the close warning. **Size:** M (server S, about 1 day; editor page 1-2 days).
Author
Owner

Decisions (Nikola, 2026-10-15)

All recommendations accepted.

  1. Server answer: keep 503. In the next CheckFileInfo of the same session, while the file is unchanged, report the refused upload's size once.
  2. Editor page: Cairn's own error text through Error_Messages, plus a lasting banner with the rescue copy and "Show in folder".
  3. Repeats: the popup shows once, then only the banner.
  4. Locks: answer 423 with the same treatment, without a rescue copy.
  5. Upstream and docs: report the bug to Collabora, and add a handbook note on the quarantine setting.

A mockup is needed for the texts, the banner and the close warning. It comes after the #911 security patch.

## Decisions (Nikola, 2026-10-15) All recommendations accepted. 1. **Server answer:** keep 503. In the next CheckFileInfo of the same session, while the file is unchanged, report the refused upload's size once. 2. **Editor page:** Cairn's own error text through `Error_Messages`, plus a lasting banner with the rescue copy and "Show in folder". 3. **Repeats:** the popup shows once, then only the banner. 4. **Locks:** answer 423 with the same treatment, without a rescue copy. 5. **Upstream and docs:** report the bug to Collabora, and add a handbook note on the quarantine setting. A mockup is needed for the texts, the banner and the close warning. It comes after the #911 security patch.
Author
Owner

Server part shipped in v0.6.345 (PR #917). Both dogfoods run v0.6.345.

What changed:

  • Size hint: after a refused save (version-not-saved, locked, or a quota refusal), the same session's next CheckFileInfo reports the refused upload's size once, within 30 s, while the file is unchanged.
  • Not covered: a save over the per-file size limit gets no hint (#921). The drain of a refused upload is capped.
  • Captured before the write: the file's state is recorded before the save, so a write made during the refusal still gives a conflict.
  • Locks: a locked save now answers 423, not 409 + 1010. No rescue copy is made.

Local live check (fake Collabora discovery): 14 PASS.

  • A refused save got 503, a rescue copy, the hint once and then the real size. A different token got the real size.
  • A lock got 423 with no rescue copy.
  • An external change got the real size, then 409 + 1010.

Still open:

  • The re-run with real Collabora on files. The dogfood redeploy signed Nikola out; it needs Nikola signed in on files again.
  • The editor page part, decisions 2, 3 and the close warning. It needs a mockup first.
  • The upstream bug report to Collabora (decision 5). Its text is drafted in spec Appendix A, for Nikola to post.
## Server part shipped in v0.6.345 (PR #917). Both dogfoods run v0.6.345. **What changed:** - **Size hint:** after a refused save (`version-not-saved`, `locked`, or a quota refusal), the same session's next CheckFileInfo reports the refused upload's size once, within 30 s, while the file is unchanged. - **Not covered:** a save over the per-file size limit gets no hint (#921). The drain of a refused upload is capped. - **Captured before the write:** the file's state is recorded before the save, so a write made during the refusal still gives a conflict. - **Locks:** a locked save now answers 423, not 409 + 1010. No rescue copy is made. **Local live check (fake Collabora discovery): 14 PASS.** - A refused save got 503, a rescue copy, the hint once and then the real size. A different token got the real size. - A lock got 423 with no rescue copy. - An external change got the real size, then 409 + 1010. **Still open:** - The re-run with real Collabora on files. The dogfood redeploy signed Nikola out; it needs Nikola signed in on files again. - The editor page part, decisions 2, 3 and the close warning. It needs a mockup first. - The upstream bug report to Collabora (decision 5). Its text is drafted in spec Appendix A, for Nikola to post.
Author
Owner

Live re-run with real Collabora on files (v0.6.345): PASS

Setup: the test folder's .cairn-versions was set to 0500 through a temporary debug container. It was reverted afterwards, the debug container stopped, and the test folder deleted and purged.

  1. Typing and saving: three refused saves (21:38:19, 21:38:25, 21:39:01, 21:39:19). Each one logged wopi save refused, then wopi rescue copy saved (one copy, refreshed each time), then 503, then wopi size hint real=696 reported=7205 in the next CheckFileInfo.
  2. No reload: after the refusals, no GetFile was sent and the typed text stayed in the editor.
  3. No conflict dialog: "Document has been changed in storage" never appeared. Collabora showed its plain "Document cannot be saved, please check your permissions." This is the generic text the editor-page part of #913 will replace with Cairn's own wording.
  4. Recovery: after the folder was writable again, the next save answered 200. The pre-edit content became an autosave version (_1a_), and the file holds the edits.

The server part is done. Still open: the editor-page part (Cairn's own text, banner, close warning; needs a mockup) and the upstream bug report (spec Appendix A, Nikola posts it).

## Live re-run with real Collabora on files (v0.6.345): PASS Setup: the test folder's `.cairn-versions` was set to 0500 through a temporary debug container. It was reverted afterwards, the debug container stopped, and the test folder deleted and purged. 1. **Typing and saving:** three refused saves (21:38:19, 21:38:25, 21:39:01, 21:39:19). Each one logged `wopi save refused`, then `wopi rescue copy saved` (one copy, refreshed each time), then 503, then `wopi size hint real=696 reported=7205` in the next CheckFileInfo. 2. **No reload:** after the refusals, no GetFile was sent and the typed text stayed in the editor. 3. **No conflict dialog:** "Document has been changed in storage" never appeared. Collabora showed its plain "Document cannot be saved, please check your permissions." This is the generic text the editor-page part of #913 will replace with Cairn's own wording. 4. **Recovery:** after the folder was writable again, the next save answered 200. The pre-edit content became an autosave version (`_1a_`), and the file holds the edits. The server part is done. Still open: the editor-page part (Cairn's own text, banner, close warning; needs a mockup) and the upstream bug report (spec Appendix A, Nikola posts it).
Author
Owner

Upstream check before reporting (2026-10-15)

  • GitHub (CollaboraOnline/online): there is no issue about the size check after a failed PutFile. Searches for "in conflict" + PutFile, "changed in storage", getSizeOnServer and "size on server" found nothing matching.
  • Forum thread 4966 (https://forum.collaboraonline.com/t/false-document-changed-in-storage-conflict-with-sharepoint-on-26-04-after-successful-putfile-without-lastmodifiedtime/4966):
    • Question 4 of the original post spotted the same getSizeOnServer() condition (a missing == size).
    • Collabora answered only the timestamp part ("fix in 26.04.4", confirmed by the reporter). The size question was never answered.
    • The thread auto-closes on 2026-10-28.
  • Related open GitHub issue #8713, "Additional failure status codes for WOPI operations" (Nextcloud's team, open since 2024): it asks for defined failure codes and a COOLStatusMessage to show the user why a save failed. This is the same need as our editor-page part.

Recommendation:

  1. Re-test with Collabora 26.04.4 first. The deployed version is 26.04.3.2, and 26.04.4 changed the same re-sync code.
  2. If it still happens, reply in thread 4966, building on its question 4, instead of opening a new issue. Use the evidence from spec Appendix A.
  3. Optionally add our use case to #8713.

Cairn already works around the bug on the server since v0.6.345, so this is not urgent for us.

## Upstream check before reporting (2026-10-15) - **GitHub (CollaboraOnline/online):** there is no issue about the size check after a failed PutFile. Searches for "in conflict" + PutFile, "changed in storage", getSizeOnServer and "size on server" found nothing matching. - **Forum thread 4966** (https://forum.collaboraonline.com/t/false-document-changed-in-storage-conflict-with-sharepoint-on-26-04-after-successful-putfile-without-lastmodifiedtime/4966): - Question 4 of the original post spotted the same `getSizeOnServer()` condition (a missing `== size`). - Collabora answered only the timestamp part ("fix in 26.04.4", confirmed by the reporter). The size question was never answered. - The thread auto-closes on 2026-10-28. - **Related open GitHub issue #8713**, "Additional failure status codes for WOPI operations" (Nextcloud's team, open since 2024): it asks for defined failure codes and a `COOLStatusMessage` to show the user why a save failed. This is the same need as our editor-page part. **Recommendation:** 1. Re-test with Collabora 26.04.4 first. The deployed version is 26.04.3.2, and 26.04.4 changed the same re-sync code. 2. If it still happens, reply in thread 4966, building on its question 4, instead of opening a new issue. Use the evidence from spec Appendix A. 3. Optionally add our use case to #8713. Cairn already works around the bug on the server since v0.6.345, so this is not urgent for us.
Author
Owner

Status (2026-10-27):

  • Upstream: the false "Document has been changed in storage" after a refused save was fixed by Collabora in 26.04.4 (commit 82119ac8, "wsd: don't call a failed upload a conflict when storage is untouched"). Nikola decided not to post to forum thread 4966; nothing is reported upstream.
  • Dogfoods: Collabora CODE bumped to 26.04.5.2.1 through GitOps (homelab-config f9724d1), now live. The re-test of a refused save runs with the editor-page build.
  • Editor-page part (decisions of 2026-10-15): whole-page mockup 913-editor-save-refused-mockup.html, awaiting Nikola's approval. It replaces Collabora's misleading "check your permissions" with Cairn's own texts:
    • one popup per refusal episode, with the reason, the rescue copy and "Show in folder";
    • a banner for further refusals;
    • a confirmation once a save goes through;
    • the close warning.
**Status (2026-10-27):** - **Upstream:** the false "Document has been changed in storage" after a refused save was fixed by Collabora in 26.04.4 (commit 82119ac8, "wsd: don't call a failed upload a conflict when storage is untouched"). Nikola decided not to post to forum thread 4966; nothing is reported upstream. - **Dogfoods:** Collabora CODE bumped to **26.04.5.2.1** through GitOps (homelab-config f9724d1), now live. The re-test of a refused save runs with the editor-page build. - **Editor-page part (decisions of 2026-10-15):** whole-page mockup `913-editor-save-refused-mockup.html`, awaiting Nikola's approval. It replaces Collabora's misleading "check your permissions" with Cairn's own texts: - one popup per refusal episode, with the reason, the rescue copy and "Show in folder"; - a banner for further refusals; - a confirmation once a save goes through; - the close warning.
Author
Owner

Decisions (Nikola, 2026-10-27):

  • Mockup: 913-editor-save-refused-mockup.html, frames A to F, approved as drawn, with the recommended answers to its open questions.
  • First popup: Cairn's own dialog shows the reason, the rescue copy, "Show in folder" and "Download a copy". Collabora's popup is blanked; where Collabora stops saving and shows it anyway (413, 403, 401), it carries Cairn's text. This revises decision 2 of 2026-10-15.
  • Save state: a small read-only GET /api/v1/office/save-state?path=…, polled every 5 s only while there are unsaved edits.

Building it for v0.6.365.

**Decisions (Nikola, 2026-10-27):** - **Mockup:** `913-editor-save-refused-mockup.html`, frames A to F, approved as drawn, with the recommended answers to its open questions. - **First popup:** Cairn's own dialog shows the reason, the rescue copy, "Show in folder" and "Download a copy". Collabora's popup is blanked; where Collabora stops saving and shows it anyway (413, 403, 401), it carries Cairn's text. This revises decision 2 of 2026-10-15. - **Save state:** a small read-only `GET /api/v1/office/save-state?path=…`, polled every 5 s only while there are unsaved edits. Building it for v0.6.365.
Cordy closed this issue 2026-10-27 22:26:50 +00:00
Sign in to join this conversation.
No labels
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#913
No description provided.