fix(rmcp-client): label phase errors, retry transient init (#378)#387
fix(rmcp-client): label phase errors, retry transient init (#378)#387
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| fn handshake_failed_error(err: impl Into<anyhow::Error>) -> anyhow::Error { | ||
| let err = err.into(); | ||
| anyhow!( |
There was a problem hiding this comment.
Propagate original handshake error so retries can detect transients
The new retry path in initialize relies on should_retry_initialize walking the error chain for ReqwestError or io::Error, but handshake_failed_error recreates the error with anyhow!(...) and drops the original source. After this wrapper runs the chain only contains the formatted string, so should_retry_initialize will never see the underlying transport error and the streamable HTTP initialize handshake will never be retried. Consider wrapping the incoming error instead of formatting it (e.g. err.context(...)) so its type survives downcasting.
Useful? React with 👍 / 👎.
zemaj
left a comment
There was a problem hiding this comment.
Summary:
- Added bounded exponential retries (max 3, 200 ms base, cap 1.6 s) when the streamable HTTP handshake flakes.
- Treated handshake timeouts and common IO reset errors as transient so we rebuild the transport before retrying.
- Extended unit coverage for phase annotation, retry gating, and backoff math.
Tests:
cargo test -p code-rmcp-client --tests./build-fast.sh
Risks:
- Backoff remains deterministic; consider jitter if servers see herd retries.
Summary
Testing