fix(server): Codex shadow homes share thread writer locks with the main home #26286
main fromrefs/pull/26286/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
- apps/server/src/provider/Drivers/CodexHomeLayout.ts line 39Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -26,10 +26,14 @@2626 "cache",2727 "logs",2828 "mcp-oauth-locks",29+ "thread-writer-locks",2930 ] as const;303131-const PRIVATE_ENTRY_NAMES = new Set(["auth.json", "models_cache.json"]);32+// auth.lock guards the shadow home's private auth.json.33+const PRIVATE_ENTRY_NAMES = new Set(["auth.json", "auth.lock", "models_cache.json"]);3234 // Finder maintains metadata separately for each directory, including shadow homes.3335 const SHADOW_LOCAL_ENTRY_NAMES = new Set(["log", "memories", "tmp", ".DS_Store"]);3436 // Shadow homes may create local runtime locks first; replace them with shared links because they guard shared state.35-const REPLACEABLE_SHARED_RUNTIME_ENTRIES = new Set(["mcp-oauth-locks", ".sqlite-maintenance.lock"]);37+const REPLACEABLE_SHARED_RUNTIME_ENTRIES = new Set([38+ "mcp-oauth-locks",39+ "thread-writer-locks",
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- apps/server/src/provider/Drivers/CodexHomeLayout.ts lines 279 to 282Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -255,0 +262,21 @@262+ if (input.entryName === "thread-writer-locks") {263+ const lockNames = yield* input.fileSystem.readDirectory(link).pipe(264+ Effect.catchTags({265+ PlatformError: (cause) =>266+ new CodexShadowHomeFileSystemError({267+ sharedHomePath: input.sharedHomePath,268+ effectiveHomePath: input.effectiveHomePath,269+ operation: "readDirectory",270+ path: link,271+ entryName: input.entryName,272+ cause,273+ }),274+ }),275+ );276+ // Codex deletes a thread lock on release, so one that is left may still guard a live277+ // writer. Keep the local directory until a later setup finds it empty.278+ if (lockNames.some((name) => name !== ".coordination.lock")) {279+ return yield* Effect.logWarning(280+ "Codex shadow home still has thread writer locks; it will share them on a later setup.",281+ { path: link },282+ );
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/server/src/provider/Drivers/CodexHomeLayout.ts line 278OutdatedResolvedby t3dotgg(GitHub profile, opens in a new tab)@@ -253,3 +259,20 @@253259 });254260 }255261262+ if (input.entryName === "thread-writer-locks") {263+ const lockNames = yield* input.fileSystem.readDirectory(link).pipe(264+ Effect.catchTags({265+ PlatformError: (cause) =>266+ new CodexShadowHomeFileSystemError({267+ sharedHomePath: input.sharedHomePath,268+ effectiveHomePath: input.effectiveHomePath,269+ operation: "readDirectory",270+ path: link,271+ entryName: input.entryName,272+ cause,273+ }),274+ }),275+ );276+ // Codex deletes a thread lock on release, so one that is left may still guard a live277+ // writer. Keep the local directory until a later setup finds it empty.278+ if (lockNames.some((name) => name !== ".coordination.lock")) {apps/server/src/provider/Drivers/CodexHomeLayout.ts lines 278 to 282OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -255,0 +262,21 @@262+ if (input.entryName === "thread-writer-locks") {263+ const lockNames = yield* input.fileSystem.readDirectory(link).pipe(264+ Effect.catchTags({265+ PlatformError: (cause) =>266+ new CodexShadowHomeFileSystemError({267+ sharedHomePath: input.sharedHomePath,268+ effectiveHomePath: input.effectiveHomePath,269+ operation: "readDirectory",270+ path: link,271+ entryName: input.entryName,272+ cause,273+ }),274+ }),275+ );276+ // Codex deletes a thread lock on release, so one that is left may still guard a live277+ // writer. Keep the local directory until a later setup finds it empty.278+ if (lockNames.some((name) => name !== ".coordination.lock")) {279+ return yield* Effect.logWarning(280+ "Codex shadow home still has thread writer locks; it will share them on a later setup.",281+ { path: link },282+ );
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- apps/server/src/provider/Drivers/CodexHomeLayout.ts line 263Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -253,3 +259,5 @@253259 });254260 }255261262+ if (input.entryName === "thread-writer-locks") {263+ const lockNames = yield* input.fileSystem.readDirectory(link).pipe(
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed