openai / openai/codex

Allow configuring the SQLite log-database trace level (default_filter() hardcodes TRACE)

Open
#43,378 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app config enhancement
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

Summary

The SQLite log database (logs_2.sqlite, used by the desktop app / codex app-server) is written at TRACE level by default, with no way to lower or disable it. RUST_LOG only affects stderr output — it does not influence what gets persisted to the SQLite log DB.

Environment

  • codex-cli 0.153.4 (latest release as of 2026-09-04; issue also reproduced on current main)
  • Windows 11, ARM64
  • Desktop app usage with local codex app-server

Observation

While monitoring C:\Users\User\.codex\logs_2.sqlite for 60 seconds:

  • ~329 records written per minute (~5.5/s)
  • ~74% are TRACE events, dominated by codex_app_server::outgoing_message (~241/min) plus websocket remote_control (~70/min)
  • DB holds ~21 MB (self-cleanup keeps row count bounded around ~30k, so size does not grow unbounded)

The volume is small in absolute terms, but for users who do not need full TRACE history, this is continuous unnecessary write activity with no way to opt out.

Root cause

The filter for the SQLite log layer is hardcoded in codex-rs/state/src/log_db.rs:

pub fn default_filter() -> Targets {
    Targets::new()
        .with_default(LevelFilter::TRACE)   // hardcoded default for the log DB
        .with_target("h2", LevelFilter::WARN)
        .with_target("hyper_util", LevelFilter::WARN)
        .with_target("log", LevelFilter::OFF)
        // ...
}

This filter is applied to the LogDbLayer in:

  • codex-rs/app-server/src/lib.rs (~line 690): .with_filter(log_db::default_filter())
  • codex-rs/tui/src/startup_orchestration.rs (~line 587)

Unlike the stderr subscriber, this layer does not read RUST_LOG or any config value.

Feature request

Add a way to configure the SQLite log-DB level, for example:

  1. A config option (e.g. log_db_level / trace_file_level in config.toml), or
  2. A CLI flag (e.g. codex app-server --log-db-level info), or
  3. Make default_filter() derive from the configured/RUST_LOG-style filter instead of hardcoding TRACE.

I would expect sensible defaults to remain TRACE for development, with users able to opt down to INFO/DEBUG or disable persistence entirely.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in codex-rs/state/src/log_db.rs with default_filter(), then inspect its LogDbLayer call sites in codex-rs/app-server/src/lib.rs and codex-rs/tui/src/startup_orchestration.rs. Trace how configuration and CLI options are handled before choosing an integration point; done means the SQLite log level can be configured while the existing TRACE default remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sqlite
Domain
databases, observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.