⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Jan 12, 2026

  • Tests written, or not not needed

Issue: #16126 (comment)

When a sync conflict occurs during auto-upload, the client repeatedly retries uploading the same file. This results in the user seeing the same conflict notification multiple times, even though the conflict already exists and requires manual resolution.

Changes

After the first auto-upload attempt that results in a sync conflict, the file is marked as handled by the auto-upload system. This prevents further automatic retries for the same file. The conflicted upload remains visible in the Uploads list, where the user can manually resolve the conflict or retry the upload if desired.

@alperozturk96 alperozturk96 force-pushed the fix/re-trigger-auto-upload-file-has-conflict branch from 7b431b7 to 72af6e4 Compare January 12, 2026 08:00
@alperozturk96
Copy link
Collaborator Author

/backport to stable-3.35

Copy link
Collaborator

@ZetaTom ZetaTom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, this means that any files scheduled for Auto Upload which failed to upload due to a conflict, will not be rescheduled.

This improves usability, as users will not receive repeated notifications or prompts to manually resolve conflicts for Auto Upload.

However, it also means that no further attempts will be made once an upload conflict is detected. Conflicts may also be resolved on the server, e.g. by renaming or deleting the file in conflict.

We need to ask ourselves, if this is the right approach. Another option would be to silently retry the upload without telling the user in case it fails again. In either case, the original notification or entry in the failed uploads list would still remain.

If we decide that failed uploads should not be reattempted, this would be an acceptable solution. I've left a comment suggesting a minor improvement.

Comment on lines +404 to +408
private fun createEntityAndUpload(
user: User,
localPath: String,
remotePath: String
): Pair<UploadEntity, OCUpload>? {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning null in this case means that a prior upload failed due to a conflict. In my opinion we shouldn't introduce overall nullability to mean one specific thing. I would prefer if either the OCUpload becomes nullable, or if we return UploadEntity as is and check for uploadEntity?.lastResult in the calling function instead. I think that this would improve readability in the long term.

Copy link
Collaborator Author

@alperozturk96 alperozturk96 Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, and...

The createEntityAndUpload function should either create both the entity and the upload together or not create them at all. We should avoid partially successful executions; it should either succeed completely or fail entirely.

One approach would be to only pass items that are eligible for mapping, ensuring the function always returns valid values.

Alternatively, we could use a sealed class or a kotlin.Result wrapper so the function would never return null.

The current approach is okay, and this logic is only used inside the worker; it is not a general function, so it’s fine to keep it as is for now. In the future, we can improve this as needed, for example, if another condition prevents mapping and we have to handle it differently in the caller function.

@alperozturk96
Copy link
Collaborator Author

If I understand correctly, this means that any files scheduled for Auto Upload which failed to upload due to a conflict, will not be rescheduled.

This improves usability, as users will not receive repeated notifications or prompts to manually resolve conflicts for Auto Upload.

However, it also means that no further attempts will be made once an upload conflict is detected. Conflicts may also be resolved on the server, e.g. by renaming or deleting the file in conflict.

We need to ask ourselves, if this is the right approach. Another option would be to silently retry the upload without telling the user in case it fails again. In either case, the original notification or entry in the failed uploads list would still remain.

If we decide that failed uploads should not be reattempted, this would be an acceptable solution. I've left a comment suggesting a minor improvement.

“Conflicts may also be resolved on the server.” IMO, this scenario is not common. If a sync conflict is not resolved, retrying the upload will only cause unnecessary load. The app will silently hide it and keep retrying in the background. For each attempt on that specific folder, the app will try to upload a file that already has a conflict, which is very unlikely to be resolved automatically (due to changes on remote).

Since users can manage these from the Upload List screen, this PR's approach makes more sense and is the right one to take. @tobiasKaminsky what do you think?

@alperozturk96 alperozturk96 force-pushed the fix/re-trigger-auto-upload-file-has-conflict branch from 72af6e4 to 116078c Compare January 14, 2026 12:25
@github-actions
Copy link

blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed.

@github-actions
Copy link

Codacy

SpotBugs

CategoryBaseNew
Bad practice4343
Correctness7474
Dodgy code257257
Experimental11
Internationalization77
Malicious code vulnerability33
Multithreaded correctness3434
Performance4444
Security1818
Total481481

@github-actions
Copy link

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/16273.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@tobiasKaminsky
Copy link
Member

Yes, no re-schedule.
We wait for any user interaction.

(If people then complain that they forgot to resolve the conflict, we could add a recurring notification like "you have pending conflicts in your upload queue". But this is out of scope for that PR.

So fine from my side ✔

@alperozturk96 alperozturk96 merged commit 7efa568 into master Jan 14, 2026
17 of 21 checks passed
@alperozturk96 alperozturk96 deleted the fix/re-trigger-auto-upload-file-has-conflict branch January 14, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants