Codex 0.142.0 still writes high-volume TRACE logs into ~/.codex/logs_2.sqlite after restart
Open 💬 10 comments Opened Jun 24, 2026 by shaoliang-ai
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
Summary:
I am still seeing very high-volume TRACE logging into ~/.codex/logs_2.sqlite on codex-cli 0.142.0, even though the 0.142.0 release notes mention reduced persistent-log churn.
Environment:
- Date observed: 2026-06-24
- Codex version: codex-cli 0.142.0
- Surface: Codex app / local desktop usage
- OS: macOS
- RUST_LOG in shell: warn
What I observed:
- After a clean restart, the first normal conversation immediately recreated high-frequency TRACE writes.
- Within about 60 seconds, recent logs included 1042 TRACE rows.
- The WAL file quickly regrew to about 4.1-4.2 MB.
- Recent entries were still websocket/frame-level TRACE records, e.g. tokio-tungstenite frame parsing / received frame / parsed headers / received message.
Evidence collected before workaround:
- logs_2.sqlite had previously grown to about 198 MB before vacuuming.
- After conservative maintenance, a restart reproduced the issue immediately.
- First post-restart sample:
- logs_2.sqlite-wal: ~4.1 MB
- recent 60s levels: TRACE 1042, DEBUG 20, INFO 19, WARN 2
- 6 seconds later:
- recent 10s levels: TRACE 373, DEBUG 8, INFO 4, WARN 1
Mitigation that worked locally:
I added a local SQLite trigger as a temporary workaround:
CREATE TRIGGER block_trace_logs_before_insert
BEFORE INSERT ON logs
WHEN NEW.level = 'TRACE'
BEGIN
SELECT RAISE(IGNORE);
END;
After restarting Codex with that trigger in place:
- TRACE stopped appearing in recent samples.
- Recent logs became DEBUG / INFO / WARN / ERROR only.
- Example follow-up sample over 10 seconds:
- DEBUG 10, INFO 7, WARN 1, TRACE 0
- WAL still grew normally, but no longer at the previous TRACE-heavy rate.
Why I think this is still a bug:
- The issue reproduces on 0.142.0.
- It reproduces even with RUST_LOG=warn.
- The trigger workaround strongly suggests some TRACE-path writes are still reaching the persistent SQLite log store.
If helpful, I can provide:
- exact sampled SQL queries
- before/after file sizes
- representative recent rows from the logs table
10 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Same as you
Same as you, how to fix it ?
Temporary workaround that worked for me on macOS / Codex 0.142.0:
Quit Codex completely.
Back up:~/.codex/logs_2.sqlite
~/.codex/logs_2.sqlite-wal
~/.codex/logs_2.sqlite-shm
Add this SQLite trigger:
CREATE TRIGGER IF NOT EXISTS block_trace_logs_before_insert
BEFORE INSERT ON logs
WHEN NEW.level = 'TRACE'
BEGIN
SELECT RAISE(IGNORE);
END;
Then run:
sqlite3 ~/.codex/logs_2.sqlite "PRAGMA wal_checkpoint(TRUNCATE);"
This is only a local workaround, not an official fix. In my case it stopped new TRACE rows from being persisted and greatly reduced the log churn / WAL growth.
I’m keeping this trigger in place until Codex 0.143.0+ is available, since PR #29599 says that part of the fix is expected there.
Additional Analysis: SSD Wear Impact & RAM Disk Mitigation
I've conducted a deeper analysis of this issue and found that the impact is more severe than just log volume:
🔴 Severity Assessment
The TRACE logging causes significant SSD wear:
| Metric | Value |
|--------|-------|
| Write speed | ~5MB/s sustained |
| Annual writes | ~640TB |
| SSD impact | Can exhaust 600TBW consumer SSD in <1 year |
| Root cause |
~/.codex/logs_2.sqlitewith WAL mode |📊 My Environment
~/.codex/logs_2.sqlite✅ Verified Mitigation: RAM Disk
I've implemented a RAM disk solution that completely eliminates SSD wear:
Steps:
diskutil erasevolume HFS+ 'CodexRAM' $(hdiutil attach -nomount ram://524288)cp ~/.codex/logs_2.sqlite /Volumes/CodexRAM/ln -s /Volumes/CodexRAM/logs_2.sqlite ~/.codex/logs_2.sqlitelaunchdResults:
💡 Recommendations for Official Fix
📎 References
codex_api::sse::responsesgenerates ~90% of TRACE logsHappy to provide more detailed logs or testing if needed.
I can also reproduce this on Linux with
codex-cli 0.142.0.## Environment
codex-cli 0.142.0~/.codex/logs_2.sqlite## What I observed
After normal Codex usage,
~/.codex/logs_2.sqlitecontinues to receive high-volumeTRACErows.Current file sizes:
``
text
``~/.codex/logs_2.sqlite 277 MiB
~/.codex/logs_2.sqlite-wal 5.6 MiB
~/.codex/logs_2.sqlite-shm 32 KiB
Recent sample from the logs table:
``
text
``last_1_min rows=3006 trace_rows=2817
last_10_min rows=5248 trace_rows=4867
newest 2026-06-25 12:00:16
So this instance was still writing roughly 47 TRACE rows/sec at the time of sampling.
The dominant recent targets were:
```text
log TRACE
codex_api::sse::responses TRACE
hyper_util::client::legacy::pool TRACE
hyper_util::client::legacy::client TRACE
On many Linux systems /dev/shm is tmpfs, so this keeps the SQLite churn in memory instead of on the SSD.
### Pros
### Cons / risks
## Preferred product-side fix
Ideally, Codex should prevent TRACE-level records from entering the persistent SQLite log store by default, especially high-frequency transport/frame/polling logs.
Possible fixes:
The tmpfs workaround helps users avoid SSD churn, but the better fix is to stop high-volume TRACE records from reaching persistent storage in normal usage.
<img width="380" height="264" alt="Image" src="https://github.com/user-attachments/assets/b25813cb-cf31-4c12-89bf-9baf3e1faf98" />
补充一个脱敏的 macOS 数据点:
~/.codex/logs_2.sqlite仍在高频写入 TRACE。TRACE。TRACE为 21,964 行,约占该窗口 65%。TRACE。codex_mcp::connection_manager、log、hyper_util::client::legacy::client、hyper_util::client::legacy::pool、codex_client::transport。我刻意没有贴原始
feedback_log_body、本机路径、会话 ID 或其他可识别信息。这和 issue 里描述的 persistent TRACE / WAL churn 现象一致。
Additional macOS Desktop data point, still reproducible on the current desktop build I have today.
Environment:
/Applications/Codex.app/Contents/Resources/codex app-server --analytics-default-enabledRUST_LOG=warn[analytics] enabled = falseis set in~/.codex/config.tomlObserved from
~/.codex/logs_2.sqliteafter normal Desktop usage:Top TRACE targets in that 1-minute window:
Short live sample over about 12 seconds:
This suggests the Desktop app-server path is still persisting high-frequency TRACE rows even with
RUST_LOG=warnand analytics disabled. The volume is not only raw row count: a small number ofcodex_api::endpoint::responses_websocketTRACE rows can still account for a large share of bytes.I also compared this with an isolated CLI run using a separate
CODEX_SQLITE_HOME;codex exec --ephemeralleft the isolatedlogs_2.sqlitelogs table at 0 rows. So the remaining issue appears to be specific to the Desktop/app-server path rather than thecodex execpath in my local test.No raw
feedback_log_body, session IDs, thread IDs, or machine-specific home paths included here.Confirming this on
codex-cli 0.142.2, pinned to source tagrust-v0.142.2(390b0d25). It's platform-independent (same as the Windows reports #29799/#29463 and macOS #29532); I just hit it on macOS where the OS flags excessive disk writes and, on a busy volume, the continuous WAL I/O stalled the host. It is disk I/O, not memory (process footprint ~130 MB).Root cause confirmed:
log_db::default_filter()hardcodes TRACE and the SQLite sink ignoresRUST_LOG. Fix makes the level configurable and defaults it to INFO: https://github.com/denispol/codex/pull/1Follow-up after upgrading Codex Desktop today: the Desktop/app-server path still reproduces high-frequency persistent TRACE writes on my machine.
Environment:
/Applications/Codex.app/Contents/Resources/codex app-server --analytics-default-enabled[analytics] enabled = falseRUST_LOG=warnRecent 1-minute levels from
~/.codex/logs_2.sqlite:Top TRACE targets in that 1-minute window:
Short live sample over about 12 seconds:
So with Desktop 26.623.31443 / bundled CLI 0.142.2, I still see the app-server path persisting high-frequency TRACE rows. Some byte volume may be lower than the worst earlier websocket-heavy samples, but the row frequency remains clearly abnormal.
No raw
feedback_log_body, session IDs, thread IDs, or user-specific home paths included.