Skip to content

Commit 5750db5

Browse files
authored
docs(schema): require session/resume cwd to match the session (#2612)
* docs(schema): require session/resume cwd to match the session * docs(schema): make the resume cwd match a SHOULD
1 parent 1142c83 commit 5750db5

7 files changed

Lines changed: 17 additions & 2 deletions

File tree

‎agent-client-protocol-schema/src/v2/agent.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,9 @@ pub struct ResumeSessionRequest {
12411241
/// The ID of the session to resume.
12421242
pub session_id: SessionId,
12431243
/// The working directory for this session. Must be an absolute path.
1244+
///
1245+
/// Clients SHOULD send the session's working directory. Agents that can't resume a session
1246+
/// in a different directory reject it with `-32602`, and MAY normalize paths when comparing.
12441247
pub cwd: AbsolutePath,
12451248
/// Additional workspace roots to activate for this session. Each path must be absolute.
12461249
///

‎docs/protocol/v2/draft/schema.mdx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,10 @@ the request `cwd` matches the session's `cwd`.
10171017
</ResponseField>
10181018
<ResponseField name="cwd" type={<a href="#absolutepath">AbsolutePath</a>} required>
10191019
The working directory for this session. Must be an absolute path.
1020+
1021+
Clients SHOULD send the session's working directory. Agents that can't resume a session
1022+
in a different directory reject it with `-32602`, and MAY normalize paths when comparing.
1023+
10201024
</ResponseField>
10211025
<ResponseField name="mcpServers" type={<a href="#mcpserver">McpServer[]</a>} >
10221026
List of MCP servers to connect to for this session.

‎docs/protocol/v2/draft/session-setup.mdx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,8 @@ The `cwd` (current working directory) parameter establishes the primary file sys
524524
- **MUST** remain the base for relative-path resolution
525525
- **MUST** be part of the session's effective root set
526526

527+
On `session/resume`, Clients **SHOULD** send the session's working directory. Agents that can't resume a session in a different directory reject it with `-32602`. Agents **MAY** normalize paths when comparing, for example ignoring a trailing separator.
528+
527529
When `session.additionalDirectories` is in use, the session's effective root set is `[cwd, ...additionalDirectories]`. This root set **SHOULD** serve as a boundary for tool operations on the file system.
528530

529531
### Workspace Root Security

‎docs/protocol/v2/schema.mdx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,10 @@ the request `cwd` matches the session's `cwd`.
675675
</ResponseField>
676676
<ResponseField name="cwd" type={<a href="#absolutepath">AbsolutePath</a>} required>
677677
The working directory for this session. Must be an absolute path.
678+
679+
Clients SHOULD send the session's working directory. Agents that can't resume a session
680+
in a different directory reject it with `-32602`, and MAY normalize paths when comparing.
681+
678682
</ResponseField>
679683
<ResponseField name="mcpServers" type={<a href="#mcpserver">McpServer[]</a>} >
680684
List of MCP servers to connect to for this session.

‎docs/protocol/v2/session-setup.mdx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,8 @@ The `cwd` (current working directory) parameter establishes the primary file sys
455455
- **MUST** remain the base for relative-path resolution
456456
- **MUST** be part of the session's effective root set
457457

458+
On `session/resume`, Clients **SHOULD** send the session's working directory. Agents that can't resume a session in a different directory reject it with `-32602`. Agents **MAY** normalize paths when comparing, for example ignoring a trailing separator.
459+
458460
When `session.additionalDirectories` is in use, the session's effective root set is `[cwd, ...additionalDirectories]`. This root set **SHOULD** serve as a boundary for tool operations on the file system.
459461

460462
### Workspace Root Security

‎schema/v2/schema.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6859,7 +6859,7 @@
68596859
]
68606860
},
68616861
"cwd": {
6862-
"description": "The working directory for this session. Must be an absolute path.",
6862+
"description": "The working directory for this session. Must be an absolute path.\n\nClients SHOULD send the session's working directory. Agents that can't resume a session\nin a different directory reject it with `-32602`, and MAY normalize paths when comparing.",
68636863
"allOf": [
68646864
{
68656865
"$ref": "#/$defs/AbsolutePath"

‎schema/v2/schema.unstable.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8165,7 +8165,7 @@
81658165
]
81668166
},
81678167
"cwd": {
8168-
"description": "The working directory for this session. Must be an absolute path.",
8168+
"description": "The working directory for this session. Must be an absolute path.\n\nClients SHOULD send the session's working directory. Agents that can't resume a session\nin a different directory reject it with `-32602`, and MAY normalize paths when comparing.",
81698169
"allOf": [
81708170
{
81718171
"$ref": "#/$defs/AbsolutePath"

0 commit comments

Comments
 (0)