Skip to content

Commit fc8122b

Browse files
authored
docs(rfd): Move session/close to Preview (#970)
1 parent 145bebd commit fc8122b

File tree

7 files changed

+90
-10
lines changed

7 files changed

+90
-10
lines changed

docs/docs.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,14 @@
127127
"rfds/diff-delete",
128128
"rfds/boolean-config-option",
129129
"rfds/elicitation",
130-
"rfds/session-close",
131130
"rfds/next-edit-suggestions",
132131
"rfds/additional-directories",
133132
"rfds/custom-llm-endpoint"
134133
]
135134
},
136135
{
137136
"group": "Preview",
138-
"pages": ["rfds/session-resume"]
137+
"pages": ["rfds/session-close", "rfds/session-resume"]
139138
},
140139
{
141140
"group": "Completed",

docs/protocol/draft/schema.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ This capability is not part of the spec yet, and may be removed or changed at an
845845

846846
Closes an active session and frees up any resources associated with it.
847847

848-
This method is only available if the agent advertises the `session.close` capability.
848+
This method is only available if the agent advertises the `sessionCapabilities.close` capability.
849849

850850
The agent must cancel any ongoing work (as if `session/cancel` was called)
851851
and then free up any resources associated with the session.
@@ -862,7 +862,7 @@ If supported, the agent **must** cancel any ongoing work related to the session
862862
(treat it as if `session/cancel` was called) and then free up any resources
863863
associated with the session.
864864

865-
Only available if the Agent supports the `session.close` capability.
865+
Only available if the Agent supports the `sessionCapabilities.close` capability.
866866

867867
**Type:** Object
868868

docs/protocol/draft/session-setup.mdx

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,79 @@ session is ready to continue.
268268
The response **MAY** also include initial mode, model, or session configuration
269269
state when those features are supported by the Agent.
270270

271+
## Closing Active Sessions
272+
273+
<Note>
274+
This section describes the preview `sessionCapabilities.close` capability.
275+
Clients MUST gate usage on that capability being present during
276+
initialization.
277+
</Note>
278+
279+
When advertised, Clients MAY call `session/close` to tell the Agent to cancel
280+
any ongoing work for a session and free any resources associated with that
281+
active session.
282+
283+
### Checking Support
284+
285+
Before attempting to close a session, Clients **MUST** verify that the Agent
286+
supports this capability by checking the `sessionCapabilities.close` field in
287+
the `initialize` response:
288+
289+
```json highlight={8-10}
290+
{
291+
"jsonrpc": "2.0",
292+
"id": 0,
293+
"result": {
294+
"protocolVersion": 1,
295+
"agentCapabilities": {
296+
"sessionCapabilities": {
297+
"close": {}
298+
}
299+
}
300+
}
301+
}
302+
```
303+
304+
If `sessionCapabilities.close` is not present, the Agent does not support
305+
closing sessions and Clients **MUST NOT** attempt to call `session/close`.
306+
307+
### Closing a Session
308+
309+
To close an active session, Clients **MUST** call the `session/close` method
310+
with the session ID:
311+
312+
```json
313+
{
314+
"jsonrpc": "2.0",
315+
"id": 2,
316+
"method": "session/close",
317+
"params": {
318+
"sessionId": "sess_789xyz"
319+
}
320+
}
321+
```
322+
323+
<ParamField path="sessionId" type="SessionId" required>
324+
The ID of the active session to close.
325+
</ParamField>
326+
327+
The Agent **MUST** cancel any ongoing work for that session as if
328+
[`session/cancel`](../prompt-turn#cancellation) had been called, then free the
329+
resources associated with the session.
330+
331+
On success, the Agent responds with an empty result object:
332+
333+
```json
334+
{
335+
"jsonrpc": "2.0",
336+
"id": 2,
337+
"result": {}
338+
}
339+
```
340+
341+
Agents MAY return an error if the session does not exist or is not currently
342+
active.
343+
271344
## Additional Workspace Roots
272345

273346
<Note>

docs/rfds/session-close.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ Clients can track what sessions are actively used by a user and automatically cl
4444
> Tell me more about your implementation. What is your detailed implementation plan?
4545
4646
We propose to add a new `"session/close"` method. Agents must declare this option is
47-
available by returning `session: { close : {} }` in their capabilities. The object is reserved
48-
to declare future capabilities.
47+
available by returning `sessionCapabilities: { close: {} }` in their capabilities. The object is
48+
reserved to declare future capabilities.
4949

5050
Then the client would be able to close a specific session with:
5151

@@ -76,5 +76,6 @@ seems like a good idea.
7676

7777
## Revision history
7878

79+
2026-04-14: Move to preview and update capability docs to `sessionCapabilities.close`
7980
2026-03-09: Rename from session/stop to session/close
8081
2026-02-24: Initial draft

docs/rfds/updates.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ The RFD for adding a `session/resume` method to the protocol has been moved to P
1313

1414
</Update>
1515

16+
<Update label="April 14, 2026" tags={["Preview"]}>
17+
## session/close RFD moves to Preview stage
18+
19+
The RFD for allowing agents to close a given session has been moved to Preview stage. Please review the [RFD](/rfds/session-close) for more information on the current proposal and provide feedback before the feature is stabilized.
20+
21+
</Update>
22+
1623
<Update label="March 27, 2026" tags={["Draft"]}>
1724
## Custom LLM Endpoint RFD moves to Draft stage
1825

schema/schema.unstable.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@
12471247
"$ref": "#/$defs/CloseSessionRequest"
12481248
}
12491249
],
1250-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCloses an active session and frees up any resources associated with it.\n\nThis method is only available if the agent advertises the `session.close` capability.\n\nThe agent must cancel any ongoing work (as if `session/cancel` was called)\nand then free up any resources associated with the session.",
1250+
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCloses an active session and frees up any resources associated with it.\n\nThis method is only available if the agent advertises the `sessionCapabilities.close` capability.\n\nThe agent must cancel any ongoing work (as if `session/cancel` was called)\nand then free up any resources associated with the session.",
12511251
"title": "CloseSessionRequest"
12521252
},
12531253
{
@@ -1484,7 +1484,7 @@
14841484
"x-side": "agent"
14851485
},
14861486
"CloseSessionRequest": {
1487-
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for closing an active session.\n\nIf supported, the agent **must** cancel any ongoing work related to the session\n(treat it as if `session/cancel` was called) and then free up any resources\nassociated with the session.\n\nOnly available if the Agent supports the `session.close` capability.",
1487+
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for closing an active session.\n\nIf supported, the agent **must** cancel any ongoing work related to the session\n(treat it as if `session/cancel` was called) and then free up any resources\nassociated with the session.\n\nOnly available if the Agent supports the `sessionCapabilities.close` capability.",
14881488
"properties": {
14891489
"_meta": {
14901490
"additionalProperties": true,

src/agent.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,7 +1608,7 @@ impl ResumeSessionResponse {
16081608
/// (treat it as if `session/cancel` was called) and then free up any resources
16091609
/// associated with the session.
16101610
///
1611-
/// Only available if the Agent supports the `session.close` capability.
1611+
/// Only available if the Agent supports the `sessionCapabilities.close` capability.
16121612
#[cfg(feature = "unstable_session_close")]
16131613
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
16141614
#[schemars(extend("x-side" = "agent", "x-method" = SESSION_CLOSE_METHOD_NAME))]
@@ -4714,7 +4714,7 @@ pub enum ClientRequest {
47144714
///
47154715
/// Closes an active session and frees up any resources associated with it.
47164716
///
4717-
/// This method is only available if the agent advertises the `session.close` capability.
4717+
/// This method is only available if the agent advertises the `sessionCapabilities.close` capability.
47184718
///
47194719
/// The agent must cancel any ongoing work (as if `session/cancel` was called)
47204720
/// and then free up any resources associated with the session.

0 commit comments

Comments
 (0)