Standardize on canceled instead of cancelled (#36385)
Release Notes: - N/A
This commit is contained in:
parent
7dc4adbd40
commit
b3969ed427
9 changed files with 28 additions and 29 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -172,9 +172,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "agent-client-protocol"
|
||||
version = "0.0.25"
|
||||
version = "0.0.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ab66add8be8d6a963f5bf4070045c1bbf36472837654c73e2298dd16bda5bf7"
|
||||
checksum = "160971bb53ca0b2e70ebc857c21e24eb448745f1396371015f4c59e9a9e51ed0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"futures 0.3.31",
|
||||
|
|
|
@ -423,7 +423,7 @@ zlog_settings = { path = "crates/zlog_settings" }
|
|||
#
|
||||
|
||||
agentic-coding-protocol = "0.0.10"
|
||||
agent-client-protocol = "0.0.25"
|
||||
agent-client-protocol = "0.0.26"
|
||||
aho-corasick = "1.1"
|
||||
alacritty_terminal = { git = "https://github.com/zed-industries/alacritty.git", branch = "add-hush-login-flag" }
|
||||
any_vec = "0.14"
|
||||
|
|
|
@ -360,7 +360,7 @@ pub enum ToolCallStatus {
|
|||
Failed,
|
||||
/// The user rejected the tool call.
|
||||
Rejected,
|
||||
/// The user cancelled generation so the tool call was cancelled.
|
||||
/// The user canceled generation so the tool call was canceled.
|
||||
Canceled,
|
||||
}
|
||||
|
||||
|
@ -1269,19 +1269,19 @@ impl AcpThread {
|
|||
Err(e)
|
||||
}
|
||||
result => {
|
||||
let cancelled = matches!(
|
||||
let canceled = matches!(
|
||||
result,
|
||||
Ok(Ok(acp::PromptResponse {
|
||||
stop_reason: acp::StopReason::Cancelled
|
||||
stop_reason: acp::StopReason::Canceled
|
||||
}))
|
||||
);
|
||||
|
||||
// We only take the task if the current prompt wasn't cancelled.
|
||||
// We only take the task if the current prompt wasn't canceled.
|
||||
//
|
||||
// This prompt may have been cancelled because another one was sent
|
||||
// This prompt may have been canceled because another one was sent
|
||||
// while it was still generating. In these cases, dropping `send_task`
|
||||
// would cause the next generation to be cancelled.
|
||||
if !cancelled {
|
||||
// would cause the next generation to be canceled.
|
||||
if !canceled {
|
||||
this.send_task.take();
|
||||
}
|
||||
|
||||
|
|
|
@ -5337,7 +5337,7 @@ fn main() {{
|
|||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_retry_cancelled_on_stop(cx: &mut TestAppContext) {
|
||||
async fn test_retry_canceled_on_stop(cx: &mut TestAppContext) {
|
||||
init_test_settings(cx);
|
||||
|
||||
let project = create_test_project(cx, json!({})).await;
|
||||
|
@ -5393,7 +5393,7 @@ fn main() {{
|
|||
"Should have no pending completions after cancellation"
|
||||
);
|
||||
|
||||
// Verify the retry was cancelled by checking retry state
|
||||
// Verify the retry was canceled by checking retry state
|
||||
thread.read_with(cx, |thread, _| {
|
||||
if let Some(retry_state) = &thread.retry_state {
|
||||
panic!(
|
||||
|
|
|
@ -137,7 +137,7 @@ impl ToolUseState {
|
|||
}
|
||||
|
||||
pub fn cancel_pending(&mut self) -> Vec<PendingToolUse> {
|
||||
let mut cancelled_tool_uses = Vec::new();
|
||||
let mut canceled_tool_uses = Vec::new();
|
||||
self.pending_tool_uses_by_id
|
||||
.retain(|tool_use_id, tool_use| {
|
||||
if matches!(tool_use.status, PendingToolUseStatus::Error { .. }) {
|
||||
|
@ -155,10 +155,10 @@ impl ToolUseState {
|
|||
is_error: true,
|
||||
},
|
||||
);
|
||||
cancelled_tool_uses.push(tool_use.clone());
|
||||
canceled_tool_uses.push(tool_use.clone());
|
||||
false
|
||||
});
|
||||
cancelled_tool_uses
|
||||
canceled_tool_uses
|
||||
}
|
||||
|
||||
pub fn pending_tool_uses(&self) -> Vec<&PendingToolUse> {
|
||||
|
|
|
@ -237,7 +237,7 @@ impl acp::Client for ClientDelegate {
|
|||
|
||||
let outcome = match result {
|
||||
Ok(option) => acp::RequestPermissionOutcome::Selected { option_id: option },
|
||||
Err(oneshot::Canceled) => acp::RequestPermissionOutcome::Cancelled,
|
||||
Err(oneshot::Canceled) => acp::RequestPermissionOutcome::Canceled,
|
||||
};
|
||||
|
||||
Ok(acp::RequestPermissionResponse { outcome })
|
||||
|
|
|
@ -285,7 +285,7 @@ impl AgentConnection for ClaudeAgentConnection {
|
|||
|
||||
let turn_state = session.turn_state.take();
|
||||
let TurnState::InProgress { end_tx } = turn_state else {
|
||||
// Already cancelled or idle, put it back
|
||||
// Already canceled or idle, put it back
|
||||
session.turn_state.replace(turn_state);
|
||||
return;
|
||||
};
|
||||
|
@ -389,7 +389,7 @@ enum TurnState {
|
|||
}
|
||||
|
||||
impl TurnState {
|
||||
fn is_cancelled(&self) -> bool {
|
||||
fn is_canceled(&self) -> bool {
|
||||
matches!(self, TurnState::CancelConfirmed { .. })
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ impl ClaudeAgentSession {
|
|||
for chunk in message.content.chunks() {
|
||||
match chunk {
|
||||
ContentChunk::Text { text } | ContentChunk::UntaggedText(text) => {
|
||||
if !turn_state.borrow().is_cancelled() {
|
||||
if !turn_state.borrow().is_canceled() {
|
||||
thread
|
||||
.update(cx, |thread, cx| {
|
||||
thread.push_user_content_block(None, text.into(), cx)
|
||||
|
@ -458,8 +458,8 @@ impl ClaudeAgentSession {
|
|||
acp::ToolCallUpdate {
|
||||
id: acp::ToolCallId(tool_use_id.into()),
|
||||
fields: acp::ToolCallUpdateFields {
|
||||
status: if turn_state.borrow().is_cancelled() {
|
||||
// Do not set to completed if turn was cancelled
|
||||
status: if turn_state.borrow().is_canceled() {
|
||||
// Do not set to completed if turn was canceled
|
||||
None
|
||||
} else {
|
||||
Some(acp::ToolCallStatus::Completed)
|
||||
|
@ -592,14 +592,13 @@ impl ClaudeAgentSession {
|
|||
..
|
||||
} => {
|
||||
let turn_state = turn_state.take();
|
||||
let was_cancelled = turn_state.is_cancelled();
|
||||
let was_canceled = turn_state.is_canceled();
|
||||
let Some(end_turn_tx) = turn_state.end_tx() else {
|
||||
debug_panic!("Received `SdkMessage::Result` but there wasn't an active turn");
|
||||
return;
|
||||
};
|
||||
|
||||
if is_error || (!was_cancelled && subtype == ResultErrorType::ErrorDuringExecution)
|
||||
{
|
||||
if is_error || (!was_canceled && subtype == ResultErrorType::ErrorDuringExecution) {
|
||||
end_turn_tx
|
||||
.send(Err(anyhow!(
|
||||
"Error: {}",
|
||||
|
@ -610,7 +609,7 @@ impl ClaudeAgentSession {
|
|||
let stop_reason = match subtype {
|
||||
ResultErrorType::Success => acp::StopReason::EndTurn,
|
||||
ResultErrorType::ErrorMaxTurns => acp::StopReason::MaxTurnRequests,
|
||||
ResultErrorType::ErrorDuringExecution => acp::StopReason::Cancelled,
|
||||
ResultErrorType::ErrorDuringExecution => acp::StopReason::Canceled,
|
||||
};
|
||||
end_turn_tx
|
||||
.send(Ok(acp::PromptResponse { stop_reason }))
|
||||
|
|
|
@ -4020,7 +4020,7 @@ mod tests {
|
|||
|
||||
cx.run_until_parked();
|
||||
|
||||
// Verify that the previous completion was cancelled
|
||||
// Verify that the previous completion was canceled
|
||||
assert_eq!(cancellation_events.lock().unwrap().len(), 1);
|
||||
|
||||
// Verify that a new request was started after cancellation
|
||||
|
|
|
@ -441,11 +441,11 @@ impl MessageEditor {
|
|||
thread.cancel_editing(cx);
|
||||
});
|
||||
|
||||
let cancelled = self.thread.update(cx, |thread, cx| {
|
||||
let canceled = self.thread.update(cx, |thread, cx| {
|
||||
thread.cancel_last_completion(Some(window.window_handle()), cx)
|
||||
});
|
||||
|
||||
if cancelled {
|
||||
if canceled {
|
||||
self.set_editor_is_expanded(false, cx);
|
||||
self.send_to_model(window, cx);
|
||||
}
|
||||
|
@ -1404,7 +1404,7 @@ impl MessageEditor {
|
|||
})
|
||||
.ok();
|
||||
});
|
||||
// Replace existing load task, if any, causing it to be cancelled.
|
||||
// Replace existing load task, if any, causing it to be canceled.
|
||||
let load_task = load_task.shared();
|
||||
self.load_context_task = Some(load_task.clone());
|
||||
cx.spawn(async move |this, cx| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue