Skip to content

fix: use builder API for StreamableHttpClientTransportConfig (rmcp 1.3.0 compat)#986

Closed
jefflower wants to merge 1 commit intoRightNow-AI:mainfrom
jefflower:fix/rmcp-non-exhaustive-compat
Closed

fix: use builder API for StreamableHttpClientTransportConfig (rmcp 1.3.0 compat)#986
jefflower wants to merge 1 commit intoRightNow-AI:mainfrom
jefflower:fix/rmcp-non-exhaustive-compat

Conversation

@jefflower
Copy link
Copy Markdown

问题

rmcp 1.3.0 将 StreamableHttpClientTransportConfig 标记为 #[non_exhaustive],导致在定义 crate 外部无法使用结构体字面量构造(包括 ..Default::default() 填充语法),编译报错:

error[E0639]: cannot create non-exhaustive struct using struct expression

修复

将结构体字面量替换为官方提供的 builder API:

// 修复前(编译失败)
StreamableHttpClientTransportConfig {
    uri: url.to_string(),
    headers: HeaderMap::new(),
    ..Default::default()
}

// 修复后
StreamableHttpClientTransportConfig::with_uri(url)
    .custom_headers(headers)

同时移除了不再使用的 use std::sync::Arc 导入。

测试

  • cargo build --workspace --lib ✅ 编译通过
  • cargo test --workspace ✅ 所有测试通过(1744+)
  • cargo clippy --workspace --all-targets -- -D warnings ✅ 零 warning

🤖 Generated with Claude Code

`StreamableHttpClientTransportConfig` is marked `#[non_exhaustive]` in
rmcp 1.3.0, which forbids struct literal construction outside the
defining crate — even with `..Default::default()` fill syntax.

Replace the struct literal with the provided builder API:
  `StreamableHttpClientTransportConfig::with_uri(url).custom_headers(headers)`

Also drop the now-unused `use std::sync::Arc` import.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jaberjaber23
Copy link
Copy Markdown
Member

Thanks @jefflower — the builder-API form is exactly right. Adopted your change in the next release commit (crediting you inline in the code comment). Closing since it's rolled into a larger batch along with several other fixes. All tests pass with the new form.

jaberjaber23 added a commit that referenced this pull request Apr 8, 2026
## Headline feature
- Multi-instance Hands via optional instance_name (customer ask + #878).
  Web UI, CLI (--name / -n), API, kernel, registry all threaded. Two
  clip-youtube + clip-tiktok instances now coexist. Backward compatible
  when instance_name is omitted.

## Critical bug fixes
- #919 [SECURITY] rm bypass closed. process_start tool now validates against
  exec_policy allowlist and rejects shell metacharacters in both command
  and args. Added 5 regression tests.
- #1013 session_repair phase ordering — dedup now runs BEFORE synthetic
  result insertion, fixing Moonshot's non-unique tool_call_id format
  (function_name:index). Added regression test.
- #1003 global [[fallback_providers]] now actually used at runtime.
  resolve_driver wraps primary in FallbackDriver with global fallback
  chain. Network errors escalate to fallback instead of infinite retry.
- #937 Discord gateway heartbeat. Spawns interval task, tracks sequence,
  handles ACKs, detects zombie connections, force-closes on missing ACK.
  Credits @hello-world-bfree (PR #938) for the diagnosis.
- #935 System prompt leak in Web UI. get_agent_session now filters
  Role::System by default (?include_system=true for debug). Defense in
  depth client-side filter too.
- #984 Custom hands persistence. install_from_path copies to
  ~/.openfang/hands/. Kernel loads them on startup.
- #884 Workspace version bump 0.5.5 -> 0.5.7. Binaries now correctly
  report --version as 0.5.7 instead of stale 0.5.5.

## Cleanup
- rmcp 1.3 builder API adopted (credits @jefflower PR #986) for
  StreamableHttpClientTransportConfig. Drops unused Arc import.

## Stats
- 22 files changed, all workspace tests passing (1800+)
- Live-tested with daemon: v0.5.7 reported, multi-instance hands
  verified end-to-end, Groq round-trip PONG confirmed
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.

2 participants