Repository navigation
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@connor4312 is on triage rotation this week and is the reviewer for this one. Labels come from the PR labeler. Please review the change. Automated triage. Labels are a first pass and the assigned maintainer has the final say. |
jokemanfire
left a comment
There was a problem hiding this comment.
Verified at head 99c900a3, base c78f2764.
- base + the new test file -> compile error
E0599: no method named max_line_length(the entry point genuinely does not exist yet) - head ->
cargo test -p rmcp --features client,transport-child-process --test test_child_process_max_line_length= 3 passed, including the line above the 16 MiB default cargo fmt --all -- --checkclean
Read the wiring: the new field defaults to DEFAULT_MAX_LINE_LENGTH, is forwarded to AsyncRwTransport::new(...).with_max_line_length(...) in spawn(); TokioChildProcess::new is untouched. Only the stdout transport is a read path, so applying it there is the complete change. The shell-generated child avoids argv limits, which is why the 16 MiB case works.
One nit, not blocking: max_line_length(0) is accepted, and then every line is discarded and receive() never yields a message, which looks identical to a server that sends nothing. Either document "must be greater than zero" or clamp/assert in the setter. The doc pointer to with_max_line_length also carries the usize::MAX unbounded note, so callers can find it.
The remaining half of #1513 (failing the pending request instead of waiting for the timeout) is correctly deferred to the #1471 shape.
|
Thanks for checking. Zero comes from with_max_line_length on the underlying transport, which accepts it the same way. Added "must be greater than zero" to the doc comment on both setters. |
|
@connor4312 this is ready for review. jokemanfire verified it on head, and the zero case is now documented on both setters (8af6b15). It is the first half of #1513, and goose #13894 is waiting on it. Comment drafted with Claude Code. |
connor4312
left a comment
There was a problem hiding this comment.
Thanks, this is the missing half of #1513 for stdio clients, and the tests are nicely self-contained. It needs a rebase, though: it conflicts with main in the AsyncRwTransport::with_max_line_length doc comment, which changed upstream. Please keep main's wording and add your "must be greater than zero" sentence.
Two small, non-blocking points:
0is a footgun. Documenting thatmax_line_length(0)drops every line is honest, but nobody wants that behaviour. Adebug_assert!(max_line_length > 0)orassert!in both setters (or takingNonZeroUsizeon the new builder method, since it isn't public yet) would catch the mistake rather than silently dropping every message.- The builder doc will go stale. "Longer lines are dropped and logged" is no longer quite true: since #1471, oversized requests get an error reply, and #1552 will fail the pending call for oversized responses. Pointing to the
AsyncRwTransport::with_max_line_lengthdocs for the details, instead of restating them, would keep the two in sync.
Resolve the doc conflict in async_rw.rs and add debug_assert!(max_line_length > 0) to both setters.
|
Merged main (including #1552) and addressed both points:
Comment drafted with Claude Code. |
Part of #1513
Problem
TokioChildProcessreads the child's stdout throughAsyncRwTransportwith the default 16 MiB line limit, and the builder gives no way to change it. A client that expects larger responses from a stdio server can't raise the limit.Change
TokioChildProcessBuilder::max_line_length(usize)sets the limit on the child's stdout transport (AsyncRwTransport::with_max_line_length). The default staysDEFAULT_MAX_LINE_LENGTH.TokioChildProcess::newis unchanged.The other half of #1513, failing the pending request right away instead of waiting for the timeout, needs the request id from the dropped line, so it fits after #1471.
Tests
crates/rmcp/tests/test_child_process_max_line_length.rs(unix): a child prints a notification of a given size and then a short one.max_line_length(1024): the 4 KB line is dropped and the short one still arrivesmax_line_length(DEFAULT_MAX_LINE_LENGTH + 2048): a line over 16 MiB arrivescargo +nightly fmt --all -- --check,cargo clippy --all-targets --all-features -- -D warningsandcargo test -p rmcp --all-features --libpass.This PR was written primarily by Claude Code.