Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 25 additions & 111 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions crates/agentkit-acp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ homepage.workspace = true
name = "agentkit-acp"
readme = "README.md"
repository.workspace = true
version = "0.11.0"
version = "0.12.0"
edition.workspace = true
license.workspace = true
rust-version.workspace = true

[features]
default = ["stdio"]
stdio = []
stdio = ["agent-client-protocol/stdio"]
unstable-acp = ["agent-client-protocol/unstable"]
protocol-v2 = ["agent-client-protocol/unstable_protocol_v2"]
unstable-inject = [
Expand All @@ -20,7 +20,7 @@ unstable-inject = [
]

[dependencies]
agent-client-protocol = { package = "agentkit-acp-sdk", version = "=2.2.0" }
agent-client-protocol = { package = "agentkit-acp-sdk", version = "=3.6.0" }
agentkit-core = { version = "0.10.5", path = "../agentkit-core" }
agentkit-loop = { version = "0.11.0", path = "../agentkit-loop" }
agentkit-tools-core = { version = "0.10.5", path = "../agentkit-tools-core" }
Expand Down
12 changes: 11 additions & 1 deletion crates/agentkit-acp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2389,13 +2389,23 @@ mod tests {
async move |cx| {
let cwd = std::env::current_dir()
.map_err(agent_client_protocol::Error::into_internal_error)?;
cx.send_request(acp::InitializeRequest::new(ProtocolVersion::V1))
.block_task()
.await?;
let error = cx
.send_request(acp::NewSessionRequest::new(cwd))
.block_task()
.await
.err()
.expect("session creation should fail");
assert!(error.to_string().contains("factory failed"));
assert!(
error
.data
.as_ref()
.and_then(serde_json::Value::as_str)
.is_some_and(|message| message.contains("factory failed")),
"unexpected error: {error:?}"
);
Ok(())
},
);
Expand Down
8 changes: 4 additions & 4 deletions crates/agentkit-acp/src/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn sdk_v2_error(error: wire::Error) -> agent_client_protocol::Error {

#[cfg(feature = "unstable-inject")]
fn session_not_found_error(session_id: &wire::SessionId) -> agent_client_protocol::Error {
sdk_v2_error(wire::Error::resource_not_found(None)).data(serde_json::json!({
sdk_v2_error(wire::Error::resource_not_found()).data(serde_json::json!({
"sessionId": session_id,
}))
}
Expand Down Expand Up @@ -3111,7 +3111,7 @@ fn data_ref_to_resource_content(
}

fn error_stop_reason() -> wire::StopReason {
wire::StopReason::Other("_error".into())
wire::StopReason::Error(wire::ErrorStopReason::new())
}

fn finish_reason_to_stop_reason(reason: &FinishReason) -> wire::StopReason {
Expand Down Expand Up @@ -4909,7 +4909,7 @@ mod tests {
for reason in [FinishReason::Blocked, FinishReason::Error] {
assert_eq!(
finish_reason_to_stop_reason(&reason),
wire::StopReason::Other("_error".into())
wire::StopReason::Error(wire::ErrorStopReason::new())
);
}
}
Expand Down Expand Up @@ -4970,7 +4970,7 @@ mod tests {
&notification.update,
wire::SessionUpdate::StateUpdate(wire::StateUpdate::Idle(idle))
if idle.stop_reason.as_ref()
== Some(&wire::StopReason::Other("_error".into()))
== Some(&wire::StopReason::Error(wire::ErrorStopReason::new()))
)
));
assert!(messages.try_recv().is_err());
Expand Down
13 changes: 10 additions & 3 deletions crates/agentkit-provider-openai/src/responses/websocket/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,8 @@ async fn uncorrelated_overload_stops_on_budget_or_cancellation() {
cfg.profile = OpenAIResponsesProfile::ChatGptPrivate;
let resilience = cfg.resilience.as_mut().unwrap();
resilience.max_retries = usize::MAX;
resilience.retry_budget = Duration::from_millis(100);
let retry_budget = Duration::from_secs(2);
resilience.retry_budget = retry_budget;
resilience.initial_backoff = Duration::from_secs(1);
resilience.max_backoff = Duration::from_secs(1);
let adapter = OpenAIResponsesAdapter::new(cfg).unwrap();
Expand All @@ -631,8 +632,14 @@ async fn uncorrelated_overload_stops_on_budget_or_cancellation() {
let controller = Arc::new(CancellationController::new());
let interrupt = controller.clone();
session.set_retry_observer(Some(Arc::new(move |event| {
if cancel && matches!(event, ProviderRetryEvent::Scheduled(_)) {
interrupt.interrupt();
if matches!(event, ProviderRetryEvent::Scheduled(_)) {
if cancel {
interrupt.interrupt();
} else {
// Exhaust the wall-clock budget only after the overload is
// classified, independent of handshake timing and jitter.
std::thread::sleep(retry_budget);
}
}
})));
let cancellation = controller.handle().checkpoint();
Expand Down
Loading
Loading