Skip to content

Commit a14b429

Browse files
committed
Remove unstable cancel_request from agent/client capabilities
The cancel_request notification is a protocol-level feature that both sides must implement, not a capability to be negotiated. Move it from agent/client capabilities to a new protocol_level module and update schema generation accordingly. Also enable --all-features flag for clippy in CI to catch issues in feature-gated code.
1 parent f2b4e62 commit a14b429

10 files changed

Lines changed: 297 additions & 394 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
config: ./typos.toml
5050

5151
- name: Lint
52-
run: cargo clippy
52+
run: cargo clippy --all-features
5353

5454
- name: Build
5555
run: cargo build --all-targets --all-features

docs/protocol/draft/schema.mdx

Lines changed: 60 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -10,54 +10,6 @@ Defines the interface that all ACP-compliant agents must implement.
1010
Agents are programs that use generative AI to autonomously modify code. They handle
1111
requests from clients and execute tasks using language models and tools.
1212

13-
<a id="$-cancel_request"></a>
14-
### <span class="font-mono">$/cancel_request</span>
15-
16-
**UNSTABLE**
17-
18-
This capability is not part of the spec yet, and may be removed or changed at any point.
19-
20-
Cancels an ongoing request.
21-
22-
This is a notification sent by the client to cancel any ongoing request.
23-
24-
Upon receiving this notification, the Agent:
25-
26-
1. MUST cancel the corresponding request activity and all nested activities
27-
2. MAY send any pending notifications.
28-
3. MUST send one of these responses for the original request:
29-
30-
- Valid response with appropriate data (partial results or cancellation marker)
31-
- Error response with code `-32800` (Cancelled)
32-
33-
See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)
34-
35-
#### <span class="font-mono">CancelRequestNotification</span>
36-
37-
**UNSTABLE**
38-
39-
This capability is not part of the spec yet, and may be removed or changed at any point.
40-
41-
Notification to cancel an ongoing request.
42-
43-
See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)
44-
45-
**Type:** Object
46-
47-
**Properties:**
48-
49-
<ResponseField name="_meta" type={"object | null"} >
50-
The _meta property is reserved by ACP to allow clients and agents to attach additional
51-
metadata to their interactions. Implementations MUST NOT make assumptions about values at
52-
these keys.
53-
54-
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
55-
56-
</ResponseField>
57-
<ResponseField name="requestId" type={<a href="#requestid">RequestId</a>} required>
58-
The ID of the request to cancel.
59-
</ResponseField>
60-
6113
### <span class="font-mono">authenticate</span>
6214

6315
Authenticates the client using the specified authentication method.
@@ -746,54 +698,6 @@ Clients are typically code editors (IDEs, text editors) that provide the interfa
746698
between users and AI agents. They manage the environment, handle user interactions,
747699
and control access to resources.
748700

749-
<a id="$-cancel_request"></a>
750-
### <span class="font-mono">$/cancel_request</span>
751-
752-
**UNSTABLE**
753-
754-
This capability is not part of the spec yet, and may be removed or changed at any point.
755-
756-
Cancels an ongoing request.
757-
758-
This is a notification sent by the agent to cancel any ongoing request.
759-
760-
Upon receiving this notification, the Client:
761-
762-
1. MUST cancel the corresponding request activity and all nested activities
763-
2. MAY send any pending notifications.
764-
3. MUST send one of these responses for the original request:
765-
766-
- Valid response with appropriate data (partial results or cancellation marker)
767-
- Error response with code `-32800` (Cancelled)
768-
769-
See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)
770-
771-
#### <span class="font-mono">CancelRequestNotification</span>
772-
773-
**UNSTABLE**
774-
775-
This capability is not part of the spec yet, and may be removed or changed at any point.
776-
777-
Notification to cancel an ongoing request.
778-
779-
See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)
780-
781-
**Type:** Object
782-
783-
**Properties:**
784-
785-
<ResponseField name="_meta" type={"object | null"} >
786-
The _meta property is reserved by ACP to allow clients and agents to attach additional
787-
metadata to their interactions. Implementations MUST NOT make assumptions about values at
788-
these keys.
789-
790-
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
791-
792-
</ResponseField>
793-
<ResponseField name="requestId" type={<a href="#requestid">RequestId</a>} required>
794-
The ID of the request to cancel.
795-
</ResponseField>
796-
797701
<a id="fs-read_text_file"></a>
798702
### <span class="font-mono">fs/read_text_file</span>
799703

@@ -1331,6 +1235,66 @@ See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/exte
13311235
The signal that terminated the process (may be null if exited normally).
13321236
</ResponseField>
13331237

