From 8b8532e358b4d707780c03b8f52d15df8a1c6892 Mon Sep 17 00:00:00 2001 From: connorburgess Date: Sat, 5 Dec 2026 13:16:46 +0700 Subject: [PATCH] docs(v1): require the cancelled stop reason in Rust cancellation docs The Prompt Turn page says the Agent MUST respond to the original session/prompt request with the cancelled stop reason after a session/cancel, and MUST catch errors raised by aborted operations so that Clients can reliably confirm the cancellation. The Rust docs for the same behavior were weaker. The Cancelled stop reason said MUST be returned and then that Agents SHOULD catch those exceptions, and the session/cancel notification listed the cancelled response among things the Agent SHOULD do. Those comments are published in the v1 JSON Schema descriptions and the schema reference page. Use MUST for both, as the stable page and the v2 Rust docs already do. Stopping model requests and tool calls stays SHOULD, as on the page. Regenerated schemas and reference pages; no wire or type changes. --- agent-client-protocol-schema/src/v1/agent.rs | 6 ++++-- docs/protocol/v1/draft/schema.mdx | 6 ++++-- docs/protocol/v1/schema.mdx | 6 ++++-- schema/v1/schema.json | 4 ++-- schema/v1/schema.unstable.json | 4 ++-- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/agent-client-protocol-schema/src/v1/agent.rs b/agent-client-protocol-schema/src/v1/agent.rs index b07020967..a6064e1bf 100644 --- a/agent-client-protocol-schema/src/v1/agent.rs +++ b/agent-client-protocol-schema/src/v1/agent.rs @@ -4909,7 +4909,7 @@ pub enum StopReason { /// /// This stop reason MUST be returned when the client sends a `session/cancel` /// notification, even if the cancellation causes exceptions in underlying operations. - /// Agents SHOULD catch these exceptions and return this semantically meaningful + /// Agents MUST catch these exceptions and return this semantically meaningful /// response to confirm successful cancellation. Cancelled, } @@ -7301,7 +7301,9 @@ pub enum ClientNotification { /// - Stop all language model requests as soon as possible /// - Abort all tool call invocations in progress /// - Send any pending `session/update` notifications - /// - Respond to the original `session/prompt` request with the `cancelled` stop reason + /// + /// The Agent MUST then respond to the original `session/prompt` request with + /// the `cancelled` stop reason. /// /// See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/v1/prompt-turn#cancellation) CancelNotification(CancelNotification), diff --git a/docs/protocol/v1/draft/schema.mdx b/docs/protocol/v1/draft/schema.mdx index 29424a822..6c261960c 100644 --- a/docs/protocol/v1/draft/schema.mdx +++ b/docs/protocol/v1/draft/schema.mdx @@ -578,7 +578,9 @@ Upon receiving this notification, the Agent SHOULD: - Stop all language model requests as soon as possible - Abort all tool call invocations in progress - Send any pending `session/update` notifications -- Respond to the original `session/prompt` request with the `cancelled` stop reason + +The Agent MUST then respond to the original `session/prompt` request with +the `cancelled` stop reason. See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/v1/draft/prompt-turn#cancellation) @@ -9474,7 +9476,7 @@ The turn was cancelled by the client via `session/cancel`. This stop reason MUST be returned when the client sends a `session/cancel` notification, even if the cancellation causes exceptions in underlying operations. -Agents SHOULD catch these exceptions and return this semantically meaningful +Agents MUST catch these exceptions and return this semantically meaningful response to confirm successful cancellation. diff --git a/docs/protocol/v1/schema.mdx b/docs/protocol/v1/schema.mdx index 65166b886..ab0e69d68 100644 --- a/docs/protocol/v1/schema.mdx +++ b/docs/protocol/v1/schema.mdx @@ -219,7 +219,9 @@ Upon receiving this notification, the Agent SHOULD: - Stop all language model requests as soon as possible - Abort all tool call invocations in progress - Send any pending `session/update` notifications -- Respond to the original `session/prompt` request with the `cancelled` stop reason + +The Agent MUST then respond to the original `session/prompt` request with +the `cancelled` stop reason. See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/v1/prompt-turn#cancellation) @@ -6788,7 +6790,7 @@ The turn was cancelled by the client via `session/cancel`. This stop reason MUST be returned when the client sends a `session/cancel` notification, even if the cancellation causes exceptions in underlying operations. -Agents SHOULD catch these exceptions and return this semantically meaningful +Agents MUST catch these exceptions and return this semantically meaningful response to confirm successful cancellation. diff --git a/schema/v1/schema.json b/schema/v1/schema.json index b20a7d4f5..40e5a3115 100644 --- a/schema/v1/schema.json +++ b/schema/v1/schema.json @@ -3575,7 +3575,7 @@ "const": "refusal" }, { - "description": "The turn was cancelled by the client via `session/cancel`.\n\nThis stop reason MUST be returned when the client sends a `session/cancel`\nnotification, even if the cancellation causes exceptions in underlying operations.\nAgents SHOULD catch these exceptions and return this semantically meaningful\nresponse to confirm successful cancellation.", + "description": "The turn was cancelled by the client via `session/cancel`.\n\nThis stop reason MUST be returned when the client sends a `session/cancel`\nnotification, even if the cancellation causes exceptions in underlying operations.\nAgents MUST catch these exceptions and return this semantically meaningful\nresponse to confirm successful cancellation.", "type": "string", "const": "cancelled" } @@ -7054,7 +7054,7 @@ "anyOf": [ { "title": "CancelNotification", - "description": "Cancels ongoing operations for a session.\n\nThis is a notification sent by the client to cancel an ongoing prompt turn.\n\nUpon receiving this notification, the Agent SHOULD:\n- Stop all language model requests as soon as possible\n- Abort all tool call invocations in progress\n- Send any pending `session/update` notifications\n- Respond to the original `session/prompt` request with the `cancelled` stop reason\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/v1/prompt-turn#cancellation)", + "description": "Cancels ongoing operations for a session.\n\nThis is a notification sent by the client to cancel an ongoing prompt turn.\n\nUpon receiving this notification, the Agent SHOULD:\n- Stop all language model requests as soon as possible\n- Abort all tool call invocations in progress\n- Send any pending `session/update` notifications\n\nThe Agent MUST then respond to the original `session/prompt` request with\nthe `cancelled` stop reason.\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/v1/prompt-turn#cancellation)", "allOf": [ { "$ref": "#/$defs/CancelNotification" diff --git a/schema/v1/schema.unstable.json b/schema/v1/schema.unstable.json index 4888492e0..54be68f6c 100644 --- a/schema/v1/schema.unstable.json +++ b/schema/v1/schema.unstable.json @@ -4424,7 +4424,7 @@ "const": "refusal" }, { - "description": "The turn was cancelled by the client via `session/cancel`.\n\nThis stop reason MUST be returned when the client sends a `session/cancel`\nnotification, even if the cancellation causes exceptions in underlying operations.\nAgents SHOULD catch these exceptions and return this semantically meaningful\nresponse to confirm successful cancellation.", + "description": "The turn was cancelled by the client via `session/cancel`.\n\nThis stop reason MUST be returned when the client sends a `session/cancel`\nnotification, even if the cancellation causes exceptions in underlying operations.\nAgents MUST catch these exceptions and return this semantically meaningful\nresponse to confirm successful cancellation.", "type": "string", "const": "cancelled" } @@ -9191,7 +9191,7 @@ "anyOf": [ { "title": "CancelNotification", - "description": "Cancels ongoing operations for a session.\n\nThis is a notification sent by the client to cancel an ongoing prompt turn.\n\nUpon receiving this notification, the Agent SHOULD:\n- Stop all language model requests as soon as possible\n- Abort all tool call invocations in progress\n- Send any pending `session/update` notifications\n- Respond to the original `session/prompt` request with the `cancelled` stop reason\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/v1/draft/prompt-turn#cancellation)", + "description": "Cancels ongoing operations for a session.\n\nThis is a notification sent by the client to cancel an ongoing prompt turn.\n\nUpon receiving this notification, the Agent SHOULD:\n- Stop all language model requests as soon as possible\n- Abort all tool call invocations in progress\n- Send any pending `session/update` notifications\n\nThe Agent MUST then respond to the original `session/prompt` request with\nthe `cancelled` stop reason.\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/v1/draft/prompt-turn#cancellation)", "allOf": [ { "$ref": "#/$defs/CancelNotification"