MCP: send progress through SDK Peer with private trace tokens
CI / UI Checks (pull_request) Successful in 9s
CI / Rust Checks (pull_request) Successful in 41m28s
CI / Rust Feature Validation (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Required Checks (pull_request) Successful in 1s
CI / Deploy (pull_request) Skipped
CI / UI Checks (pull_request) Successful in 9s
CI / Rust Checks (pull_request) Successful in 41m28s
CI / Rust Feature Validation (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Required Checks (pull_request) Successful in 1s
CI / Deploy (pull_request) Skipped
This commit is contained in:
1 parent
8f494679b8
commit
48436538f1
12 files changed
+974
-83
No files matched your search
@@ -0,0 +1,77 @@
|
||||
//! Actual SDK send/output controls through the ordinary HTTP/SSE consumer.
|
||||
use super::*;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
async fn peer_output_control(revision: &str) {
|
||||
let h = Endpoint::started().await;
|
||||
let session = h.session(revision).await;
|
||||
let controls = &h.peer_controls;
|
||||
controls.mutate_output_message();
|
||||
h.gate.add_permits(1);
|
||||
let reply = frames(
|
||||
h.call(
|
||||
revision,
|
||||
session.as_deref(),
|
||||
json!(61),
|
||||
Some(json!(1.0)),
|
||||
"text/event-stream",
|
||||
)
|
||||
.send()
|
||||
.await
|
||||
.unwrap(),
|
||||
)
|
||||
.await;
|
||||
assert_eq!(reply.len(), 4);
|
||||
assert_eq!(
|
||||
reply[0]["params"]["message"], "controlled output mutation",
|
||||
"SSE must consume actual SDK output, not a parallel handwritten frame"
|
||||
);
|
||||
assert_eq!(reply[0]["params"]["progressToken"].to_string(), "1.0");
|
||||
terminal(&reply, revision, json!(61));
|
||||
assert_eq!(controls.actual_send(), 3);
|
||||
assert_eq!(controls.sink_entered(), 3);
|
||||
assert_eq!(controls.output_consumed(), 3);
|
||||
assert_eq!(controls.owner_completed(), 1);
|
||||
assert_eq!(h.started.load(Ordering::SeqCst), 1);
|
||||
|
||||
controls.fail_next_send();
|
||||
h.gate.add_permits(1);
|
||||
let reply = frames(
|
||||
h.call(
|
||||
revision,
|
||||
session.as_deref(),
|
||||
json!(62),
|
||||
Some(json!("failed-send")),
|
||||
"text/event-stream",
|
||||
)
|
||||
.send()
|
||||
.await
|
||||
.unwrap(),
|
||||
)
|
||||
.await;
|
||||
assert_eq!(
|
||||
reply.len(),
|
||||
1,
|
||||
"failed SDK send disables progress without fallback"
|
||||
);
|
||||
terminal(&reply, revision, json!(62));
|
||||
assert_eq!(controls.actual_send(), 4, "no SDK retry/restart");
|
||||
assert_eq!(controls.sink_entered(), 4);
|
||||
assert_eq!(
|
||||
controls.output_consumed(),
|
||||
3,
|
||||
"failed output cannot count as delivered"
|
||||
);
|
||||
assert_eq!(controls.owner_completed(), 2);
|
||||
assert_eq!(h.started.load(Ordering::SeqCst), 2, "same Tool, no replay");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn rmcp_progress_peer_runtime_legacy() {
|
||||
peer_output_control(LEGACY_REVISION).await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn rmcp_progress_peer_runtime_modern() {
|
||||
peer_output_control(MODERN_REVISION).await;
|
||||
}
|
||||
Reference in new issue
Block a user