1238+
## Protocol Level
1239+
1240+
Defines the interface that ACP-compliant agents and clients must both implement.
1241+
1242+
Notifications whose methods start with '$/' are messages which are protocol
1243+
implementation dependent and might not be implementable in all clients or
1244+
agents. For example if the implementation uses a single threaded synchronous
1245+
programming language then there is little it can do to react to a
1246+
`$/cancel_request` notification. If an agent or client receives notifications
1247+
starting with '$/' it is free to ignore the notification.
1248+
1249+
<a id="$-cancel_request"></a>
1250+
### <span class="font-mono">$/cancel_request</span>
1251+
1252+
**UNSTABLE**
1253+
1254+
This capability is not part of the spec yet, and may be removed or
1255+
changed at any point.
1256+
1257+
Cancels an ongoing request.
1258+
1259+
This is a notification sent by the the side that sent a request to cancel that request.
1260+
1261+
Upon receiving this notification, the receiver:
1262+
1263+
1. MUST cancel the corresponding request activity and all nested activities
1264+
2. MAY send any pending notifications.
1265+
3. MUST send one of these responses for the original request:
1266+
1267+
- Valid response with appropriate data (partial results or cancellation marker)
1268+
- Error response with code `-32800` (Cancelled)
1269+
1270+
See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)
1271+
1272+
#### <span class="font-mono">CancelRequestNotification</span>
1273+
1274+
**UNSTABLE**
1275+
1276+
This capability is not part of the spec yet, and may be removed or changed at any point.
1277+
1278+
Notification to cancel an ongoing request.
1279+
1280+
See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)
1281+
1282+
**Type:** Object
1283+
1284+
**Properties:**
1285+
1286+
<ResponseField name="_meta" type={"object | null"} >
1287+
The _meta property is reserved by ACP to allow clients and agents to attach additional
1288+
metadata to their interactions. Implementations MUST NOT make assumptions about values at
1289+
these keys.
1290+
1291+
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
1292+
1293+
</ResponseField>
1294+
<ResponseField name="requestId" type={<a href="#requestid">RequestId</a>} required>
1295+
The ID of the request to cancel.
1296+
</ResponseField>
1297+
13341298
## <span class="font-mono">AgentCapabilities</span>
13351299

13361300
Capabilities supported by the agent.
@@ -1351,14 +1315,6 @@ these keys.
13511315

13521316
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
13531317

1354-
</ResponseField>
1355-
<ResponseField name="cancellationCapabilities" type={<><span><a href="#cancellationcapabilities">CancellationCapabilities</a></span><span> | null</span></>} >
1356-
**UNSTABLE**
1357-
1358-
This capability is not part of the spec yet, and may be removed or changed at any point.
1359-
1360-
Capabilities related to cancellation.
1361-
13621318
</ResponseField>
13631319
<ResponseField name="loadSession" type={"boolean"} >
13641320
Whether the agent supports `session/load`.
@@ -1551,31 +1507,6 @@ See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/exte
15511507
<ResponseField name="uri" type={"string"} required>
15521508
</ResponseField>
15531509

1554-
## <span class="font-mono">CancellationCapabilities</span>
1555-
1556-
**UNSTABLE**
1557-
1558-
This capability is not part of the spec yet, and may be removed or changed at any point.
1559-
1560-
Capabilities related to cancellation.
1561-
1562-
By supplying `\{\}` it means that general request cancellation is supported.
1563-
1564-
Further capabilities can be added in the future if other types of cancellation is required in the protocol.
1565-
1566-
**Type:** Object
1567-
1568-
**Properties:**
1569-
1570-
<ResponseField name="_meta" type={"object | null"} >
1571-
The _meta property is reserved by ACP to allow clients and agents to attach additional
1572-
metadata to their interactions. Implementations MUST NOT make assumptions about values at
1573-
these keys.
1574-
1575-
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
1576-
1577-
</ResponseField>
1578-
15791510
## <span class="font-mono">ClientCapabilities</span>
15801511

15811512
Capabilities supported by the client.
@@ -1596,14 +1527,6 @@ these keys.
15961527

15971528
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
15981529

1599-
</ResponseField>
1600-
<ResponseField name="cancellationCapabilities" type={<><span><a href="#cancellationcapabilities">CancellationCapabilities</a></span><span> | null</span></>} >
1601-
**UNSTABLE**
1602-
1603-
This capability is not part of the spec yet, and may be removed or changed at any point.
1604-
1605-
Capabilities related to cancellation.
1606-
16071530
</ResponseField>
16081531
<ResponseField name="fs" type={<a href="#filesystemcapability">FileSystemCapability</a>} >
16091532
File system capabilities supported by the client.

schema/meta.unstable.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"agentMethods": {
33
"authenticate": "authenticate",
4-
"cancel_request": "$/cancel_request",
54
"initialize": "initialize",
65
"session_cancel": "session/cancel",
76
"session_fork": "session/fork",
@@ -13,7 +12,6 @@
1312
"session_set_model": "session/set_model"
1413
},
1514
"clientMethods": {
16-
"cancel_request": "$/cancel_request",
1715
"fs_read_text_file": "fs/read_text_file",
1816
"fs_write_text_file": "fs/write_text_file",
1917
"session_request_permission": "session/request_permission",
@@ -24,5 +22,8 @@
2422
"terminal_release": "terminal/release",
2523
"terminal_wait_for_exit": "terminal/wait_for_exit"
2624
},
25+
"protocolMethods": {
26+
"cancel_request": "$/cancel_request"
27+
},
2728
"version": 1
2829
}

