Windows Codex app continuously writes high-volume TRACE websocket logs to ~/.codex/logs_2.sqlite despite RUST_LOG=warn
Summary
On Windows, Codex Desktop continuously writes high-frequency TRACE logs into ~/.codex/logs_2.sqlite, mainly from websocket/tungstenite internals, even though RUST_LOG=warn and analytics/OTel export are disabled in ~/.codex/config.toml.
This causes persistent SQLite/WAL writes and database growth.
Environment
- OS: Windows
- Codex app package:
OpenAI.Codex_26.616.6631.0_x64__2p2nqsd0c76g0 - Codex app-server process:
codex.exe app-server --analytics-default-enabled- Database:
C:\Users\<user>\.codex\logs_2.sqlite- WAL mode with
logs_2.sqlite-wal
Relevant config
~/.codex/config.toml includes:
[analytics]
enabled = false
[otel]
exporter = "none"
Environment variable checks:
RUST_LOG Process = warn
RUST_LOG User = unset
RUST_LOG Machine = unset
Observed behavior
After fully restarting Codex Desktop, logs_2.sqlite continues to receive high-frequency writes.
A 28-second sample after restart showed:
max(id) increased by 573
logs_2.sqlite-wal continued updating
row count stayed constant, indicating new rows are inserted while older rows are deleted
Recent 1000 inserted ids were dominated by:
TRACE log 839 rows
INFO codex_otel.log_only 41 rows
INFO codex_otel.trace_safe 40 rows
TRACE codex_api::endpoint::responses_websocket 40 rows
TRACE codex_api::sse::responses 40 rows
Latest TRACE log bodies include low-level websocket/tungstenite messages such as:
tokio-tungstenite ... compat.rs ... Read.with_context read -> poll_read
tokio-tungstenite ... lib.rs ... WebSocketStream.with_context
Parsed headers [...]
WouldBlock
Impact
- Continuous disk writes to SQLite/WAL
logs_2.sqlitegrowth and churn- Extra local storage usage
- Potential performance and SSD wear concern
- TRACE-level logs may capture more detailed internal request/response metadata than expected
Before manual maintenance, the database was approximately:
logs_2.sqlite before VACUUM: 199,499,776 bytes
logs_2.sqlite after VACUUM: 75,206,656 bytes
After reopening Codex, WAL growth resumed:
logs_2.sqlite-wal around 5 MB and still updating
Expected behavior
With RUST_LOG=warn, [analytics].enabled = false, and [otel].exporter = "none", Codex should not continuously persist high-volume TRACE websocket/tungstenite logs to the local SQLite log store during normal use.
If local SQLite diagnostics intentionally retain TRACE records, there should be a documented configuration option to disable or reduce this verbosity.
Reproduction steps
- Start Codex Desktop on Windows.
- Ensure:
RUST_LOG=warn[analytics].enabled = false[otel].exporter = "none"
- Open or continue a Codex thread.
- Inspect
~/.codex/logs_2.sqliteand~/.codex/logs_2.sqlite-wal. - Sample
max(id),level,target, and WAL modification time over 20-30 seconds. - Observe continuous inserts of
TRACE log,codex_api::endpoint::responses_websocket, andcodex_api::sse::responses.
Notes
I avoided attaching the SQLite database directly because it may contain sensitive local diagnostic/session details.
7 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Duplicate of:
Which should have been fixed by:
Which were released in:
But there still seem to be issues after that:
Additional Windows reproduction / mitigation data from another Codex Desktop install.
Environment:
C:\Users\Admin\.codex\logs_2.sqliteObserved state before mitigation:
logs_2.sqlitesize:753,307,648bytes (~718 MiB)logs_2.sqlite-walexisted and was updatinglogstable retained row count:67,214MAX(id): advanced from58,159,254to58,204,400during investigationTRACE:33,672, estimated bytes69,385,610INFO:27,662, estimated bytes37,341,429DEBUG:5,626, estimated bytes7,687,324WARN:226ERROR:28Recent high-frequency sample:
2026-06-23 12:10, one minute contained ~2,000log rows, including ~1,499TRACErows.WouldBlock,Read.with_context,AllowStd.with_context,WebSocketStream.with_context, received websocket frames, parsed headers, opcodes, etc.Top retained targets by count included:
TRACE codex_api::endpoint::responses_websocket:12,771rows, estimated bytes49,797,435TRACE log:10,515rowsTRACE codex_mcp::connection_manager:2,711rowsTRACE hyper_util::client::legacy::pool:2,652rowsTRACE codex_api::sse::responses:2,418rowsINFO codex_otel.log_only:13,225rowsINFO codex_otel.trace_safe:13,207rowsSQLite metadata:
journal_mode:walpage_size:4096page_count:183,913freelist_count:138,975The large freelist means the DB file stayed large after pruning/retention cleanup, so the retained row count substantially under-represents the write volume that already occurred.
Temporary mitigation applied locally:
logs_2.sqlite,logs_2.sqlite-wal, andlogs_2.sqlite-shm.logs:PRAGMA wal_checkpoint(TRUNCATE).Post-mitigation sampling result:
MAX(id)stayed fixed at58,204,40067,214logs_2.sqlitestayed fixed at753,307,648byteslogs_2.sqlite-walstayed fixed at0bytesThis confirms the write churn was coming through
logsinserts, and blocking that table stopped WAL growth on this machine. This workaround is obviously not ideal because it disables persisted logs, but it was needed to stop the local write churn.Confirmed independently on Windows with Codex Desktop 26.616.9593.0 (x64).
Before cleanup:
logs_2.sqlite: 197,857,280 byteslogs_2.sqlite-wal: 6,027,592 bytesMAX(id): 22,467,668During a 5-second sample, the retained row count stayed constant while
MAX(id)increased by 44, confirming continuous insert/delete churn.RUST_LOGwas alreadywarn, with no trace/debug/sqlite override inconfig.toml. After deleting TRACE/DEBUG, runningVACUUM, truncating the WAL, and persistingRUST_LOG=warn, TRACE/DEBUG immediately returned. During a subsequent 10-second sample,MAX(id)increased by 151.As a diagnostic workaround, a SQLite
BEFORE INSERTtrigger that ignored TRACE/DEBUG stopped those records completely; only one INFO record was added during the next 10-second sample. This suggests the high-volume records are being persisted upstream of, or independently from, the documentedRUST_LOGfilter.No database or raw log bodies are attached because they may contain sensitive session data.
I can reproduce this on Windows with a newer Codex Desktop package.
Environment
OpenAI.Codex_26.616.9593.0_x64__2p2nqsd0c76g0C:\Program Files\WindowsApps\OpenAI.Codex_26.616.9593.0_x64__2p2nqsd0c76g0\app\resources\codex.exeC:\Users\<redacted>\.codex\logs_2.sqliteC:\Users\<redacted>\.codex\logs_2.sqlite-walObserved behavior
The database is in WAL mode. The main database file size stays mostly unchanged, but
logs_2.sqlite-walcontinues to update while Codex is running.A read-only snapshot showed:
MAX(id)increased by 188 within 10 seconds.MAX(id)increased by another 155 within 25 seconds.TRACErows, with an estimated log-body size of about 1.33 MB.TRACErows.TRACE log: 1041 rowsTRACE codex_api::sse::responses: 1003 rowsTRACE.process_uuidpointed to the currently running Codex process.Configuration
I did not find any explicit
TRACE,RUST_LOG, or log-level configuration in:C:\Users\<redacted>\.codex\config.tomlWindows denied reading the full process command line, so I cannot confirm whether the log level is being set by the startup environment.
Expected behavior
Codex Desktop should not continuously persist high-frequency
TRACElogs into the local SQLite log database during normal usage, especially when no TRACE-level logging is configured by the user.If persistent local diagnostic logging is intentional, there should be a documented option to reduce the SQLite log level or disable high-volume TRACE persistence.
Thanks for writing this up. I am seeing a related Windows Codex Desktop performance regression in #28855. My case started with a large
logs_2.sqlite/ WAL problem too, but even after rotating logs and reproducing with small fresh logs, Codex Desktop still caused intermittent mouse/typing/system input lag on Windows.I linked your report in a broader Discussion collecting recent Windows Desktop performance reports here: https://github.com/openai/codex/discussions/29949#discussioncomment-17428007
No action needed from you unless you want to add more detail there, but I wanted to connect the reports because the recent Windows performance issues look related enough that they may need a canonical tracker.
Expected: the SQLite sink builds its own
Targetsfilter (hardcoded TRACE) and only the stderr layer honorsRUST_LOG. Fix addsCODEX_LOG_DB_LEVEL(and[log] level) and lowers the default to INFO: https://github.com/denispol/codex/pull/1