Repository navigation
Description
Area
apps/server
Summary
When codex app-server runs against a CODEX_HOME (such as a separate cockpit-home that symlinks ~/.codex/sessions and archived_sessions while keeping its own state_5.sqlite), a 20s-vs-30s deadlock can permanently lock the Codex provider in Unavailable:
- On initial probe with thousands of historical sessions (~3,000 in my case),
codex app-serverbegins backfillingstate_5.sqlite. - If initial backfill takes longer than T3 Code's default 20s probe deadline (
CODEX_AUTH_PROBE_TIMEOUT_MSinapps/server/src/provider/CodexProvider.ts), T3 Code terminatescodex app-servermid-backfill. - The killed process leaves
backfill_state.status = 'running'instate_5.sqlitewith partial progress (e.g., 1,642 / 3,006 threads indexed). - On every subsequent status check or restart,
codex app-serverseesbackfill_state.status = 'running'and blocks for up to 30 seconds before retrying startup initialization (state db backfill is running at <home>; waiting up to 30s before retrying startup initialization). - T3 Code kills it again at 20 seconds, so Codex never reaches its 30s retry window and the provider stays permanently
Unavailable.
Relation to existing issues/PRs
- Related to Codex provider check times out after 20 s when
codex app-serverstarts slowly #27230 (closed by fix(provider): make readiness probe timeouts configurable #33275). While fix(provider): make readiness probe timeouts configurable #33275 addedT3CODE_CODEX_PROBE_TIMEOUT_MS, the default probe deadline is still 20s, and out-of-the-box users hit this permanent self-lock without any indication ofbackfill_statein the error message. (See also the Nov 2 follow-up comment in Codex provider check times out after 20 s whencodex app-serverstarts slowly #27230 reporting the exact samestate db backfill is runningstall on Windows.)
Steps to reproduce
- Have a
CODEX_HOMEwith astate_5.sqlitewhosebackfill_state.statusis left at'running'while nocodex app-serverprocess is running (naturally triggered when initial backfill of thousands of symlinked sessions exceeds the 20s probe timeout and gets killed). - Open Settings → Providers → Codex (or restart T3 Code) to trigger
checkCodexProviderStatus.
Expected behavior
Codex provider status checks should not permanently deadlock on a stale backfill_state = 'running' lock caused by a killed probe, and when codex app-server reports that state db backfill is running, T3 Code should allow it to recover / complete rather than repeatedly killing it at 20s before Codex's 30s retry window.
Actual behavior
T3 Code repeatedly reports:
Timed out while checking Codex app-server provider status.
Every probe is killed at 20s while codex app-server is waiting up to 30s on the stale backfill claim, so the provider never recovers even after restarting T3 Code. Running codex directly against ~/.codex works immediately.
Impact
Blocks work completely
Version or commit
0.1.12 (also verified on main: CODEX_AUTH_PROBE_TIMEOUT_MS = 20_000 in apps/server/src/provider/CodexProvider.ts)
Environment
macOS 27.2.1 (26B131), Node v22.22.2, codex-cli 0.172.0, T3 Code 0.1.12, ChatGPT Pro
Logs or stack traces
# T3 Code UI / provider status error
Timed out while checking Codex app-server provider status.
# Codex app-server stderr when running manually against cockpit-home
state db backfill is running at ~/.t3/userdata/providers/codex/codex/cockpit-home; waiting up to 30s before retrying startup initialization
# SQLite state observed before recovery
sqlite> SELECT * FROM backfill_state;
-- status = 'running' (stuck), with no codex app-server process running
sqlite> SELECT count(*) FROM threads;
-- 1642 (vs 3006 in ~/.codex/state_5.sqlite where status = 'complete')Workaround
- Confirm no
codex app-serverprocess is running against thatCODEX_HOME. - Back up
state_5.sqliteusingsqlite3 "$DB" ".backup '${DB}.bak'". - Reset the stale claim:
UPDATE backfill_state SET status = 'pending', updated_at = 0 WHERE id = 1;. - Run
CODEX_HOME="$COCKPIT_HOME" codex app-serverdirectly outside T3 Code untilbackfill_state.statusbecomes'complete'(took 10.90s to finish the remaining sessions). - Refresh the Codex provider in T3 Code;
initializethen returns in ~0.05s and the provider immediately becomes ready.
Activity
fix(conn-server): port upstream P0/P1 provider fixes and update audit…