schema/schema.unstable.json

Lines changed: 14 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,6 @@
88
"description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
99
"type": ["object", "null"]
1010
},
11-
"cancellationCapabilities": {
12-
"anyOf": [
13-
{
14-
"$ref": "#/$defs/CancellationCapabilities"
15-
},
16-
{
17-
"type": "null"
18-
}
19-
],
20-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities related to cancellation."
21-
},
2211
"loadSession": {
2312
"default": false,
2413
"description": "Whether the agent supports `session/load`.",
@@ -77,14 +66,6 @@
7766
],
7867
"description": "Handles session update notifications from the agent.\n\nThis is a notification endpoint (no response expected) that receives\nreal-time updates about session progress, including message chunks,\ntool calls, and execution plans.\n\nNote: Clients SHOULD continue accepting tool call updates even after\nsending a `session/cancel` notification, as the agent may send final\nupdates before responding with the cancelled stop reason.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)"
7968
},
80-
{
81-
"allOf": [
82-
{
83-
"$ref": "#/$defs/CancelRequestNotification"
84-
}
85-
],
86-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCancels an ongoing request.\n\nThis is a notification sent by the agent to cancel any ongoing request.\n\nUpon receiving this notification, the Client:\n1. MUST cancel the corresponding request activity and all nested activities\n2. MAY send any pending notifications.\n3. MUST send one of these responses for the original request:\n - Valid response with appropriate data (partial results or cancellation marker)\n - Error response with code `-32800` (Cancelled)\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)"
87-
},
8869
{
8970
"allOf": [
9071
{
@@ -497,18 +478,7 @@
497478
"required": ["requestId"],
498479
"type": "object",
499480
"x-method": "$/cancel_request",
500-
"x-side": "all"
501-
},
502-
"CancellationCapabilities": {
503-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities related to cancellation.\n\nBy supplying `{}` it means that general request cancellation is supported.\n\nFurther capabilities can be added in the future if other types of cancellation is required in the protocol.",
504-
"properties": {
505-
"_meta": {
506-
"additionalProperties": true,
507-
"description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
508-
"type": ["object", "null"]
509-
}
510-
},
511-
"type": "object"
481+
"x-side": "protocol"
512482
},
513483
"ClientCapabilities": {
514484
"description": "Capabilities supported by the client.\n\nAdvertised during initialization to inform the agent about\navailable features and methods.\n\nSee protocol docs: [Client Capabilities](https://agentclientprotocol.com/protocol/initialization#client-capabilities)",
@@ -518,17 +488,6 @@
518488
"description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
519489
"type": ["object", "null"]
520490
},
521-
"cancellationCapabilities": {
522-
"anyOf": [
523-
{
524-
"$ref": "#/$defs/CancellationCapabilities"
525-
},
526-
{
527-
"type": "null"
528-
}
529-
],
530-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities related to cancellation."
531-
},
532491
"fs": {
533492
"allOf": [
534493
{
@@ -566,14 +525,6 @@
566525
],
567526
"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 `StopReason::Cancelled`\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)"
568527
},
569-
{
570-
"allOf": [
571-
{
572-
"$ref": "#/$defs/CancelRequestNotification"
573-
}
574-
],
575-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCancels an ongoing request.\n\nThis is a notification sent by the client to cancel any ongoing request.\n\nUpon receiving this notification, the Agent:\n1. MUST cancel the corresponding request activity and all nested activities\n2. MAY send any pending notifications.\n3. MUST send one of these responses for the original request:\n - Valid response with appropriate data (partial results or cancellation marker)\n - Error response with code `-32800` (Cancelled)\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)"
576-
},
577528
{
578529
"allOf": [
579530
{
@@ -3362,6 +3313,19 @@
33623313
},
33633314
"required": ["jsonrpc"],
33643315
"type": "object"
3316+
},
3317+
{
3318+
"anyOf": [
3319+
{
3320+
"allOf": [
3321+
{
3322+
"$ref": "#/$defs/CancelRequestNotification"
3323+
}
3324+
],
3325+
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or\nchanged at any point.\n\nCancels an ongoing request.\n\nThis is a notification sent by the the side that sent a request to cancel that request.\n\nUpon receiving this notification, the receiver:\n\n1. MUST cancel the corresponding request activity and all nested activities\n2. MAY send any pending notifications.\n3. MUST send one of these responses for the original request:\n - Valid response with appropriate data (partial results or cancellation marker)\n - Error response with code `-32800` (Cancelled)\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)"
3326+
}
3327+
],
3328+
"description": "General protocol-level notifications that all sides are expected to\nimplement.\n\nNotifications whose methods start with '$/' are messages which\nare protocol implementation dependent and might not be implementable in all\nclients or agents. For example if the implementation uses a single threaded\nsynchronous programming language then there is little it can do to react to\na `$/cancel_request` notification. If an agent or client receives\nnotifications starting with '$/' it is free to ignore the notification.\n\nNotifications do not expect a response."
33653329
}
33663330
]
33673331
}

0 commit comments

Comments
 (0)