Summary
After a break of ~30–60 minutes, conversations lose all provider-side context. The UI still shows the full history, but the agent behaves like a fresh session and it doesn't remember prior turns, plans, or tool-call state.
Root Cause
This is caused by two hardcoded defaults in the server:
-
ProviderSessionReaper.ts kills idle sessions after exactly 30 minutes (DEFAULT_INACTIVITY_THRESHOLD_MS = 30 * 60 * 1000). This is an architecture-level behavior that affects all providers (Codex, OpenCode, Claude, Cursor).
-
CodexSessionRuntime.ts gives the Codex app-server process only 2 seconds (CODEX_APP_SERVER_FORCE_KILL_AFTER = "2 seconds") to shut down before SIGKILL. Codex often needs more time to flush its SQLite state DB to disk. When the process is hard-killed mid-flush, the thread file is corrupted or incomplete, so thread/resume fails and silently falls back to a brand-new thread/start.
Why it affects all providers
Related issues
Proposed fix
- Make the idle threshold configurable per environment: 3 hours for desktop (where process lifetime is cheap), 30 minutes for web/shared environments.
- Bump the force-kill grace period for Codex: from 2 seconds to 15 seconds, so the app-server has time to flush its state DB.
- For ACP providers: persist the ACP session ID in
resumeCursor so session/resume can be used on reconnect.
Environment
- Desktop app (macOS, Windows, Linux)
- All providers: Codex, OpenCode, Claude, Cursor
Summary
After a break of ~30–60 minutes, conversations lose all provider-side context. The UI still shows the full history, but the agent behaves like a fresh session and it doesn't remember prior turns, plans, or tool-call state.
Root Cause
This is caused by two hardcoded defaults in the server:
ProviderSessionReaper.ts kills idle sessions after exactly 30 minutes (
DEFAULT_INACTIVITY_THRESHOLD_MS = 30 * 60 * 1000). This is an architecture-level behavior that affects all providers (Codex, OpenCode, Claude, Cursor).CodexSessionRuntime.ts gives the Codex app-server process only 2 seconds (
CODEX_APP_SERVER_FORCE_KILL_AFTER = "2 seconds") to shut down before SIGKILL. Codex often needs more time to flush its SQLite state DB to disk. When the process is hard-killed mid-flush, the thread file is corrupted or incomplete, sothread/resumefails and silently falls back to a brand-newthread/start.Why it affects all providers
thread/resumefails because the state DB was not flushed → falls back tothread/start→ context is lost.session/newinstead ofsession/resumeon reconnect. See [Bug]: OpenCode (ACP) provider creates new session instead of resuming after app/system restart #2838 for detailed analysis.Related issues
activeTurnId)Proposed fix
resumeCursorsosession/resumecan be used on reconnect.Environment