Skip to content

fix: redirect tracing logs to stderr for stdio mode compatibility#69

Merged
KingingWang merged 3 commits into
mainfrom
feat/improve-coverage
May 5, 2026
Merged

fix: redirect tracing logs to stderr for stdio mode compatibility#69
KingingWang merged 3 commits into
mainfrom
feat/improve-coverage

Conversation

@KingingWang
Copy link
Copy Markdown
Owner

Problem

When using stdio transport mode, tracing_subscriber::fmt::Layer writes to stdout by default. The four startup log lines get mixed into the JSON-RPC message stream, causing the rmcp client to fail parsing and the handshake to disconnect.

Fix

Add .with_writer(std::io::stderr) to the default fmt_layer!() branch so stdout stays clean (JSON-RPC only) and all logs go to stderr.

Changes

File Change
src/lib.rs Add .with_writer(std::io::stderr) to default fmt_layer!()
tests/unit/*.rs Improve coverage with additional edge-case and branch tests

Verification

  • cargo fmt --check passes
  • cargo clippy --all-features --all-targets -- -D warnings passes
  • cargo test --test unit passes (including new tests)

When tracing_subscriber::fmt::Layer writes to stdout by default, the four
startup log lines intermix with the JSON-RPC message stream in stdio mode,
causing the rmcp client to fail parsing and the handshake to disconnect.

Add .with_writer(std::io::stderr) to the default fmt_layer!() branch so
stdout stays clean (JSON-RPC only) and all logs go to stderr.

Also improve unit test coverage across cache, config, server, tools, and
utils modules with additional edge-case and branch tests.

Constraint: stdio transport requires stdout to be JSON-RPC-only
Rejected: redirecting via subscriber filter alone | does not change writer target
Confidence: high
Scope-risk: narrow
Tested: cargo fmt --check, existing tests pass, new tests added
Not-tested: end-to-end stdio session with rmcp client
@KingingWang
Copy link
Copy Markdown
Owner Author

ProviderModelNotFoundError

opencode session  |  github run

Remove unused imports EnvServerConfig and LoggingConfig from
tests/unit/config_tests.rs top-level import (each used only inside
function-local use statements).

Update rustls-webpki 0.103.10 -> 0.103.13 to fix RUSTSEC-2026-0104,
RUSTSEC-2026-0098, and RUSTSEC-2026-0099.

Constraint: CI requires cargo clippy -D warnings and cargo audit to pass
Confidence: high
Scope-risk: narrow
Tested: cargo clippy --all-targets -- -D warnings,
        cargo clippy --all-features --all-targets -- -D warnings,
        cargo audit (exit 0, rustls-webpki vulns resolved)
@KingingWang
Copy link
Copy Markdown
Owner Author

ProviderModelNotFoundError

opencode session  |  github run

Replace sort_by with sort_by_key using std::cmp::Reverse for the same
descending-length ordering, fixing clippy::unnecessary_sort_by.

Constraint: CI requires cargo clippy -D warnings
Confidence: high
Scope-risk: narrow
Tested: cargo clippy --all-targets -- -D warnings,
        cargo clippy --all-features --all-targets -- -D warnings
@KingingWang
Copy link
Copy Markdown
Owner Author

ProviderModelNotFoundError

opencode session  |  github run

@KingingWang KingingWang merged commit da2a84b into main May 5, 2026
17 of 18 checks passed
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