Codex SQLite feedback logs can write ~640 TB/year and rapidly consume SSD endurance
Codex SQLite feedback logs can write ~640 TB/year and rapidly consume SSD endurance
Issue
Codex is continuously writing a large amount of data to the local SQLite feedback log database:
~/.codex/logs_2.sqlite~/.codex/logs_2.sqlite-wal~/.codex/logs_2.sqlite-shm
On my machine, after about 21 days of uptime, the main SSD has written about 37 TB. Process/file-level checks show Codex SQLite logs are the main continuous writer.
That extrapolates to roughly 640 TB/year. On a 1 TB SSD, that is about 640 full-drive writes per year. Some consumer SSDs are rated around 600 TBW, so this could consume roughly a full drive's warranted write endurance in less than a year.
Evidence
Current retained rows in logs_2.sqlite:
| metric | value |
|---|---|
| retained rows | 681,774 |
| estimated retained log content | 1,035.6 MiB |
Level distribution:
| level | estimated MiB | byte % |
|---|---|---|
| TRACE | 732.5 | 70.7% |
| INFO | 266.5 | 25.7% |
| DEBUG | 30.6 | 3.0% |
| WARN | 5.9 | 0.6% |
Largest target+level pairs:
| target | level | estimated MiB |
|---|---|---|
codex_api::endpoint::responses_websocket |
TRACE | 527.4 |
codex_otel.log_only |
INFO | 141.2 |
codex_otel.trace_safe |
INFO | 121.2 |
log |
TRACE | 97.4 |
codex_client::transport |
TRACE | 60.1 |
codex_core::stream_events_utils |
DEBUG | 27.5 |
codex_api::sse::responses |
TRACE | 19.1 |
The top sources are mostly global TRACE logs, mirrored telemetry logs, and raw websocket/SSE payload logging. TRACE alone is about 70.7% of retained bytes. codex_otel.log_only + codex_otel.trace_safe add another 25.3%. Filtering these categories should remove roughly 96% of retained log bytes in this sample without fully disabling feedback logs.
Sanitized examples from the most frequent TRACE source: target=log
These are high-frequency retained samples. Raw websocket/SSE payload bodies are intentionally not included because they may contain private conversation content.
128,764x TRACE log: inotify event: ... mask: OPEN, name: Some("ld.so.cache")
37,982x TRACE log: inotify event: ... mask: OPEN, name: Some("locale.alias")
23,843x TRACE log: inotify event: ... mask: OPEN, name: Some("passwd")
3,639x TRACE log: <tokio-tungstenite checkout>/src/compat.rs:131 AllowStd.with_context
3,505x TRACE log: <tokio-tungstenite checkout>/src/lib.rs:245 WebSocketStream.with_context
3,362x TRACE log: <tokio-tungstenite checkout>/src/compat.rs:154 Read.read
3,356x TRACE log: <tokio-tungstenite checkout>/src/compat.rs:157 Read.with_context read -> poll_read
3,230x TRACE log: <tokio-tungstenite checkout>/src/lib.rs:294 Stream.poll_next
3,227x TRACE log: <tokio-tungstenite checkout>/src/lib.rs:304 Stream.with_context poll_next -> read()
3,213x TRACE log: inotify event: ... mask: OPEN, name: Some("nsswitch.conf")
2,001x TRACE log: WouldBlock
1,217x TRACE log: Masked: false
1,169x TRACE log: Opcode: Data(Text)
1,169x TRACE log: First: 11000001
Sanitized examples from frequent INFO sources
The dominant INFO sources are mostly repeated OpenTelemetry mirror events. IDs are redacted.
843x INFO codex_client::custom_ca:
using system root certificates because no CA override environment variable was selected ...
334x INFO codex_otel.trace_safe:
session_loop{thread_id=<redacted>}:submission_dispatch{otel.name="op.dispatch.user_input" submission.id=<redacted> codex.op="user_input"}:turn{otel.name="session_task.turn" thread.id=<redacted> ...}
333x INFO codex_otel.log_only:
session_loop{thread_id=<redacted>}:submission_dispatch{otel.name="op.dispatch.user_input" submission.id=<redacted> codex.op="user_input"}:turn{otel.name="session_task.turn" thread.id=<redacted> ...}
332x INFO codex_otel.log_only:
session_loop{thread_id=<redacted>}:submission_dispatch{otel.name="op.dispatch.user_input_with_turn_context" submission.id=<redacted> codex.op="user_input_with_turn_context"}:turn{otel.name="session_task.turn" thread.id=<redacted> ...}
332x INFO codex_otel.trace_safe:
session_loop{thread_id=<redacted>}:submission_dispatch{otel.name="op.dispatch.user_input_with_turn_context" submission.id=<redacted> codex.op="user_input_with_turn_context"}:turn{otel.name="session_task.turn" thread.id=<redacted> ...}
Write amplification
The retained DB size hides the real write volume. In a 15-second sample:
| metric | before | after |
|---|---|---|
| retained rows | 681,774 | 681,774 |
| max row id | 5,003,347,015 | 5,003,383,226 |
About 36,211 rows were inserted in 15 seconds, while retained row count stayed flat. This suggests continuous insert-and-prune write amplification: rows are inserted, indexed, written to WAL, then pruned.
Likely cause
The SQLite feedback log sink is installed with a global TRACE default:
Targets::new().with_default(Level::TRACE)
This persists all targets at TRACE level by default, including dependency/internal logs and large raw protocol payloads.
Proposed fix
Keep feedback logs enabled, but narrow what is persisted by default:
- Do not use global TRACE for the SQLite feedback log sink.
- Drop or raise thresholds for low-value dependency noise, especially
target=log,hyper_util, tokio-tungstenite internals, inotify spam, and low-level OpenTelemetry SDK logs. - Avoid persisting full raw websocket/SSE payloads by default. Store summaries instead: event kind, duration, success/error, token usage, and payload byte length.
- Avoid persisting mirrored
codex_otel.log_only/codex_otel.trace_safeevents unless they are explicitly useful for feedback debugging. - Add a global logs DB size/write cap. Per-thread caps are not enough when many threads/processes exist.
An optional escape hatch such as sqlite_logs_enabled = false would still be useful, but the main fix should be better default filtering.
Related issues and discussions
- https://github.com/openai/codex/issues/17320
- https://github.com/openai/codex/issues/24275
- https://github.com/openai/codex/issues/26374
- https://github.com/openai/codex/issues/22444
- https://github.com/openai/codex/issues/20563
- https://github.com/openai/codex/issues/27020
- https://github.com/openai/codex/issues/27911
- https://github.com/openai/codex/issues/21134
- https://github.com/openai/codex/pull/12969
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
- #26869
- #27741
- #28166
Powered by Codex Action
cc @charley-oai @jif-oai since #12969 introduced the SQLite feedback log sink at TRACE level.
I pushed a minimal branch here: https://github.com/1996fanrui/codex/tree/codex/reduce-sqlite-feedback-log-writes
The proposed patch does not disable feedback logs. It only changes the SQLite feedback log sink from global TRACE to this default filter:
warn,codex_api=info,codex_app_server=info,codex_core=info,codex_mcp=info,codex_state=info,codex_tui=info
In my local sample, the retained SQLite log content was mostly TRACE plus codex_otel INFO mirror rows, so this should drop the high-volume low-signal writes while keeping INFO+ logs for core Codex targets.
I tried to open an upstream PR, but GitHub returned:
GraphQL: 1996fanrui does not have the correct permissions to execute CreatePullRequest
Other possible fixes if the default-filter approach is not the preferred direction:
- add a config escape hatch, for example
sqlite_logs_enabled = falseor a feedback-log-specific filter setting; - keep SQLite feedback logs opt-in or sampled instead of always-on at TRACE;
- truncate or summarize large websocket/SSE/raw event payloads before storing them;
- enforce a global write/size budget in addition to per-thread retention.
This is a very serious bug, as it can not only cause login failures on Linux boxes if the system is rebooted while the disk is full, but Codex in /goal mode will actively delete files and folders on your disk in a vain attempt to gain disk space. So the severity of this issue needs to be increased as data loss is possible when using Codex in this way.
WTF this is ridiculous. PLEASE have more respect for your users.
I prepared a PR-ready branch against current main, but upstream PR creation is still blocked for my account with:
GraphQL: Nicolas0315 does not have the correct permissions to execute `CreatePullRequest`
Branch: https://github.com/Nicolas0315/codex/tree/codex/log-db-default-filter
Compare: https://github.com/openai/codex/compare/main...Nicolas0315:codex/log-db-default-filter?expand=1
Proposed PR title:
[codex] Limit persisted SQLite log verbosity
Proposed PR body, following the recent Codex PR format:
Why
logs_2.sqlite is currently attached with a global TRACE filter in both the app server and TUI. On my Windows Codex app install, that persisted high-volume websocket internals and OTel mirror records into the diagnostic SQLite log DB:
.codex/logs_2.sqlite: 729,575,424 bytes.codex/logs_2.sqlite-wal: 39,255,392 bytes- retained rows: 269,141
TRACE: 123,026 rows / 269,065,577 estimated bytes- top persisted targets included
codex_api::endpoint::responses_websocket,codex_otel.log_only,codex_otel.trace_safe, andlog
This matches the write-amplification report here and the Desktop launch failure mode in #27741. The change keeps diagnostic logs enabled, but makes the persisted SQLite sink less noisy by default.
What changed
- Add a shared
log_db::default_filter()for the persistent SQLite log sink. - Persist
INFO+by default instead ofTRACE. - Raise known high-volume mirror/dependency targets to
WARN+:codex_otel.log_onlycodex_otel.trace_safehyper_util::client::legacy::*logopentelemetry_sdk
- Use the shared filter from both app-server and TUI log DB setup.
- Update the SQLite sink filter test to cover retained Codex
INFOlogs and dropped low-value OTel/mirror logs.
Validation
git diff --checkjust test -p codex-state sqlite_sink_default_filter_drops_low_value_logsjust test -p codex-tui sqlite_sink_default_filter_drops_low_value_logscompiled the package, then exited with no matching tests.just fmtcompleted Rust/Python formatting, then failed on Windows in the Bazel buildifier step with[WinError 2].- A broader
just test -p codex-app-serverrun compiled and executed tests but timed out after reporting831 passed, 4 failed, 6 skipped; the visible failures appeared unrelated to this log filtering change, including a skills fixture warning count mismatch.
Here I have made two scripts which can serve as temporary mitigations for the WAL issue until OpenAI fixes it.
The first script trims the WAL while Codex processes are running:
#!/usr/bin/env bash
# trim-codex-wal.sh
# Trims the logs_2.sqlite and WAL files by truncating the checkpoint database
set -u
CODEX_DIR="${CODEX_HOME:-$HOME/.codex}"
DB="$CODEX_DIR/logs_2.sqlite"
WAL="$CODEX_DIR/logs_2.sqlite-wal"
SHM="$CODEX_DIR/logs_2.sqlite-shm"
bytes() {
if [ -e "$1" ]; then
stat -c '%s' "$1" 2>/dev/null || stat -f '%z' "$1" 2>/dev/null || echo 0
else
echo 0
fi
}
human() {
if command -v numfmt >/dev/null 2>&1; then
numfmt --to=iec --suffix=B "$1" 2>/dev/null || echo "$1 bytes"
else
echo "$1 bytes"
fi
}
show_sizes() {
echo
echo "Codex SQLite files:"
for f in "$DB" "$WAL" "$SHM"; do
printf " %-45s %12s\n" "$f" "$(human "$(bytes "$f")")"
done
}
echo "[LIVE RUN] Codex WAL truncate only"
echo "Codex dir: $CODEX_DIR"
echo "DB: $DB"
echo "WAL: $WAL"
echo "SHM: $SHM"
if [ ! -f "$DB" ]; then
echo
echo "ERROR: Codex DB not found:"
echo " $DB"
exit 1
fi
if ! command -v sqlite3 >/dev/null 2>&1; then
echo
echo "ERROR: sqlite3 is not installed or not in PATH."
exit 1
fi
show_sizes
BEFORE_WAL="$(bytes "$WAL")"
echo
echo "Running SQLite WAL checkpoint/truncate..."
echo "Command:"
echo " PRAGMA wal_checkpoint(TRUNCATE);"
RESULT="$(
sqlite3 "$DB" <<'SQL' 2>&1
PRAGMA busy_timeout = 5000;
PRAGMA wal_checkpoint(TRUNCATE);
SQL
)"
RC=$?
AFTER_WAL="$(bytes "$WAL")"
echo
echo "SQLite output:"
if [ -n "$RESULT" ]; then
printf '%s\n' "$RESULT"
else
echo "(no output)"
fi
show_sizes
echo
echo "Result:"
echo " WAL before: $(human "$BEFORE_WAL")"
echo " WAL after: $(human "$AFTER_WAL")"
if [ "$RC" -ne 0 ]; then
echo
echo "Failed: sqlite3 returned exit code $RC."
echo "Likely causes: DB is busy, Codex is actively writing, or disk is critically full."
exit "$RC"
fi
if [ "$AFTER_WAL" -lt "$BEFORE_WAL" ]; then
echo
echo "Success: Codex WAL was truncated."
elif [ "$AFTER_WAL" -eq "$BEFORE_WAL" ]; then
echo
echo "No size change."
echo "Possible reasons:"
echo " - WAL was already small/checkpointed."
echo " - Codex or another process currently has an active transaction."
echo " - Codex is still writing and recreated WAL content immediately."
else
echo
echo "WAL grew during the run, probably because Codex was actively writing."
fi
echo
echo "Done."
To run as a cron job:
# Run `crontab -e` in your shell and then add the following line at the end
*/15 * * * * /bin/bash "$HOME/trim-codex-wal.sh" > "$HOME/.codex-wal-clean.log" 2>&1
Note that the main table is trimmed, but there might be other tables which still accumulate data over a much slower period of time, requiring the script below.
The second script deletes the log and WAL files and kills all running Codex processes in order to immediately free disk space:
#!/usr/bin/env bash
# fix-codex-wal.sh
# Deletes the logs-2.sqlite* files and sends SIGTERM followed by SIGKILL to all codex-related processes
# in order to close the open file handles which will allow disk space to be freed
set -u
CODEX_DIR="${CODEX_HOME:-$HOME/.codex}"
DB="$CODEX_DIR/logs_2.sqlite"
WAL="$CODEX_DIR/logs_2.sqlite-wal"
SHM="$CODEX_DIR/logs_2.sqlite-shm"
PIDS=""
add_pid() {
case "${1:-}" in
''|*[!0-9]*) return ;;
"$$") return ;;
esac
case " $PIDS " in
*" $1 "*) ;;
*) PIDS="$PIDS $1" ;;
esac
}
bytes() {
if [ -e "$1" ]; then
stat -c '%s' "$1" 2>/dev/null || stat -f '%z' "$1" 2>/dev/null || echo 0
else
echo 0
fi
}
human() {
if command -v numfmt >/dev/null 2>&1; then
numfmt --to=iec --suffix=B "$1" 2>/dev/null || echo "$1 bytes"
else
echo "$1 bytes"
fi
}
show_sizes() {
echo
echo "Codex SQLite files:"
for f in "$DB" "$WAL" "$SHM"; do
printf " %-45s %12s\n" "$f" "$(human "$(bytes "$f")")"
done
}
show_processes() {
if [ -z "$(printf '%s' "$PIDS" | tr -d ' ')" ]; then
echo "None."
return
fi
printf "%-8s %-8s %-6s %-10s %-12s %s\n" "PID" "PPID" "STAT" "TTY" "ELAPSED" "CMD"
for pid in $PIDS; do
ps -p "$pid" -o pid=,ppid=,stat=,tty=,etime=,cmd= 2>/dev/null
done
}
echo "[LIVE RUN] Codex WAL/SHM cleanup"
echo "Codex dir: $CODEX_DIR"
echo "DB: $DB"
echo "WAL: $WAL"
echo "SHM: $SHM"
show_sizes
echo
echo "[1/5] Finding Codex-related processes..."
for pid in $(pgrep -u "$USER" -x codex 2>/dev/null); do
add_pid "$pid"
done
for pid in $(pgrep -u "$USER" -x node 2>/dev/null); do
cmd="$(ps -p "$pid" -o cmd= 2>/dev/null || true)"
case "$cmd" in
*codex*|*.codex*|*openai*codex*)
add_pid "$pid"
;;
esac
done
echo
echo "[2/5] Finding processes holding Codex WAL/SHM files..."
if command -v lsof >/dev/null 2>&1; then
for f in "$WAL" "$SHM"; do
if [ -e "$f" ]; then
for pid in $(lsof -t -- "$f" 2>/dev/null); do
add_pid "$pid"
done
fi
done
for pid in $(
lsof -nP +L1 2>/dev/null | awk -v dir="$CODEX_DIR" '
index($0, dir "/logs_2.sqlite-wal") && /deleted/ { print $2 }
index($0, dir "/logs_2.sqlite-shm") && /deleted/ { print $2 }
'
); do
add_pid "$pid"
done
else
echo "lsof not found; cannot check open/deleted WAL handles."
fi
echo
echo "[3/5] Processes to terminate:"
show_processes
if [ -n "$(printf '%s' "$PIDS" | tr -d ' ')" ]; then
echo
echo "Sending SIGTERM..."
for pid in $PIDS; do
echo "TERM $pid: $(ps -p "$pid" -o cmd= 2>/dev/null || echo unknown)"
kill "$pid" 2>/dev/null || true
done
sleep 3
STILL=""
for pid in $PIDS; do
if kill -0 "$pid" 2>/dev/null; then
STILL="$STILL $pid"
fi
done
if [ -n "$(printf '%s' "$STILL" | tr -d ' ')" ]; then
echo
echo "Some processes survived SIGTERM; sending SIGKILL:"
printf "%-8s %-8s %-6s %-10s %-12s %s\n" "PID" "PPID" "STAT" "TTY" "ELAPSED" "CMD"
for pid in $STILL; do
ps -p "$pid" -o pid=,ppid=,stat=,tty=,etime=,cmd= 2>/dev/null || true
done
for pid in $STILL; do
echo "KILL $pid: $(ps -p "$pid" -o cmd= 2>/dev/null || echo unknown)"
kill -9 "$pid" 2>/dev/null || true
done
else
echo "All targeted processes exited after SIGTERM."
fi
fi
echo
echo "[4/5] Deleting Codex WAL/SHM files..."
if [ -e "$WAL" ]; then
echo "Deleting: $WAL"
rm -f -- "$WAL"
else
echo "Not found: $WAL"
fi
if [ -e "$SHM" ]; then
echo "Deleting: $SHM"
rm -f -- "$SHM"
else
echo "Not found: $SHM"
fi
show_sizes
echo
echo "[5/5] Final cleanup check..."
if command -v lsof >/dev/null 2>&1; then
echo "Remaining deleted Codex files still held open, if any:"
lsof -nP +L1 2>/dev/null | grep -F "$CODEX_DIR" || echo "None found."
else
echo "lsof not found; skipping deleted-handle check."
fi
echo
echo "Disk usage:"
df -h "$HOME" 2>/dev/null || true
du -xsh "$CODEX_DIR" 2>/dev/null || true
echo
echo "Done."
plz fix
Additional macOS / codex-cli 0.141.0 evidence from a local audit, checked again on 2026-06-20 UTC:
- Current
openai/codexmain still attaches the SQLite log DB layer withTargets::new().with_default(Level::TRACE)in both app-server and TUI. The two public branches that switch to a lower persisted-log default both still apply cleanly to current main. - Local live DB:
~/.codex/logs_2.sqliteis 2.2 GiB, with ~74% freelist/free pages and no triggers.PRAGMA auto_vacuumis alreadyINCREMENTALon this DB, which is helpful for new maintenance behavior but did not shrink the existing old file; existing installs still need a safe compaction/quarantine path. - Representative active Desktop/app-server sample over 20 seconds, while no separate Codex CLI job was started by the probe:
MAX(id)advanced by 30,759. Retained rows in that interval were dominated by TRACE/INFO fromcodex_api::endpoint::responses_websocket,codex_api::sse::responses,codex_otel.log_only,codex_otel.trace_safe, and rawlog. - A small
codex exec --ephemeral --sandbox read-onlyprompt returningOKadvancedMAX(id)by 46,795 over ~21 seconds. Retained rows again concentrated in websocket/SSE TRACE and OTel mirror INFO rows.
This supports the same conclusion as the existing reports: visible DB size is not the whole cost, because high insert/prune churn continues even when file size is stable or mostly freelist. A SQL trigger can reduce stored rows, but it happens after event formatting/queueing and is therefore only a stopgap.
Low-regression fix shape I would recommend:
- Change the persisted SQLite layer default before formatting/queueing, not only at insert time: keep WARN+ globally and INFO for core Codex targets, but drop TRACE/DEBUG and noisy mirror/raw targets from the persistent DB by default.
- Preserve a way to collect high-detail diagnostic traces for intentional feedback submissions: opt-in per-report ring buffer, short-lived verbose mode, or explicit config. The always-on persistent DB should not be the high-volume trace sink.
- Add a documented local config/kill-switch for the SQLite diagnostic log sink or its level/filter.
- Add global DB/WAL budgets, safe checkpoint/truncate behavior, stale-reader recovery, and corrupt-log-DB quarantine/recreate behavior.
- Include an existing-install cleanup path: incremental auto-vacuum alone does not reclaim old freelist-heavy DBs without enough incremental vacuum work, and older DBs may need a closed-DB
VACUUM/recreate/move-aside path.
The log DB should have an explicit byte budget and retention policy. Durable usage/diagnostic events can stay queryable, while websocket/SSE TRACE payloads need sampling, level caps, and rotation independent of the state DB. A startup receipt with effective log level, DB byte cap, WAL checkpoint policy, and dropped-row count would make write pressure visible before SSD wear becomes the signal.
Generated with ax.
Additional native Windows check against current main:
- Upstream source inspected:
63f009e9dad2e70454b7ed6434d8aa28dfb52b51 - Windows 11 Pro 10.0.26200
- Codex Desktop active during the sample
Current source still attaches the persistent SQLite log layer with a global TRACE filter in both app-server and TUI:
codex-rs/app-server/src/lib.rslog_db::start.with_filter(Targets::new().with_default(Level::TRACE))
codex-rs/tui/src/lib.rslog_db::start.with_filter(Targets::new().with_default(Level::TRACE))
I also checked the current log sink implementation:
codex-rs/state/src/log_db.rs- events are formatted into
feedback_log_body, queued, then inserted by a background task. - the sink drops low-level
opentelemetry_sdkTRACE/DEBUG, which helps one specific noisy target.
- events are formatted into
codex-rs/state/src/runtime/logs.rs- each batch inserts rows, then prunes inside the same transaction.
That means DB size or retained row count can stay stable while insert/prune churn continues.
Local aggregate-only measurement from .codex\logs_2.sqlite over 15 seconds, without reading log bodies:
- retained rows before: 56,766
- retained rows after: 56,766
- retained row delta: 0
MAX(id)before: 191,131,613MAX(id)after: 191,131,862MAX(id)delta: 249 rows inserted in 15s- retained estimated bytes delta: +135,974 bytes
Top retained target+level groups in this Windows sample were still dominated by the same categories already reported here:
codex_api::endpoint::responses_websocketTRACEcodex_otel.log_onlyINFOcodex_otel.trace_safeINFOcodex_core::stream_events_utilsINFOcodex_client::transportTRACErmcp::serviceTRACEcodex_api::sse::responsesTRACElogTRACE
This reinforces the earlier point: visible DB growth is not a reliable proxy for write pressure. Even with a stable retained row count, the append-and-prune path is still doing work. The low-risk patch shape still looks like filtering before formatting/queueing/inserting, not only pruning after insert.
I also rebuilt a narrow local candidate patch against the current origin/main head:
- base:
f774455(code-mode: linearize cell terminal state (#29286)) - adds
codex_state::log_db::default_filter() - uses the shared filter from app-server and TUI instead of
Targets::new().with_default(Level::TRACE) - keeps global
WARN+ - keeps
INFO+for core Codex targets (codex_api,codex_app_server,codex_core,codex_mcp,codex_state,codex_tui) - raises known high-volume mirror/dependency targets to
WARN+(codex_otel.log_only,codex_otel.trace_safe,hyper_util,log,opentelemetry_sdk)
Local validation:
cargo test -p codex-state sqlite_sink_default_filter_drops_low_value_logs-> 1 passedcargo test -p codex-state log_db-> 7 passedcargo check -p codex-app-server -p codex-tui-> passedcargo fmt --check-> passed; stable rustfmt emitted repo-config warnings thatimports_granularityis nightly-onlygit diff --check-> passed
Per docs/contributing.md, I am not opening a PR unless invited, but this latest local patch is PR-shaped if maintainers want this direction.
I hope the developers see this issue.
Shame on such low software quality with such high memory prices and SSD cost...
More AI-generated code doesn't make your team faster. It might actually slow you down
The real bottleneck was never writing code. It's releasing it, debugging it, & keeping it running well
Every AI output has to have a human owner. If you don't want your name on it, it's probably not good work
Quality first, quantity second
Additional macOS / Codex Desktop data point.
I checked this on my local machine with Codex Desktop running continuously. I did not read feedback_log_body; only aggregate fields were queried.
Environment:
- macOS
- Codex Desktop
codex-cli 0.142.0-alpha.6- DB:
~/.codex/logs_2.sqlite
Before mitigation, the retained row count stayed stable, but MAX(id) kept advancing:
before_rows=79532
after_rows=79532
row_delta=0
before_max_id=55795989
after_max_id=55798753
max_id_delta=2764
sample_window=20s
The retained log distribution was dominated by the same categories reported here:
codex_api::endpoint::responses_websocket TRACE
codex_otel.log_only INFO
codex_otel.trace_safe INFO
log TRACE
codex_api::sse::responses TRACE
As a temporary local mitigation, while keeping Codex running, I added a SQLite BEFORE INSERT trigger to drop the noisiest low-value rows:
CREATE TRIGGER IF NOT EXISTS codex_drop_noisy_logs
BEFORE INSERT ON logs
WHEN
NEW.level IN ('TRACE', 'DEBUG')
OR NEW.target IN ('codex_otel.log_only', 'codex_otel.trace_safe', 'log')
OR NEW.target LIKE 'hyper_util%'
OR NEW.target LIKE 'opentelemetry_sdk%'
BEGIN
SELECT RAISE(IGNORE);
END;
After installing the trigger, the same 20-second sample dropped sharply:
after_before_rows=79532
after_after_rows=79532
row_delta=0
after_before_max_id=55798775
after_after_max_id=55798779
max_id_delta=4
sample_window=20s
This is only a workaround. It reduces SQLite insert/prune churn, but it is not a proper fix because Codex may still format/queue log events before SQLite rejects them. The upstream fix should still filter before formatting/queueing/inserting, ideally with a documented config kill-switch or log-level setting for the SQLite diagnostic sink.
Here is how I fix it on my Win11 PC:
python -c "import sqlite3, pathlib; p=pathlib.Path.home()/'.codex'/'logs_2.sqlite'; con=sqlite3.connect(p); con.execute('CREATE TRIGGER IF NOT EXISTS block_log_inserts BEFORE INSERT ON logs BEGIN SELECT RAISE(IGNORE); END;'); con.commit(); con.close(); print(p)"
And to verify it, exe this:
python -c "import sqlite3, pathlib; p=pathlib.Path.home()/'.codex'/'logs_2.sqlite'; con=sqlite3.connect(p); print(con.execute('SELECT name, tbl_name FROM sqlite_master WHERE type=? AND name=?', ('trigger','block_log_inserts')).fetchall()); con.close()"
I made a small unofficial tool for running community-found Codex workarounds:
https://codexfixes.com
Run it with:
npx codex-fixes@latest
So we can stop checking issue threads every day for months and just patch the annoying stuff when the community finds a workaround.
Would creating a ramdisk and symlinking it there alleviate the issue temporarily?
@zhuhaow This is a useful idea, but I’d strongly suggest avoiding @latest in the recommended command.
Because this tool runs local code and modifies ~/.codex, the supply-chain risk is higher than a normal informational CLI. A safer default would be to recommend a pinned version, for example:
npx [email protected] --dry-run
npx [email protected] apply sqlite-feedback-logs
Yeah, that is a very fair point, and I did think about this tradeoff.
The reason I’m currently recommending @.***` is that Codex keeps introducing new bugs, and the fixes here are meant to be a moving set of community workarounds. If users pin one version, they still have to keep checking GitHub issues, npm versions, or this repo to know when a new workaround exists, which is exactly the thing I’m trying to avoid.
That said, I agree the supply-chain risk is real, especially because this tool runs locally and touches ~/.codex. Right now I’m using npm provenance / attestations and the release is built through GitHub Actions, but I’m definitely open to better ideas here.
On Jun 22, 2026, at 19:22, MumuTW @.***> wrote:
MumuTW left a comment (openai/codex#28224) https://github.com/openai/codex/issues/28224#issuecomment-4767732595 @zhuhaow https://github.com/zhuhaow This is a useful idea, but I’d strongly suggest avoiding @latest in the recommended command.
Because this tool runs local code and modifies ~/.codex, the supply-chain risk is higher than a normal informational CLI. A safer default would be to recommend a pinned version, for example:
npx @.*** --dry-run npx @.*** apply sqlite-feedback-logs — Reply to this email directly, view it on GitHub https://github.com/openai/codex/issues/28224?email_source=notifications&email_token=AAJ2MLGRDWZTFSLXOY4XQRD5BEJJHA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINZWG43TGMRVHE22M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4767732595, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ2MLDRTKK2A5PSZFW3XED5BEJJHAVCNFSNUABFKJSXA33TNF2G64TZHM4TMNJUGE2TMNBZHNEXG43VMU5TINRWGA3TANJQGY32C5QC. You are receiving this because you were mentioned.
@elliexcoding A ramdisk could reduce SSD wear by moving the SQLite DB/WAL writes off disk, but it does not reduce the underlying log event churn.
It also requires very careful handling. Since SQLite is in WAL mode, you have to symlink logs_2.sqlite, -wal, and -shm together. More importantly, if Codex is already running, it will keep writing to the original disk files via existing file handles until the process is restarted.
For always-on dev machines, since Codex continuously prunes old rows to cap the DB size at ~228MB, a ramdisk won't necessarily fill up indefinitely. However, it changes the failure mode into wasting RAM capacity and CPU cycles on ghost churn (formatting and syncing hundreds of trace rows/sec in memory) rather than fixing the root cause.