Repository navigation
Description
What version of the IDE extension are you using?
openai.chatgpt-26.406.31014-linux-x64 (VSCodium on Linux Mint)
What subscription do you have?
ChatGPT Plus
Which IDE are you using?
VSCodium (Code - OSS fork)
What platform is your computer?
Linux x64 (Linux Mint)
What issue are you seeing?
During model streaming responses, the Codex app-server binary writes ~5 MiB/s (observed up to ~16 MiB/s in iotop) to ~/.codex/logs_2.sqlite-wal. This results in sustained disk write rates that can significantly impact SSD longevity and system performance.
This issue is independent of the thread-stream-state-changed warning spam and the open-in-targets retry loop, which were investigated separately.
Root cause
The extension correctly sets RUST_LOG=warn when spawning the app-server process — confirmed via /proc/<pid>/environ:
RUST_LOG=warn
However, the SQLite logging sink appears to bypass or not respect the RUST_LOG filter, since TRACE-level entries are still persisted to logs_2.sqlite despite RUST_LOG=warn. The SQLite logging path appears to operate outside of the standard RUST_LOG filtering mechanism, or uses a separate filter configuration.
This was confirmed via strace during streaming:
pwrite64(20</home/k/.codex/logs_2.sqlite-wal>, ..., 4096, ...) = 4096
pwrite64(20</home/k/.codex/logs_2.sqlite-wal>, ..., 4096, ...) = 4096
...
And via SQLite query — MAX(id) jumped by ~5000 rows for a single short (~50 token) response, while total row count remained stable, indicating that rows are being rapidly inserted and pruned/rotated during streaming:
-- Before response:
SELECT MAX(id), COUNT(*) FROM logs; --> 3088667 | 30141
-- After response:
SELECT MAX(id), COUNT(*) FROM logs; --> 3093673 | 30141
Log level breakdown in logs_2.sqlite:
TRACE 20485 (68%)
INFO 8286
DEBUG 1326
WARN 44
Sample TRACE entries written during streaming:
target=hyper_util::client::legacy::pool feedback_log_body="idle interval checking for expired"
target=log feedback_log_body="WouldBlock"
target=log feedback_log_body="/home/runner/work/codex/codex/.cargo-home/git/checkouts/tokio-tungstenite-..."
These are low-level internal network events from tokio-tungstenite and hyper_util with no diagnostic value for end users. They should not be persisted to disk in a production binary — and critically, they are not suppressed by RUST_LOG=warn as one would expect.
What steps can reproduce the bug?
- Open a workspace in VSCodium/VS Code with the Codex extension.
- Confirm
RUST_LOG=warnis set:
cat /proc/$(pgrep -f 'codex.*app-server')/environ | tr '\0' '\n' | grep RUST_LOG- Run
strace -f -e trace=pwrite64 -p $(pgrep -f 'codex.*app-server')in a separate terminal. - Ask any question in the Codex chat panel and observe streaming.
- Observe continuous
pwrite64calls tologs_2.sqlite-walat ~5 MiB/s despiteRUST_LOG=warn.
Alternatively, check log level distribution after a session:
sqlite3 ~/.codex/logs_2.sqlite "SELECT level, COUNT(*) FROM logs GROUP BY level ORDER BY COUNT(*) DESC"What is the expected behavior?
RUST_LOG=warn should suppress TRACE and DEBUG output everywhere, including the SQLite logging sink. The current behavior — where RUST_LOG=warn suppresses stderr output but does not affect SQLite persistence — is inconsistent and undocumented.
TRACE-level events from internal networking libraries (tokio-tungstenite, hyper_util) should never be written to the persistent SQLite log database during normal operation.
Additional information
Suggested fix
The SQLite logging sink in app-server should apply the same log-level filter as RUST_LOG (or the internal tracing subscriber filter), rather than maintaining a separate or hardcoded verbosity level. The fix should ensure that setting RUST_LOG=warn — as the extension already does — is sufficient to suppress TRACE/DEBUG writes to logs_2.sqlite.
Workaround
Users can redirect logs_2.sqlite to tmpfs to protect their SSD while waiting for a fix:
# stop VSCodium first
mv ~/.codex/logs_2.sqlite ~/.codex/logs_2.sqlite.bak
ln -s /tmp/logs_2.sqlite ~/.codex/logs_2.sqliteNote: logs_2.sqlite contains only internal diagnostic logs — no conversation history — so data loss on reboot is acceptable.
After symlinking logs_2.sqlite to tmpfs, disk I/O from the Codex extension dropped to zero during streaming, confirming that the SQLite WAL is the sole source of the observed write load.
Workaround 2: block inserts into the SQLite log table
Another workaround was suggested by @synap5e in this comment:
#17320 (comment)
Instead of redirecting logs_2.sqlite to tmpfs, users can prevent new rows from being inserted into the logs table by adding a SQLite trigger:
sqlite3 ~/.codex/logs_2.sqlite "CREATE TRIGGER IF NOT EXISTS block_log_inserts BEFORE INSERT ON logs BEGIN SELECT RAISE(IGNORE); END;"This causes attempted inserts into the logs table to be ignored without returning an error to the application, which should prevent logs_2.sqlite-wal from growing due to persistent TRACE/DEBUG log writes.
To remove the workaround:
sqlite3 ~/.codex/logs_2.sqlite "DROP TRIGGER IF EXISTS block_log_inserts;"As with the tmpfs workaround, this is not a proper fix. It disables local persistent logging rather than fixing the underlying issue: the SQLite logging sink appears to ignore RUST_LOG=warn and continues persisting TRACE/DEBUG entries during normal streaming.
Activity
christopherball commentedon Apr 15, 2026
I haven't dug into this issue with the same depth as you have, but I started noticing HUGE swings in my disk use over the past month (like 60GB less by end of a single day just doing light-weight work with codex). I eventually realized the "Code Helper" under "disk" within the Activity Monitor on MacOS was showing insane amounts of data being written to disk. This was happening even when I wasn't actively using VSCode (just remained open from past completed Codex work). In my particular case, even after closing VSCode and restarting, the disk space wasn't reclaimed.
It took some extra time to realize this bug was perfectly paired with the default setting of Time Machine holding onto local hourly snapshots on disk so I went ahead and did a backup, manually deleted all local snapshots, and set Time Machine to manual so as to avoid compounding this particular Codex bug.
Given its current state, I am literally going to stop using Codex for now, as it aggressively writes to disk all the time and there's nothing I can do about it. Apologies if what I've described isn't an exact match, but given the overlap of the extension writing to disk at aggressive rates, it felt related.
clemisch commentedon May 16, 2026
I also see this behavior. Do you still have this problem? Could you fix it by symlinking to a tmpfs? Just linking
logs_2.sqliteto tmpfs didn't solve the apparent disk writes for me (unless Linux reports writes to tmpfs equally??)I searched for similar issues and there are mutliple, but no reaction at all from the devs yet. These issues are a month old already 😬
piotrkacala commentedon May 17, 2026
It's a workaround but yes, it works. Just make sure that your /tmp is using RAM. Some distros have it set to HDD/SDD.
clemisch commentedon May 17, 2026
Thanks. I ended up just symlinking the whole
~/.codexfolder (and copying it back before shutdown, hopefully...). /tmp is indeed a tmpfs for me.niklassheth commentedon May 21, 2026
I also found this while investigating Codex's CPU usage, writing these trace level logs burns a lot of CPU. A way to reduce the logging level should be added to speed up Codex on older devices.
synap5e commentedon May 22, 2026
niklassheth commentedon May 22, 2026
I tested this and it helps a lot, but there's some more CPU savings from disabling the logging fully.
Each Codex instance was prompted to edit a json file.
clemisch commentedon May 22, 2026
how did you do that?
niklassheth commentedon May 22, 2026
I patched the codex source to remove the log db's initialization.
Patch: disable log DB initialization
emaadmanzoor commentedon Jun 7, 2026
Useful workarounds here when using Codex on a Raspberry Pi with SD card storage, thanks!
insilications commentedon Jun 19, 2026
This kind of program behavior is disrespectful in general, especially toward users with SSDs.
17 remaining items
Nicolas0315 commentedon Jul 26, 2026
Correction: measured in vivo, my 70.1% figure was too low and described a narrower change
I built a patched app-server and measured it against the production backend rather than modelling it. Two of my earlier numbers need correcting, and one of my conclusions was backwards.
Setup.
codex-app-serverbuilt from a patched tree, driven over JSON-RPC/stdio through real model turns, 6 turns per arm, each arm with its own isolatedCODEX_SQLITE_HOME. Write volume measured per turn by polling the WAL-index header in each arm's ownlogs_2.sqlite-shm, soframes × 4120 Bis exactly what was appended to that arm's WAL with no contamination fromstate_5/goals_1/rollout writes. Numbers are normalised per clean turn (zero error notifications).What I got wrong. The 70.1% above was modelled from content-byte shares. The input was right — TRACE really is 76.4% of rows and 67.7% of
SUM(estimated_bytes)in an unpruned real session — but WAL volume does not scale with content bytes. It scales with pages dirtied across thelogstable's four indexes, with the number of 2-second flush commits (19.5 → 5.3 per turn), and with the row-cap pruning the unfiltered sink performs continuously: filtering removes the inserts and the ~8,600 DELETEs they trigger. Note also that 70.1% described "discard TRACE only", which is a narrower intervention than "WARN and above".The counter-effect I predicted earlier — that filtering thins the batches and raises per-insert cost — is real but an order of magnitude too small to flip the sign. Bytes per surviving insert rose 2,642 → 5,476 → 20,011 across the three arms, costing roughly 5 percentage points against a 95% row reduction.
The unfiltered baseline came out at 2,642 B per attempted insert here, against 3,787 from the synthetic harness and 3,891 from an instrumented stock 0.145.0 run. Treat that figure as 2,600–3,900 depending on workload shape rather than a constant.
What I had backwards. I said turning the sink down reduces what
/feedbackand crash reports can include. That is true of per-event detail and false of history.LOG_PARTITION_ROW_LIMITis 1,000 per partition, so in the unfiltered arm 9,638 rows were inserted and 1,159 retained, with the threadless partition holding ids 8631–9638 exclusively — the first 89.6% pruned away inside a single 160-second, six-turn session, leaving roughly the last 30 seconds of process history. That arm retained zeroERRORrows. TheWARN-and-above arm retained all of its rows, including 6ERROR. So the unfiltered sink evicts the levels most likely to matter, and turning it down widens the useful diagnostic window rather than narrowing it. That seems worth weighing against the "we need TRACE for/feedback" argument for the current default.Two reproduction notes, in case they help anyone else measuring this:
400 Bad Requestonwss://chatgpt.com/backend-api/codex/responsesand every turn aborted.Feature::ResponsesWebsocketsisStage::Removed, so there is no flag left to disable it; I had to add a[model_providers.*]entry cloning the ChatGPT provider withsupports_websockets = falseto force the HTTP SSE path — which is also the path that emitscodex_api::sse::responses. Possibly specific to my account or build, but it made the default path unmeasurable.Exceeded maximum HTTP header buffer size of 100KB. That string does not appear anywhere in the tree, so it is server-side. It killed 2–4 of 6 turns per arm, which is why everything above is normalised per clean turn.Caveats on the new numbers. Windows, one machine, debug build, 3–6 clean turns per arm, and the unset baseline itself varied between 771 and 1,028 WAL frames per turn across two runs. Treat 86% as the floor for "discard TRACE only" rather than a precise figure.
One methodology caveat on my fleet table. The inserts/day column was
(MAX(id) − MIN(id)) / (MAX(ts) − MIN(ts))over retained rows. The numerator is sound, but the denominator is set by retention, not by activity — the oldest retained row is whatever survived the row cap in a quiet partition. It is a rate over a retention-determined span, not a sustained daily average, and the bias direction differs per machine. Only the 0.145.0 cell has been recomputed since (77,626/day against the 73,357 reported, the difference being load I drove in while measuring).The reference branch has been updated with the parse-normalisation and documentation fixes that came out of this:
Nicolas0315/codex@feat/configurable-sqlite-log-verbosity. Still no PR unless invited.Nicolas0315 commentedon Jul 26, 2026
Correction: my ERROR-row comparison did not support the conclusion I drew from it
In the comment above I wrote that the unfiltered arm retained zero
ERRORrows while theWARN-and-above arm retained all of its rows including 6ERROR, and offered that as evidence that the unfiltered sink evicts its own errors. Both counts are real, but they are not comparable and do not support that inference. The two arms are different processes with different error populations — the unfiltered arm logged no turn errors at all, so it had noERRORrows to lose — and a second session under the default filter did retain 4ERRORrows. A reviewer of my own working notes caught this.The eviction mechanism itself does not depend on that pair.
LOG_PARTITION_ROW_LIMITis 1,000 per partition, and in a 160-second six-turn session the threadless partition held ids 8631–9638 out of 9,638 inserted — the first 8,630 rows, 89.6%, pruned inside that session, leaving roughly the last 30 seconds of process history. That is the measured claim, and it stands: on a busy session the sink can evict any level, including warnings and errors, within seconds. What I cannot claim from my data is a specific ERROR-row count difference between filtered and unfiltered runs.So the weaker version is what I should have written: the default's TRACE volume shortens the retained window for every level, and a lower setting lengthens it. Whether that outweighs the loss of per-event TRACE detail for
/feedbackis a judgement call for the team, not something my numbers settle.Nothing else in the measurements above changes — the WAL-frame accounting, the 86–90% and 99.2% reductions, and the per-insert byte range are unaffected. The reference branch has the corresponding documentation fix.
Nicolas0315 commentedon Jul 26, 2026
Release-build confirmation, and corrections to how I reported bytes and rates
Two independent reviews of my own working notes, a release-profile re-run, and a re-measurement of the five machines. The reduction figures hold; several of the things I wrapped around them do not.
The reduction holds on a release build
Repeated on
cargo build --release -p codex-app-serveragainst real model turns, 8 turns per arm: discarding TRACE only cuts WAL write per clean turn by 88.4% prompt-matched, and WARN-and-above by 99.21%, against 89.7% and 99.17% on the debug build. Matched on prompt index the two baselines agree within 0.9% on WAL frames and 0.07% on attempted inserts, and rows per flush transaction is 82.6 release against 82.2 debug — turn duration is network-bound either way, andLOG_BATCH_SIZE = 128forces most of an unfiltered turn's commits by row count rather than by the 2-second ticker, which is profile-independent by construction. So the debug-build caveat can be retired.One correction to my own hedge. I wrote that the unset baseline "varied 771–1,028 WAL frames per turn across two runs, so treat 86% as the floor." That rationale was wrong: attempted inserts are a deterministic function of the prompt and reproduce across three runs and both profiles. The spread came from backend errors killing the four longest prompts in one run, leaving the two shortest. The band is 88–90%.
Bytes per insert: two accountings, not scatter
Reporting "2,600–3,900 B" implied measurement noise. It is a bracket:
logs_2.sqlitegives 2,530–2,663 B per attempted insert across four sessions on both profiles. That is a lower bound — it counts each page once as it is appended to the WAL, and not again when the checkpoint writes it into the main database.state_5.sqlite,memories_1.sqlite,goals_1.sqliteand the session files. In one runstate_5.sqlite's WAL alone grew 2.4 MB.Read it as roughly 2,600 B of WAL append and roughly 3,800 B of total device write per persisted row. Relatedly, the reduction figures above are WAL-append reductions; checkpoint volume tracks WAL volume so the direction and order hold, but I have not measured device writes per arm.
Also: I said that harness carried "the same five indexes". The production table has four. Five is the count in
logs_migrations/0001;0002rebuilds the table with four, droppingidx_logs_process_uuid. The harness created four, so the measurement is unaffected.The five-machine table: right numbers, wrong label, and one estimator I nearly published that is wrong
The
inserts/daycolumn was(MAX(id) − MIN(id)) / (MAX(ts) − MIN(ts))over retained rows. Every cell reproduces within 0.9%, but the denominator is not an activity window — the oldest retained row is whatever survivedLOG_PARTITION_ROW_LIMITin the quietest partition.I set out to replace it with
sqlite_sequence.seq / file age, which looks sound because0001creates the table empty and0002copies ids through unchanged. Do not use it. On the busiest machine it gives 13.2 M/day, and a maintenance VACUUM had reset that file's creation time. The check that catches this is cheap: several of these machines keep dated copies oflogs_2.sqlite, which turn into a snapshot series. DifferencingMAX(id)between consecutive snapshots gives a rate with an unambiguous denominator:So the published column was closer than its derivation deserved — within 0.3% and 6% on the two Windows machines, and inside the measured band on the Mac — while the estimator I was about to substitute overstates by an order of magnitude. On one Mac the current file's
MAX(id)is below its own earlier snapshot's, which is how a lineage reset looks; treat any per-file lifetime average as suspect unless the oldest row is stillid = 1.My
survivalcolumn (2.0 / 14.3 / 45.3 / 11.7 / 12.7%) should be disregarded. It is close to a partition count: threadless rows retained in the last 24 hours are exactly 3,000, 3,000, 4,000 and 4,000 on four of these machines, and 47 of 919 partitions on the busiest sit exactly at 1,000.The version labels on both tables were wrong in kind
Each
logs_2.sqliteis written concurrently by several codex binaries. Joininglogs.thread_idtothreads.cli_versioninstate_5.sqliteshows 0.144.2 through 0.146.0-alpha.3.1 writing into single files, and on all five machines the process actually writing was a desktop-app-bundled binary rather than whatevercodexresolves to onPATH. A table row cannot carry one version.The
hyper_utilfinding survives as a mechanism rather than a per-machine fact:("hyper_util", LevelFilter::WARN)is absent fromdefault_filter()atrust-v0.144.6and present atrust-v0.145.0, and the machines with a large share are the ones where a pre-0.145.0 writer ran inside the retained window. Two of the four need a time label — the 43.1% machine last wrote such a row 48 hours before sampling and is at 0.0% over its last 24 hours; the 80.2% machine is at 16.0%. Only the 29.1% and 37.7% machines are current, at 53.0% and 35.5% of their last 24 hours. Likewise the 32.4%codex_api::sse::responsesshare I reported for one machine came from a single 71-minute burst 211 hours before sampling and is 0.0% of its last 24 hours; the 48.2% machine now reads 39.6%.One consequence for the proposal itself, which I had not considered:
CODEX_SQLITE_LOGcan only govern inserts from processes running a build that has it. One of these files is still receivingtarget='log'rows that the unconditionalon_eventguard has excluded since #29599, so a co-resident writer predates or bypasses it.Unchanged: the
synchronousfinding, and the migration-0002 trigger behaviour, which I have since read line by line rather than inferred.btglr commentedon Jul 26, 2026
Jesus please turn off your agent, what you're doing is useless.
Nicolas0315 commentedon Jul 26, 2026
Closing three loose ends: device writes, why my two reduction figures disagreed, and migration 0002 executed
The reduction is the same in device writes as in WAL appends
I caveated the 88–90% and 99.2% figures as WAL-append reductions, with checkpoint volume unmeasured. Measured now, on the same runs, with both instruments — WAL frames from the WAL-index header, and process I/O counters, which include the checkpoint write-back:
The two accountings agree within 0.3 points at every point, so that caveat can be dropped: cutting WAL appends cuts device writes by the same proportion, because checkpoint volume tracks WAL volume.
Why 70.1% and 88–90% both held, and what supersedes both
I earlier described the 70.1% as an underestimate that the in-vivo 88–90% replaced. That framing was wrong, and the table above shows why: the reduction tracks the share of the workload you are cutting, almost one-for-one. 70.1% came from a synthetic workload whose TRACE share was 70.4%. The 88–90% came from six back-to-back streaming turns, where TRACE was about 95% of attempted inserts. Both are correct measurements of different workloads; neither is "the" number.
So the honest statement is a model rather than a percentage: byte reduction ≈ the share of inserts you remove, within a few points. In the real streaming arms it landed slightly below the row share — 89.7% of bytes against 95.0% of rows — because the rows that survive TRACE filtering are individually larger than the ones removed. In a uniform-row-size synthetic workload it lands slightly above, because removing rows also removes commits and index churn.
The practical consequence for this issue is unchanged and, if anything, easier to reason about: on TRACE-dominated traffic, which is what streaming turns produce,
warnremoves ~99% and dropping TRACE alone removes ~86–90%. On mixed or mostly-idle traffic the same settings remove proportionally less, roughly whatever fraction of your rows is TRACE. Anyone reproducing this should report their TRACE share alongside the percentage, which I should have done.Migration 0002 executed rather than read
I claimed from the SQL that a user trigger on
logsis silently dropped. Executed now against a throwaway database carrying three kinds of user object, with0001and0002fetched verbatim frommain:CREATE TRIGGER ... BEFORE INSERT ON logs— gone, and the migration raised nothing. A post-migration TRACE insert is no longer suppressed, so a user relying on this loses protection with no signal.AFTER INSERT ON logswriting to another table) — also gone.logs— survives insqlite_masterbut is permanently broken:SELECTagainst it returnsno such table: main.logs_old.ALTER TABLE logs RENAME TO logs_oldrewrote the view's body, andDROP TABLE logs_oldleft it pointing at nothing.The migration succeeding silently is the worse outcome of the two possibilities, since a user who applied a trigger workaround has no way to notice it stopped working. Incidentally this also confirms the index count I corrected earlier:
0002dropsidx_logs_process_uuid, taking the table from five indexes to four.Coverage that still does not exist
The TUI path is verified only statically:
codex-rs/tui/src/lib.rs:1288-1291andcodex-rs/app-server/src/lib.rs:665-668construct the layer and its filter with identical code, and none of the other layers in either stack writes tologs_2.sqlite, so the filter behaviour is shared by construction. But every end-to-end byte measurement I have posted drovecodex-app-serveron Windows 11. No TUI run, and nothing on macOS or Linux, where page cache and fsync behaviour differ. The percentages should hold since they are ratios within a single platform, but I have not shown that.rullerzhou-afk commentedon Aug 9, 2026
Fresh Windows reproduction on codex-cli 0.147.0
Adding a current Windows data point.
This is not an unbounded-WAL reproduction like #28997: the WAL remained bounded at about 6 MiB. However, the default SQLite log sink is still persisting a large number of TRACE-level streaming events, causing frequent WAL writes/checkpoints and leaving substantial unreclaimed free space in
logs_2.sqlite.Environment
codex-cli 0.147.0, installed via npm%USERPROFILE%\.codex\logs_2.sqliteTRACE,RUST_LOG,log_dir,sqlite_home, or similar logging override was present inconfig.tomlor the relevant environment variablesVACUUM, checkpoint commands, or modify the databaseCurrent database state
logs_2.sqlite: 803,803,136 bytes (766.6 MiB)logs_2.sqlite-wal: approximately 6.0 MiBThis suggests retention/pruning removes rows but does not reclaim the database file automatically.
Recent log distribution
In one representative 5-minute window:
TRACE represented approximately 79% of inserted rows and 78.5% of the estimated stored payload.
TRACE activity occurred during 88 of the 300 seconds, with a maximum of 124 TRACE rows in one second.
The highest-volume TRACE targets were:
codex_app_server::outgoing_messagecodex_tui::markdown_streamcodex_api::sse::responsesThe preceding 24-hour window contained 20,007 rows in total, including 11,172 TRACE rows in the earlier snapshot.
WAL-frame measurements
I measured SQLite WAL frame-count changes through the read-only
-shmWAL-index headers.During an active 45.0-second sample:
After allowing activity to cool for 10 seconds, a second 30.0-second sample showed:
The “WAL plus checkpoint” number assumes at most one 4 KiB database-page write per WAL frame, so it is deliberately an upper bound. It is not a measurement of SSD NAND writes or write amplification.
Extrapolating these short active samples continuously would produce very large daily figures, but that would overstate my real workload. Scaling against the actual observed 24-hour row count gives a rough workload-adjusted estimate of approximately 0.5–0.7 GiB/day of SQLite host writes. This is far below the extreme historical reports, but it still appears unnecessary for diagnostic logging under the default configuration.
Requested behavior
It would be helpful to:
codex_app_server::outgoing_messagecodex_tui::markdown_streamcodex_api::sse::responsesThis appears closely related to #31142 and the call-site analysis in #31542.
I have not attached the database or raw log bodies because they may contain prompts, responses, paths, or other sensitive session data, but I can provide additional aggregate queries or read-only measurements if useful.
bbingz commentedon Aug 9, 2026
Thanks — clean residual datapoint on
codex-cli 0.147.0.Matches the earlier residual analysis: default SQLite sink still admits high-fanout TRACE (
codex_app_server::outgoing_message,codex_tui::markdown_stream,codex_api::sse::responses), separate from unbounded-WAL #28997; freelist after prune is an additional reclaim gap.Aryan4443 commentedon Aug 10, 2026
Root cause: SQLite sink ignores
RUST_LOGConfirmed this still matches current
main(ee7815dad2) from the logging wiring (not claiming a fresh disk-churn measurement in this comment).RUST_LOGis respected by the stderr/file logging layers, but not by the SQLite log sink:EnvFilter::from_default_env(), soRUST_LOGapplies there:codex-rs/app-server/src/lib.rs:648-662EnvFilter::try_from_default_env():codex-rs/tui/src/lib.rs:1189-1200codex-rs/app-server/src/lib.rs:667-670codex-rs/tui/src/lib.rs:1229-1232log_db::default_filter(), whose default is stillLevelFilter::TRACE:codex-rs/state/src/log_db.rs:53-68So
RUST_LOG=warncan suppress stderr/file output while SQLite still persists TRACE rows allowed bylog_db::default_filter(). The existing denylist/demotions are useful (hyper_util,log,codex_otel.*,codex_api::sse, etc.), but they do not make the SQLite sink honor the process log level.This also explains residual TRACE/SQLite churn reports in #29532 after partial denylist fixes: default remains TRACE, so first-party high-volume TRACE can still persist.
Minimal fix proposal: apply the effective
RUST_LOG/EnvFilterto the SQLite layer as well, while preserving the existinglog_db::default_filter()denylist. SQLite persistence should be gated by both:RUST_LOG, with the same fallback semantics as the surrounding binary), andlog_db::default_filter().Test plan:
codex-statecoverage showinglog_db::default_filter()still drops/demotes the existing noisy targets.RUST_LOG=warn, TRACE/DEBUG events should not reachlogs_2.sqlite; WARN/ERROR should.RUST_LOG=tracecan still retain TRACE except for targets blocked by the SQLite denylist.just fmt,just fix -p codex-state, and focused tests for changed crates (just test -p codex-state, plus app-server/TUI if wiring changes there).Happy to implement if maintainers want this approach.
Excelius-Wang commentedon Aug 12, 2026
Ran into the same TRACE/SQLite churn and independently traced it to the same root cause @Aryan4443 described above:
log_db::default_filter()hardcodesLevelFilter::TRACE(codex-rs/state/src/log_db.rs), so the SQLite sink never honorsRUST_LOG, even though the stderr (app-server) / file (TUI) layers do.I implemented and verified the fix @Aryan4443 proposed — combine the existing
log_db::default_filter()denylist with anEnvFilterderived fromRUST_LOGviaFilterExt::and, falling back totracewhenRUST_LOGis unset so/feedbackkeeps its historical, denylist-limited default:Verified:
cargo check -p codex-app-server -p codex-tuijust fmtjust test -p codex-app-server -p codex-tui(green aside from pre-existing, unrelated failures caused by a missingcodex-code-mode-hostbinary / mock-server flakiness in my sandbox)just fix -p codex-app-server/just fix -p codex-tuiFull branch: Excelius-Wang/codex@main...Excelius-Wang:codex:fix/log-db-respect-rust-log
I don't have collaborator access on this repo, so I can't open a PR directly (
pull_request_creation_policyiscollaborators_only). Posting here so @Aryan4443 or a maintainer can cherry-pick/open the PR — happy to add the suggestedcodex-state/app-server/TUI filter-composition tests too if that's useful.ang-XWBWZ commentedon Aug 12, 2026
Additional reproduction on Linux Desktop Preview with
codex-cli 0.147.0I can still reproduce the SQLite/WAL write churn described here in the Codex Linux Desktop Preview, after the fixes referenced by #28224. This is not a VSCodium/VS Code extension report or a standalone CLI-only report.
Environment
codex --version:codex-cli 0.147.0CODEX_HOME: default user Codex directory (~/.codex)~/.codex/logs_2.sqlitewallog_dirorsqlite_homeoverride was configuredReproduction evidence
Before applying the workaround, a 15-second read-only sample showed:
So the log sequence advanced by 178 IDs in 15 seconds (~11.9 inserts/sec), while the retained row count increased by only 36. This is consistent with continuous insert/prune or page-reuse churn rather than simple file growth.
At the time of intervention, the retained level distribution was:
The main database was about 52.7 MiB and
logs_2.sqlite-walwas about 4.3 MiB. The dominant targets included:Workaround validation
While the Linux Desktop Preview session was still running, I created this temporary SQLite trigger:
No restart was required. In the following 15-second sample:
The
logs_2.sqlite-walsize and modification time also remained unchanged during that sample. Codex Desktop Preview stayed usable and the active session was not interrupted.This confirms that the persistent low-level rows are the direct source of the observed SQLite/WAL churn. The trigger is only a local, reversible workaround; it is not a product fix.
Expected behavior
The SQLite feedback-log sink should honor the effective process log filter (for example,
RUST_LOG=warn) or provide a documented setting to disable, lower, rate-limit, or bound persistent feedback logging. Normal Linux Desktop Preview use should not continuously persist high-volume TRACE/DEBUG app-server, SSE, markdown-stream, or dependency-internal events tologs_2.sqlite.Could this be re-checked against the current Linux Desktop Preview app-server/TUI logging path? In particular, the SQLite sink appears to have a filter independent from the normal process log filter. A regression test covering
RUST_LOG=warnand the SQLite sink would help prevent this from recurring.No database files, raw log rows, configuration files, or user data are attached.
Master0fFate commentedon Aug 16, 2026
OK BRO they got it holy shi you dont have to paste your AI bug-tracing anymore.
naipi11 commentedon Aug 18, 2026
The multi-MB/s writes to
logs_2.sqlite-walduring streaming come from the SQLite log sink, which uses its own TRACE default and does not honorRUST_LOG.Method:
~/.codex/logs_2.sqlite,logs_2.sqlite-wal, andlogs_2.sqlite-shm(same three names underCODEX_HOMEif you relocated it).RUST_LOG=warnonly reduces the non-SQLite log path.Evidence: still reproduced on 0.147.0.
log_db::default_filter()keeps TRACE, and a current Windows Desktop install shows a ~840MBlogs_2.sqliteplus a live WAL while the app is running.Independent community workaround; not an official OpenAI fix.
Husienvora commentedon Sep 23, 2026
One data point on consequences beyond wear, since #28224 is closed and this is the live thread.
The WAL churn described here reproduced on my Windows machine as repeated OS corruption rather than endurance loss: InnoGrit IG5236 drive, 2% used, clean surface test, but 37 Media and Data Integrity Errors and Windows unbootable twice in a month, both times after a day of running Codex and Claude Code with subagents. Sequential gaming loads on the same drive for a year never triggered it. The pattern fits FTL corruption from many concurrent small synchronous writes committed inconsistently at shutdown.
For anyone on Windows: the RAM disk symlink people use on Linux and macOS has a direct equivalent. A junction on the .codex directory, created with the app closed, moves every write to another drive and the app never notices.
robocopy %USERPROFILE%.codex E:\agents.codex /E /MOVE
mklink /J %USERPROFILE%.codex E:\agents.codex
Details and the SMART output:
https://husiensvora.substack.com/p/are-ai-agents-killing-your-ssd
buzz-genius: split host-admin setup from the genius's own steps
buzz-genius: the host admin's kit, self-upgrading; codex-log-trim for…