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.
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
- #28224
- #29177
- #28997
Powered by Codex Action
Duplicate of:
- https://github.com/openai/codex/issues/28224
Which should have been fixed by:
- https://github.com/openai/codex/pull/29432
- https://github.com/openai/codex/pull/29457
Which were released in:
- https://github.com/openai/codex/releases/tag/rust-v0.142.0
But there still seem to be issues after that:
- https://github.com/openai/codex/issues/28224#issuecomment-4775086154
- https://github.com/openai/codex/issues/29532
Additional Windows reproduction / mitigation data from another Codex Desktop install.
Environment:
- OS: Windows
- Log DB:
C:\Users\Admin\.codex\logs_2.sqlite - Timezone: Asia/Shanghai
- Observed on: 2026-06-23
Observed 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 investigation- Level counts in retained rows:
TRACE:33,672, estimated bytes69,385,610INFO:27,662, estimated bytes37,341,429DEBUG:5,626, estimated bytes7,687,324WARN:226ERROR:28
Recent high-frequency sample:
- Around
2026-06-23 12:10, one minute contained ~2,000log rows, including ~1,499TRACErows. - Recent rows were dominated by websocket/tungstenite internals and frame parsing, including
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,207rows
SQLite metadata:
journal_mode:walpage_size:4096page_count:183,913freelist_count:138,975
The 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:
- Backed up
logs_2.sqlite,logs_2.sqlite-wal, andlogs_2.sqlite-shm. - Added a local trigger to block further inserts into
logs:
CREATE TRIGGER IF NOT EXISTS codex_block_logs_insert
BEFORE INSERT ON logs
BEGIN
SELECT RAISE(IGNORE);
END;
- Ran
PRAGMA wal_checkpoint(TRUNCATE). - Sampled for ~21 seconds afterward.
Post-mitigation sampling result:
MAX(id)stayed fixed at58,204,400- retained row count stayed fixed at
67,214 logs_2.sqlitestayed fixed at753,307,648byteslogs_2.sqlite-walstayed fixed at0bytes
This confirms the write churn was coming through logs inserts, 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 bytes- Retained rows: 7,310
- Levels: TRACE 4,639 (63.5%), INFO 2,190, DEBUG 465, WARN 16
MAX(id): 22,467,668- SQLite freelist: 43,622 / 48,305 pages (~90.3%)
During a 5-second sample, the retained row count stayed constant while MAX(id) increased by 44, confirming continuous insert/delete churn.
RUST_LOG was already warn, with no trace/debug/sqlite override in config.toml. After deleting TRACE/DEBUG, running VACUUM, truncating the WAL, and persisting RUST_LOG=warn, TRACE/DEBUG immediately returned. During a subsequent 10-second sample, MAX(id) increased by 151.
As a diagnostic workaround, a SQLite BEFORE INSERT trigger 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 documented RUST_LOG filter.
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
- OS: Windows
- Codex package:
OpenAI.Codex_26.616.9593.0_x64__2p2nqsd0c76g0 - Codex executable:
C:\Program Files\WindowsApps\OpenAI.Codex_26.616.9593.0_x64__2p2nqsd0c76g0\app\resources\codex.exe - Database:
C:\Users\<redacted>\.codex\logs_2.sqliteC:\Users\<redacted>\.codex\logs_2.sqlite-wal
Observed behavior
The database is in WAL mode. The main database file size stays mostly unchanged, but logs_2.sqlite-wal continues to update while Codex is running.
A read-only snapshot showed:
-
MAX(id)increased by 188 within 10 seconds. -
Later,
MAX(id)increased by another 155 within 25 seconds. -
The total row count did not meaningfully increase, which suggests Codex may be inserting new log rows while pruning old rows.
-
In a recent 30-second window:
- Around 09:30:02, there were about 2010
TRACErows, with an estimated log-body size of about 1.33 MB. - Around 09:31:05, the recent 30-second window still contained about 1258
TRACErows.
- Around 09:30:02, there were about 2010
-
Recent one-hour write sources were dominated by:
TRACE log: 1041 rowsTRACE codex_api::sse::responses: 1003 rows
-
The latest log rows were almost all
TRACE. -
The associated
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.toml
Windows 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 TRACE logs 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 Targets filter (hardcoded TRACE) and only the stderr layer honors RUST_LOG. Fix adds CODEX_LOG_DB_LEVEL (and [log] level) and lowers the default to INFO: https://github.com/denispol/codex/pull/1
I can reproduce this on Windows with Codex Desktop OpenAI.Codex_26.715.8383.0.
A read-only 60.293-second sample after a full app restart showed:
- 436 newly inserted rows by
MAX(id) - 378 TRACE rows (86.7%, about 6.27 TRACE rows/sec)
- about 2.52 MiB estimated TRACE payload
- WAL net growth of 379,040 bytes
- writes continued throughout the window, so this is not startup-only logging
The dominant targets in a later 120-second sample were:
codex_api::sse::responses: 662 rowscodex_app_server::outgoing_message: 309 rowscodex_http_client::transport: 4 rows totaling about 2.38 MB
The transport and SSE records can contain complete request JSON, conversation/tool arguments, and SSE event bodies. I did not attach the database because it contains sensitive local context.
Source inspection agrees with the root-cause analysis in #31542: the SQLite sink has its own TRACE-default filter, while RUST_LOG=warn only limits terminal/stderr output. Restarting with RUST_LOG=warn therefore does not mitigate the SQLite writes.
Could the maintainers please clarify:
- Is there an internal fix plan for this?
- Is there any currently undocumented environment variable or config option that can set the SQLite sink to
warnoroff? - What is the intended design purpose and retention policy of this local SQLite collector?
- Could Codex provide a persistent option such as
CODEX_SQLITE_LOG_LEVEL=warn|off, and avoid persisting full request/SSE payloads by default?
Until there is a supported switch, users handling sensitive work cannot reliably prevent this content from being retained locally.
Confirming this is still very much alive on Windows. I went into the database to find out what's actually burning the space, and it's almost entirely one source.
logs_2.sqlite grew from ~15 MB to 619 MB in a single day — normal usage, nothing unusual. Inspected the table (~31k rows) and the breakdown was lopsided enough that a single module accounts for nearly all of it:
| target | rows | approx bytes |
|---|---|---|
| codex_http_client::transport | 1,567 | ~610 MB |
| everything else combined | ~29,800 | ~8 MB |
So roughly 99% of the growth is full HTTP request/response payloads logged at TRACE. Individual entries run 3 to 5 MB each. The remaining ~30k rows across all the normal debug and info targets add up to less than 8 MB combined.
RUST_LOG=warn does nothing for this sink, confirming what others have reported. No config.toml setting I've found touches it.
I ended up having to script a daily task that kills Codex, renames the SQLite files, and lets the app rebuild them empty. Works, but it's the kind of thing that shouldn't be necessary. Either respect the configured log level or at least give us a knob to disable transport-level payload logging. Right now there's no user-facing way to stop it.
Lots of Windows users hitting this. Would really like to see it get traction.
Tell Codex to use SQLite Trigger to silently drops TRACE logs insertions, it works on my side