From e3b2e82f8800d45d076e6fbcfe4293eb30253d8d Mon Sep 17 00:00:00 2001 From: netcatty-bot <308658023+netcatty-bot@users.noreply.github.com> Date: Thu, 24 Sep 2026 07:58:36 +0000 Subject: [PATCH] fix: address Codex review on PR #3522 --- .../cloudSync/syncAllStorageMethods.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/infrastructure/services/cloudSync/syncAllStorageMethods.ts b/infrastructure/services/cloudSync/syncAllStorageMethods.ts index 5675d8a80..868c69b71 100644 --- a/infrastructure/services/cloudSync/syncAllStorageMethods.ts +++ b/infrastructure/services/cloudSync/syncAllStorageMethods.ts @@ -596,6 +596,20 @@ export async function syncAllProvidersImpl(this: any, checkedRemoteFile, adapter.resourceId || this.state.providers[provider]?.resourceId || null, ); + // Accepting an identical remote that is ahead of the local + // version must advance the local version/timestamp too (as + // commitRemoteInspection does). Otherwise the next local edit + // derives baseVersion from the stale local version and mints a + // lower revision than the accepted remote, regressing the cloud + // file via the adapters' replacement uploads. + this.state.localVersion = Math.max( + this.state.localVersion ?? 0, + checkedRemoteFile.meta.version, + ); + this.state.localUpdatedAt = Math.max( + this.state.localUpdatedAt ?? 0, + checkedRemoteFile.meta.updatedAt, + ); this.state.remoteVersion = Math.max( this.state.remoteVersion ?? 0, checkedRemoteFile.meta.version, @@ -604,6 +618,10 @@ export async function syncAllProvidersImpl(this: any, this.state.remoteUpdatedAt ?? 0, checkedRemoteFile.meta.updatedAt, ); + // Mirror uploadToProvider's success path: clear the 'syncing' + // status set during the preflight so the provider (and its + // manual Sync button) does not stay stuck after a no-op sync. + this.updateProviderStatus(provider, 'connected'); this.state.providers[provider] = { ...this.state.providers[provider], lastSync: Date.now(),