From 968cb39e8726b3c003ca6e0c510473d8fb064238 Mon Sep 17 00:00:00 2001 From: digua Date: Sat, 13 Jun 2026 13:07:24 +0800 Subject: [PATCH] fix(cli): invalidate preferences cache before applying owner profile on sync The sync module creates its own PreferencesManager at server startup, separate from the one shared by web routes. When the user configures their identity through the web UI, the web routes' manager writes to disk and updates its own cache, but the sync module's manager retains a stale cache from startup. Subsequent pull imports then call tryApplyOwnerProfile with the stale cache, returning no_profile and skipping owner assignment even though a profile exists on disk. Fix: invalidate the sync manager's cache before each onSessionImported callback so the fresh profile is always read from disk. Co-Authored-By: Claude Sonnet 4.6 --- apps/cli/src/sync/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/cli/src/sync/index.ts b/apps/cli/src/sync/index.ts index d353dbdf..829b1d14 100644 --- a/apps/cli/src/sync/index.ts +++ b/apps/cli/src/sync/index.ts @@ -53,6 +53,7 @@ export function initSync( dsManager, logger: syncLogger, onSessionImported: (localSessionId) => { + preferences.invalidateCache() const result = ownerProfileService.tryApplyOwnerProfile(sessionAdapter, preferences, localSessionId) if (result.applied) { syncLogger.info(`[Pull] Applied owner profile to session ${localSessionId} (owner: ${result.ownerId})`)