You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 89b8503
Browse filesBrowse the repository at this point in the historyBrowse files
fix(codex): stop reporting every history failure as a Codex DB lock
The history Worker collapsed every non-converged outcome - a genuine
SQLite busy, a permission denial, an unsafe coordinator path, an
unavailable coordinator database, or a dead/timed-out Worker - into one
message blaming the Codex app/IDE for holding state_5.sqlite. On Windows
that reads as a false lock when nothing holds the file (issue #1191), and
it made every other failure undiagnosable.
- The H/K/N lock modules now compare the requested lock path against its
realpath case-insensitively on Windows (samePathIdentity), matching the
case-insensitive path identity Windows actually has, instead of refusing
legitimate spellings as unsafe-path.
- The Windows runtime root is canonicalized via realpath after creation,
so differently-cased or junctioned LocalAppData spellings land on one
lock namespace.
- restoreLegacyOpenaiHistory now reports its failure reason (busy or
permission) instead of a bare failed flag, so recover-history gets the
same honest classification.
- Apply, restore, and recover-history messages now distinguish genuine
lock/busy from unsafe-path, unavailable coordinator DB, permission
denial, worker error (with the real message), worker death, and worker
timeout, each pointing at 'ocx doctor' when the app is not the cause.
? "the history DB is locked (Codex app/IDE open?). Close it and rerun 'ocx start'."
158
+
: "the history DB is locked (Codex app/IDE open?). It is retried automatically (while the proxy runs and on every 'ocx start'); to force it now, close the Codex app and run 'ocx sync'.";
159
+
}
160
+
if(surface==="recover-legacy"){
161
+
return"the Codex history DB is locked (Codex app/IDE open?). Close it and rerun this command.";
162
+
}
163
+
return"the Codex app appears to be holding the history database. Close Codex and run `ocx restore` again.";
164
+
case"unsafe-path":
165
+
return"opencodex refused its history lock path (unsafe coordinator namespace); this is not a Codex app lock. Run 'ocx doctor' and check the opencodex runtime directory.";
166
+
case"database":
167
+
return"the history coordinator database is unavailable; this is not a Codex app lock. Run 'ocx doctor'.";
168
+
case"desired_disabled":
169
+
return"Codex integration is disabled, so the history operation was skipped.";
170
+
case"desired_enabled":
171
+
return"Codex integration is enabled, so the history operation was skipped.";
172
+
}
173
+
}
174
+
if(outcome.historyFailureReason==="busy"){
175
+
returnsurface==="restore"
176
+
? "the Codex app appears to be holding the history database. Close Codex and run `ocx restore` again."
177
+
: "the history DB is locked (Codex app/IDE open?).";
178
+
}
179
+
if(outcome.historyFailureReason==="permission"){
180
+
return"permission was denied while writing Codex history; this is not a Codex app lock. Run 'ocx doctor'.";
181
+
}
182
+
switch(outcome.reason){
183
+
case"worker-error":
184
+
return`the history worker failed (${outcome.message}). Run 'ocx doctor'.`;
185
+
case"worker-died":
186
+
return"the history worker exited unexpectedly; this is not a Codex app lock. Run 'ocx doctor'.";
187
+
case"timeout":
188
+
return"the history worker timed out; this is not a Codex app lock. Run 'ocx doctor'.";
@@ -1018,11 +1020,7 @@ export async function injectCodexConfig(
1018
1020
config?.syncResumeHistory===false
1019
1021
? ` Codex resume history: left unchanged (syncResumeHistory=false).\n`
1020
1022
: history.failed
1021
-
? legacyMode
1022
-
? ` ⚠️ Codex resume history sync SKIPPED: the history DB is locked (Codex app/IDE open?). Close it and rerun 'ocx start'.\n`
1023
-
: // Honest in every caller context: the daemon retries in the background while it runs,
1024
-
// and this inject path re-runs the migration on every future start/sync anyway.
1025
-
` ⚠️ Codex resume history migration deferred: the history DB is locked (Codex app/IDE open?). It is retried automatically (while the proxy runs and on every 'ocx start'); to force it now, close the Codex app and run 'ocx sync'.\n`
"opencodex refused its history lock path (unsafe coordinator namespace); this is not a Codex app lock. Run 'ocx doctor' and check the opencodex runtime directory.",
1272
+
);
1273
+
case"database":
1274
+
returnfailedHistoryRestore(
1275
+
undefined,
1276
+
"the history coordinator database is unavailable; this is not a Codex app lock. Run 'ocx doctor'.",
0 commit comments