Skip to content

Codex Desktop rapidly grows logs_2.sqlite / WAL during normal active use #24275

Open

Description

@gmrash

Summary

Codex Desktop rapidly grew ~/.codex/logs_2.sqlite and ~/.codex/logs_2.sqlite-wal during a normal active session. The growth was visible over only a few minutes and coincided with noticeable UI slowdown.

This looks related to #21134, #20213, and #19109, but I am filing this with fresh data from codex-cli 0.133.0-alpha.1.

Environment

  • Codex Desktop on macOS
  • codex-cli 0.133.0-alpha.1
  • macOS 15.7.4 / build 24G517
  • Default $CODEX_HOME: ~/.codex

Observed behavior

During an active Codex Desktop conversation, Finder showed:

  • around 00:10: logs_2.sqlite-wal was already about 63.4 MB
  • around 00:12: logs_2.sqlite-wal was about 146.6 MB, and logs_2.sqlite was about 131.2 MB

A later check while Codex was still running showed:

logs_2.sqlite      125M
logs_2.sqlite-shm  288K
logs_2.sqlite-wal  140M

SQLite-level data at the same time looked much smaller than the on-disk files:

rows: 2086
sum(estimated_bytes): 2404625
min ts: 2026-05-23 22:01:45
max ts: 2026-05-23 22:16:44

Top log targets by estimated bytes:

codex_api::endpoint::responses_websocket | 283 | 1196752
codex_otel.log_only                      | 290 | 408871
codex_otel.trace_safe                    | 287 | 376671
codex_api::sse::responses                | 49  | 134714
log                                      | 710 | 79236
codex_core::stream_events_utils          | 33  | 51749
hyper_util::client::legacy::pool         | 131 | 32141
codex_core_skills::loader                | 48  | 32016

lsof showed several Codex processes holding the same logs_2.sqlite files open, including the Desktop app-server and several stdio app-server processes spawned under node_repl:

codex app-server --analytics-default-enabled
codex app-server --listen stdio://
codex app-server --listen stdio://
codex app-server --listen stdio://

RUST_LOG for the processes was already warn, so this does not appear to be caused by a locally enabled verbose logging env var.

Expected behavior

The local diagnostic log DB should not grow by hundreds of MB within a few minutes of normal use, especially when the logical estimated_bytes stored in logs is only a few MB.

The log sink should also not materially degrade Codex Desktop responsiveness.

Impact

The app became slower while the log DB/WAL grew quickly. Users may need to fully quit Codex and manually clear or rotate logs_2.sqlite* to recover disk space and responsiveness.

Suggested direction

The data points to the same general area as the linked issues:

  • bound or disable high-volume websocket/SSE/OTel trace logging by default
  • ensure WAL checkpoint/truncation works under normal Desktop multi-process usage
  • avoid shared-log SQLite contention across multiple app-server processes
  • make local log retention/rotation configurable or automatic

Activity

  1. added
    bugSomething isn't working
    appIssues related to the Codex desktop app
    app-serverIssues involving app server protocol or interfaces
    on May 23, 2026
  2. github-actions commented on May 23, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. interfector18 commented on May 29, 2026

    @interfector18

    I think this is part of the bug that caused about 30 TB of ssd write churn on my system, codex itself wrote 7 GB in 10 minutes from a quick iotop test, while the files themselves didn't get bigger than ~200MB

  4. martinmclee commented on Jun 23, 2026

    @martinmclee

    Testing with empty proxy.

  5. martinmclee commented on Jun 23, 2026

    @martinmclee

    I can confirm this affects my setup too.

    Environment: Windows 11, %USERPROFILE% = C:\Users\User, codex CLI 0.142.0.

    I captured state from C:\Users\User\.codex today:

    • logs_2.sqlite: 6,542.19 MB
    • logs_2.sqlite-wal: 101.82 MB
    • logs rows: 93,757 with high verbose logging volume (TRACE and DEBUG present; many internal targets).
    • session/archived_session activity is ongoing (several GB under .codex/sessions and .codex/archived_sessions).

    CrystalDiskInfo snapshot (CrystalDiskInfo_20260623102934.txt) shows:

    • Host writes: 32,220 GB, reads 35,467 GB
    • Health Status: Good (92%)
    • Percentage Used: 8%
    • no media/data integrity errors
    • no unsafe shutdowns

    So this looks like the same app-level logging/WAL churn bug pattern (not clear SSD failure).

    I also confirmed this workaround from issue discussions is available in my setup:
    CREATE TRIGGER IF NOT EXISTS block_log_inserts BEFORE INSERT ON logs BEGIN SELECT RAISE(IGNORE); END;
    (does not delete any sessions/log history, just blocks new log inserts).

    Please confirm if any additional local traces would help.

  6. RoyalBis commented on Jun 26, 2026

    @RoyalBis

    I can confirm as well:

    Platform:
    Ubuntu Linux

    Problem:
    ~/.codex/logs_2.sqlite-wal grew to 108G and filled the root filesystem.

    Evidence:
    df -h showed / at 100%:
    /dev/mapper/ubuntu--vg-ubuntu--lv 155G 149G 0 100% /

    /workspace is a separate filesystem and was not full:
    /dev/sdb 157G 32G 117G 22% /workspace

    du showed /home was the source:
    136G /home
    108G /home/ubuntu/.codex

    Top-level ~/.codex files:
    108G logs_2.sqlite-wal
    214M logs_2.sqlite-shm
    169M logs_2.sqlite

    Impact:
    Root filesystem filled completely, causing ENOSPC risk for unrelated system services.

    Expected:
    Codex log storage should be bounded, rotated, checkpointed, or configurable so it cannot consume the entire root filesystem.

    Actual:
    A SQLite WAL file under ~/.codex grew to 108G.

    codex-cli 0.142.2

  7. runminglu commented on Jul 16, 2026

    @runminglu

    Additional sanitized data from macOS 26.4 (25E246), arm64:

    • current bundled binary: codex-cli 0.144.5
    • ChatGPT desktop bundle: 26.707.91948 (build 5440)
    • ~/.codex/logs_2.sqlite: 684,650,496 bytes (about 653 MiB)
    • ~/.codex/logs_2.sqlite-wal: 6,254,192 bytes
    • observed log timestamp range: 2026-07-08 through 2026-07-16
    • no log_dir or otel override in ~/.codex/config.toml

    SQLite contents:

    rows:                 385,575
    sum(estimated_bytes): 412,815,435
    
    TRACE  244,323 rows  214,758,911 estimated bytes
    DEBUG   66,759 rows  104,008,096 estimated bytes
    INFO    62,880 rows   86,134,648 estimated bytes
    WARN    11,563 rows    7,890,828 estimated bytes
    ERROR       50 rows       28,881 estimated bytes
    

    TRACE + DEBUG are about 80.7% of all rows and 77.2% of logical log bytes.

    Largest targets by estimated bytes:

    codex_core::stream_events_utils  116,080,464
    codex_mcp::connection_manager    100,295,674
    codex_api::sse::responses         61,130,013
    feedback_tags                     39,703,398
    rmcp::service                     25,318,447
    codex_core::tools::parallel       15,110,837
    codex_core::session::turn         12,218,393
    

    This is not currently a giant WAL case—the WAL has checkpointed down to about 6 MiB—but the main diagnostic database remains 653 MiB after roughly eight days, with most retained data at TRACE/DEBUG. This indicates that the high-volume persistent logging/retention behavior is still present in the 0.144.5 generation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appapp-serverIssues involving app server protocol or interfacesbugSomething isn't workingperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions