Skip to content

macOS: Persistent SQLite TRACE log churn still occurs after restart on Codex Desktop 26.616.71553 / CLI 0.142.0 #29612

Closed as duplicate

Description

@Junwei-lah

Summary

After fully restarting Codex Desktop, I can still reproduce persistent SQLite log churn in ~/.codex/logs_2.sqlite on macOS with Codex Desktop 26.616.71553 / CLI 0.142.0.

This appears to be reduced compared with the original high-volume report in #28224, but not fully fixed after the rust-v0.142.0 changes in #29432 and #29457.

The remaining churn is still dominated by persisted TRACE rows, especially target=log and codex_api::sse::responses.

Environment

  • Platform: macOS arm64
  • Codex Desktop app: 26.616.71553
  • Codex app build: 4265
  • CLI: codex-cli 0.142.0
  • Active log DB:
    • ~/.codex/logs_2.sqlite
    • ~/.codex/logs_2.sqlite-wal
    • ~/.codex/logs_2.sqlite-shm
  • Test was performed after fully quitting and restarting Codex Desktop.
  • No SQLite trigger workaround was installed.
  • I used read-only SQLite queries only.

Current DB snapshot after restart

At 2026-06-23 19:11:36 CST:

~/.codex/logs_2.sqlite      213 MB
~/.codex/logs_2.sqlite-wal  5.0 MB
~/.codex/logs_2.sqlite-shm  32 KB

SQLite summary:

retained rows: 28,283
min(id): 18,416,628
max(id): 19,692,779
estimated retained content: 46.33 MiB
newest log timestamp: 2026-06-23 19:11:36 local

Recent persisted targets

Rows retained from the last 5 minutes after restart:

target                                     level  rows  kib
-----------------------------------------  -----  ----  ------
log                                        TRACE  1973  1249.0
codex_api::sse::responses                  TRACE   340   340.8
codex_mcp::connection_manager              TRACE   228   225.1
codex_core::stream_events_utils            DEBUG   106   161.9
codex_core::stream_events_utils            INFO     41    45.6
feedback_tags                              INFO     35    48.9
hyper_util::client::legacy::pool           TRACE    29     6.7
hyper_util::client::legacy::client         TRACE    21     4.9
codex_app_server::outgoing_message         TRACE    18     2.9
codex_api::endpoint::responses_websocket   TRACE    17  1497.3

The newest retained rows still include low-level websocket/tungstenite TRACE messages such as:

tokio-tungstenite ... WebSocketStream.with_context
tokio-tungstenite ... Stream.poll_next
tokio-tungstenite ... Read.with_context read -> poll_read
Parsed headers [...]
Opcode: Data(Text)
Masked: false
WouldBlock

I am intentionally not pasting raw feedback_log_body payloads beyond sanitized examples because they may contain private conversation, local path, tool, or response data.

30 second read-only sample

After restart, I measured COUNT(*), MAX(id), and file sizes over 30 seconds:

rows:     28,822 -> 28,960   delta +138
max_id:   19,710,785 -> 19,713,965   delta +3,180
db bytes: 221,396,992 -> 221,396,992   delta +0
wal bytes: 5,150,032 -> 5,150,032       delta +0

So Codex inserted approximately 3,180 rows in 30 seconds, about 106 inserts/sec, while only 138 rows were retained. File sizes stayed stable during this short sample, so file size alone hides the ongoing insert-and-prune churn.

Top retained rows from the sampled ID range:

target                                     level  rows  kib
-----------------------------------------  -----  ----  ------
log                                        TRACE   887  1154.9
codex_api::sse::responses                  TRACE    72    72.0
hyper_util::client::legacy::pool           TRACE    28     6.2
hyper_util::client::legacy::client         TRACE    24     5.2
codex_mcp::connection_manager              TRACE    18    14.7
codex_app_server::outgoing_message         TRACE    15     2.4
codex_core::stream_events_utils            DEBUG    13    20.9
hyper_util::client::legacy::connect::http  DEBUG    12     2.7
log                                        DEBUG    12     0.7
codex_core::stream_events_utils            INFO      8    10.1
feedback_tags                              INFO      8     8.7
codex_client::default_client               DEBUG     7     7.9

Expected behavior

After the rust-v0.142.0 persistent-log fixes, Codex should not continue to persist high-frequency TRACE target=log rows or low-level websocket/SSE internals into logs_2.sqlite by default.

In particular:

  • target=log should not remain the dominant persisted SQLite source after Filter noisy targets from persistent logs #29457.
  • codex_api::sse::responses and low-level websocket/tungstenite TRACE rows should not continue to generate insert-and-prune churn during normal use.
  • COUNT(*) should not remain nearly stable while MAX(id) grows by thousands in seconds.
  • If this logging is intentional, there should be a supported config flag to disable or reduce persistent SQLite logging.

Actual behavior

The issue is reduced compared with #28224, but still reproducible:

  • logs_2.sqlite / WAL file sizes did not grow during the short sample.
  • However, MAX(id) continued to advance quickly.
  • Retained rows stayed comparatively low because rows appear to be inserted and pruned.
  • The dominant retained sampled target was still TRACE target=log.
  • Recent rows still include low-level websocket/tungstenite TRACE records.

Related

This looks very similar to #29532, but I am opening this with a fresh post-restart macOS sample from Codex Desktop 26.616.71553 / CLI 0.142.0.

Activity

  1. added
    bugSomething isn't working
    appIssues related to the Codex desktop app
    CLIIssues related to the Codex CLI
    on Jun 23, 2026
  2. mdbecker commented on Jun 23, 2026

    @mdbecker

    I can reproduce similar idle SQLite churn on macOS with Codex Desktop 26.616.71553 / bundled codex-cli 0.142.0.

    Codex Desktop was open in the background and not being actively used. I normally launch it via the macOS GUI / Spotlight, not from the CLI.

    Environment

    $ /Applications/Codex.app/Contents/Resources/codex --version
    codex-cli 0.142.0
    Codex Desktop: 26.616.71553 • Released Jun 22, 2026
    CFBundleShortVersionString=26.616.71553
    CFBundleVersion=4265
    $ uname -mprs
    Darwin 24.3.0 arm64 arm
    
    $ sw_vers
    ProductName:            macOS
    ProductVersion:         15.3
    BuildVersion:           24D60

    Running process:

    PID=<pid>
      PID  PPID ELAPSED  %CPU %MEM    RSS      VSZ COMMAND
    <pid> <ppid>   42:49   0.0  0.2 144992 412031376 /Applications/Codex.app/Contents/Resources/codex app-server --analytics-default-enabled

    The actual environment of the running app-server process includes:

    RUST_LOG=warn

    I did not intentionally enable trace/debug logging.

    SQLite health

    The DB appears healthy:

    quick_check
    -----------
    ok
    
    integrity_check
    ---------------
    ok
    
    journal_mode
    ------------
    wal
    
    page_count
    ----------
    16185
    
    freelist_count
    --------------
    115
    
    page_size
    ---------
    4096
    
    retained_rows  min_id    max_id    sqlite_sequence_logs
    -------------  --------  --------  --------------------
    13255          47362163  49711237  49711237

    Idle sample

    Over a 5-minute idle sample, sqlite_sequence advanced by 2,975 IDs while retained row count stayed flat:

    start_time_utc=2026-06-23T15:12:41Z
    start_seq=49711237
    start_retained_rows=13255
    
    end_time_utc=2026-06-23T15:17:41Z
    end_seq=49714212
    end_retained_rows=13255
    
    new_insert_ids=2975
    retained_row_delta=0
    insert_ids_per_sec=9.92

    File sizes stayed bounded, but the WAL timestamp/size continued updating:

    logs_2.sqlite      63M
    logs_2.sqlite-shm  32K
    logs_2.sqlite-wal  4.1M

    This looks like ongoing insert-then-prune churn: the retained row count is capped, but the app-server is still continuously inserting rows while idle.

    Exact sampled ID-window breakdown

    Immediately after the 5-minute sample, I queried the exact ID window. Only 1,000 rows from the 2,975 allocated IDs were still retained:

    level  target                            module_path                       file                                                          rows  estimated_kib  body_kib
    -----  --------------------------------  --------------------------------  ------------------------------------------------------------  ----  -------------  --------
    TRACE  log                                                                                                                               998   117.8          110.0
    TRACE  hyper_util::client::legacy::pool  hyper_util::client::legacy::pool  /Users/runner/.cargo/registry/src/index.crates.io-...       2     0.4            0.1

    All retained rows from that sampled window belonged to the same app-server process:

    process_uuid                    rows
    ------------------------------  ----
    pid:<pid>:<redacted-uuid>       1000

    I am intentionally not pasting raw feedback_log_body values because they may contain private local diagnostic or conversation data.

    Open DB handles

    The Codex app-server process is the process holding the DB/WAL/SHM files:

    COMMAND   PID       USER     FD   TYPE  NAME
    codex     <pid>     <user>   ...        ~/.codex/logs_2.sqlite
    codex     <pid>     <user>   ...        ~/.codex/logs_2.sqlite-wal
    codex     <pid>     <user>   ...        ~/.codex/logs_2.sqlite-shm

    I did not see deleted logs_2.sqlite / WAL / SHM handles held open.

    Summary

    This seems consistent with the remaining post-0.142.0 issue described here: logs_2.sqlite file size may stay bounded, but the app-server still persists high-frequency TRACE target=log rows while idle.

    In my case, the app was idle and the running process had RUST_LOG=warn, but the DB still showed about 9.92 inserted IDs/sec with retained rows dominated by TRACE target=log.

  3. etraut-openai commented on Jun 23, 2026

    @etraut-openai
    Contributor

    Thanks for reporting. We're using #28224 to track this issue.

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

    CLIIssues related to the Codex CLIappIssues related to the Codex desktop appbugSomething isn't workingperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions