Limit TUI streaming traces in SQLite logs (#38036)

## Why

Per-chunk streaming traces can flood the bounded SQLite log queue.

## What changed

- Persist `codex_tui::streaming::controller` and
  `codex_tui::streaming::table_holdback` events at `DEBUG` and above.
- Keep `TRACE` events enabled for other TUI streaming targets.

## Testing

Extended the SQLite log filter test to cover dropped streaming traces, retained
debug diagnostics, and unaffected streaming targets.

GitOrigin-RevId: e7eb999a0770eba6cce5f389005896e64928f02b
This commit is contained in:
Tamir Duberstein
2026-08-11 17:07:24 +00:00
committed by copyberry
parent e20616d265
commit dad1db87bb
2 changed files with 39 additions and 1 deletions
+3
View File
@@ -65,6 +65,9 @@ pub fn default_filter() -> Targets {
// SQLite log database, but remain available to explicit TRACE subscribers.
.with_target("codex_http_client::transport", LevelFilter::DEBUG)
.with_target("codex_api::sse", LevelFilter::DEBUG)
// Per-chunk streaming traces otherwise flood the bounded SQLite log queue.
.with_target("codex_tui::streaming::controller", LevelFilter::DEBUG)
.with_target("codex_tui::streaming::table_holdback", LevelFilter::DEBUG)
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
+36 -1
View File
@@ -7,7 +7,7 @@ use uuid::Uuid;
use super::*;
#[tokio::test]
async fn sqlite_sink_drops_low_level_opentelemetry_sdk_logs() {
async fn sqlite_sink_filters_noisy_targets_without_dropping_useful_diagnostics() {
let codex_home =
std::env::temp_dir().join(format!("codex-state-log-db-filter-{}", Uuid::new_v4()));
let _cleanup = scopeguard::guard(codex_home.clone(), |codex_home| {
@@ -44,6 +44,26 @@ async fn sqlite_sink_drops_low_level_opentelemetry_sdk_logs() {
tracing::trace!(target: "codex_api::sse::responses", "dropped-sse-payload");
tracing::debug!(target: "codex_api::sse::responses", "retained-sse-diagnostic");
tracing::trace!(target: "codex_state", "retained-trace");
tracing::trace!(
target: "codex_tui::streaming::controller",
"dropped-controller-trace"
);
tracing::debug!(
target: "codex_tui::streaming::controller",
"retained-controller-debug"
);
tracing::trace!(
target: "codex_tui::streaming::table_holdback",
"dropped-table-holdback-trace"
);
tracing::debug!(
target: "codex_tui::streaming::table_holdback",
"retained-table-holdback-debug"
);
tracing::trace!(
target: "codex_tui::streaming::commit_tick",
"retained-commit-tick-trace"
);
tracing::trace!(
target: "codex_api::responses_websocket_timing",
payload = "complete timing payload",
@@ -84,6 +104,21 @@ async fn sqlite_sink_drops_low_level_opentelemetry_sdk_logs() {
Some("retained-sse-diagnostic")
),
("TRACE", "codex_state", Some("retained-trace")),
(
"DEBUG",
"codex_tui::streaming::controller",
Some("retained-controller-debug"),
),
(
"DEBUG",
"codex_tui::streaming::table_holdback",
Some("retained-table-holdback-debug"),
),
(
"TRACE",
"codex_tui::streaming::commit_tick",
Some("retained-commit-tick-trace"),
),
]
);
}