Skip to content

fix(agent): keep --verbose free of poller RPC heartbeats - #560

Merged
huichen merged 1 commit into
mainfrom
claude/log-poll-noise
Sep 12, 2026
Merged

huichen merged 1 commit into
mainfrom
claude/log-poll-noise

Conversation

@huichen

@huichen huichen commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

Problem

After #559 silenced h2's HTTP/2 frame tracing, future agent --verbose still floods with the Agent's own request log:

DEBUG [grpc] get_session_events_since session=20260912-095239-c50b90 msg=-
DEBUG [grpc] get_session_events_since session=20260911-214608-89c957 msg=-
DEBUG [grpc] list_streaming_sessions session=- msg=-
...

These are not user actions. Clients poll them on a timer:

  • get_session_events_since — desktop/mobile observer cursor replay, once per session per reconnect/backoff tick (desktop/src-tauri/src/agent_bridge/observer.rs, mobile/src/remote/replay.ts)
  • get_events_since — run-level cursor replay (desktop/src-tauri/src/agent_bridge/mod.rs, mobile/src/remote/replay.ts)
  • list_streaming_sessions — connectivity/bulk streaming-status probe (desktop/src-tauri/src/agent_bridge/client.rs, remote_host/availability.rs, tui/src/agent_supervisor.rs)

With several sessions attached, a few seconds of log is hundreds of identical heartbeats.

Change

agent/src/grpc/mod.rs logs those three poller commands at TRACE instead of DEBUG; every user-driven command (prompt, abort, settings, session management, …) keeps logging at DEBUG.

fn is_poller_command(command: &str) -> bool {
    matches!(
        command,
        "get_events_since" | "get_session_events_since" | "list_streaming_sessions"
    )
}
  • Nothing is lost: RUST_LOG=trace (or future_agent::grpc=trace) shows every poll, and an explicit RUST_LOG still overrides the --verbose default entirely.
  • Non-verbose runs are unchanged (the whole block remains gated by state.verbose).

Tests

New grpc::tests::verbose_logs_poller_commands_at_trace_only drives execute_command through a capturing subscriber with the --verbose filter and asserts [grpc] get_agent_info is present while [grpc] get_session_events_since is not. Driving the current-thread runtime inside tracing::subscriber::with_default keeps the thread-local subscriber in effect for the whole call (the reason this is a plain #[test], not #[tokio::test]).

  • cargo fmt -p future-agent --check ✅
  • cargo clippy -p future-agent --all-targets -- -D warnings ✅
  • cargo test -p future-agent — 1706 passed; same 31 pre-existing Windows-only failures as on unmodified main (sandbox::paths, rpc::prompt_helpers, sandbox::linux, …), which fail identically at 3109ca37.

Clients poll the Agent continuously: the desktop/mobile observers replay
get_session_events_since / get_events_since per session and the GUI/TUI
probe list_streaming_sessions for connectivity. Under --verbose that
filled the request log with hundreds of
'[grpc] get_session_events_since session=... msg=-' lines between the
entries a user actually cares about.

Log those three poller commands at TRACE instead of DEBUG; user-driven
commands keep logging at DEBUG. RUST_LOG=trace (or future_agent::grpc=trace)
still surfaces every poll.
@huichen
huichen enabled auto-merge (squash) September 12, 2026 02:30
@huichen
huichen merged commit 4bfee75 into main Sep 12, 2026
12 checks passed
@huichen
huichen deleted the claude/log-poll-noise branch September 12, 2026 02:34
huichen added a commit that referenced this pull request Sep 12, 2026
#561)

#559/#560 silenced h2 frame tracing and the three cursor/probe polls, but
--verbose still fills up with the per-refresh request bursts of the desktop
context panel (it polls every 1.5 s while a run is live): get_commands,
list_providers, get_state, refresh_skills, get_session_entries and a dozen
list_tool_calls in a row, plus list_models every 10 s.

Widen the TRACE promotion from is_poller_command to is_background_command
over a BACKGROUND_COMMANDS table covering those panel/catalog reloads; the
test asserting every name is a real command keeps a typo from silently
dead-coding a log line.

rustls also joins the WARN-pinned transport targets: its 'Sending warning
alert CloseNotify' DEBUG line comes from the log-compat debug! macro that
tracing-subscriber bridges into tracing, so a plain target filter catches
it. Envoy/other TLS handshake chatter is silenced the same way, while
RUST_LOG still overrides the whole filter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant