feat: add support for additional directories in session configuration - #2180
feat: add support for additional directories in session configuration#2180DonJayamanne wants to merge 7 commits into
Conversation
- Introduced `additionalDirectories` field in various session-related configurations across SDKs (Java, Go, .NET, Node.js, Python, Rust). - Updated session creation and resume methods to handle `additionalDirectories`. - Enhanced tests to verify that additional directories are correctly forwarded during session creation and resumption. - Updated documentation to reflect the new configuration options.
There was a problem hiding this comment.
Pull request overview
Adds cross-SDK support for granting sessions access to additional directories during creation and resume.
Changes:
- Adds
additionalDirectoriesconfiguration across six SDKs. - Forwards the option through JSON-RPC create and resume requests.
- Adds serialization, forwarding, cloning tests, and compatibility documentation.
Show a summary per file
| File | Description |
|---|---|
rust/src/wire.rs |
Adds wire fields for create and resume. |
rust/src/types.rs |
Adds public configuration, builders, and tests. |
python/test_client.py |
Tests request forwarding. |
python/copilot/client.py |
Adds and serializes the new option. |
nodejs/test/client.test.ts |
Tests create and resume forwarding. |
nodejs/src/types.ts |
Adds the public configuration property. |
nodejs/src/client.ts |
Forwards directories in requests. |
java/src/test/java/com/github/copilot/SessionRequestBuilderTest.java |
Tests request construction. |
java/src/test/java/com/github/copilot/ConfigCloneTest.java |
Tests independent list cloning. |
java/src/main/java/com/github/copilot/SessionRequestBuilder.java |
Maps configuration into requests. |
java/src/main/java/com/github/copilot/rpc/SessionConfig.java |
Adds create-session configuration. |
java/src/main/java/com/github/copilot/rpc/ResumeSessionRequest.java |
Adds the resume wire property. |
java/src/main/java/com/github/copilot/rpc/ResumeSessionConfig.java |
Adds resume configuration and cloning. |
java/src/main/java/com/github/copilot/rpc/CreateSessionRequest.java |
Adds the create wire property. |
go/types.go |
Adds public and wire fields. |
go/client.go |
Forwards configuration into requests. |
go/client_test.go |
Tests request forwarding. |
dotnet/test/Unit/CloneTests.cs |
Tests collection cloning. |
dotnet/test/Unit/ClientSessionLifetimeTests.cs |
Tests request serialization. |
dotnet/src/Types.cs |
Adds the public configuration property. |
dotnet/src/Client.cs |
Adds create and resume request serialization. |
docs/troubleshooting/compatibility.md |
Documents feature availability and resume behavior. |
Review details
- Files reviewed: 22/22 changed files
- Comments generated: 0
- Review effort level: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Review details
Comments suppressed due to low confidence (2)
python/copilot/client.py:2684
- The resume API's new public argument is absent from its
Argsdocumentation. Add anadditional_directoriesentry afterworking_directoryand state that relative paths resolve against the session working directory and that the directories are not persisted, so callers know they must supply them again when resuming.
additional_directories: list[str] | None = None,
python/copilot/client.py:2013
- This new public argument is missing from the method's
Argssection, although the surrounding docstring documents the other session options. Add anadditional_directoriesentry afterworking_directorythat explains relative-path resolution and that callers must re-supply these paths on resume; otherwisehelp(CopilotClient.create_session)and generated API documentation omit the feature's key semantics.
This issue also appears on line 2684 of the same file.
additional_directories: list[str] | None = None,
- Files reviewed: 22/22 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Review details
Suppressed comments (6)
python/copilot/client.py:2684
- This new public parameter is missing from
resume_session'sArgsdocumentation, while the surrounding parameters are documented. Please document that these paths grant access beyondworking_directoryand that relative paths resolve against the session working directory.
additional_directories: list[str] | None = None,
python/copilot/client.py:2013
- This new public parameter is missing from
create_session'sArgsdocumentation, even though the surrounding parameters are all documented. Please describe that these directories extend access beyondworking_directory, how relative paths resolve, and that they must be supplied again on resume.
This issue also appears on line 2684 of the same file.
additional_directories: list[str] | None = None,
java/src/main/java/com/github/copilot/rpc/SessionConfig.java:872
- This returns the mutable backing list, unlike the other collection-valued config getters such as
getAvailableTools()(lines 305-307) andgetSkillDirectories()(lines 1072-1074). Return an unmodifiable view so callers cannot mutate this setting through its getter.
public List<String> getAdditionalDirectories() {
return additionalDirectories;
}
java/src/main/java/com/github/copilot/rpc/ResumeSessionConfig.java:822
- This returns the mutable backing list, unlike the other collection-valued config getters such as
getAvailableTools()(lines 205-207) andgetSkillDirectories()(lines 1389-1391). Return an unmodifiable view to preserve the established config API behavior.
public List<String> getAdditionalDirectories() {
return additionalDirectories;
}
java/src/main/java/com/github/copilot/rpc/SessionConfig.java:880
- The public Java API omits the relative-path behavior documented by the other SDK surfaces. Without stating that relative entries resolve against the session working directory, callers can resolve or construct these paths against the wrong base.
* Sets directories the agent may access beyond the working directory.
java/src/main/java/com/github/copilot/rpc/ResumeSessionConfig.java:830
- The public resume API should state how relative entries are interpreted. Other SDK surfaces specify that they resolve against the session working directory; omitting that detail can cause callers to pass paths based on the process directory instead.
* Sets directories the agent may access beyond the working directory.
- Files reviewed: 23/23 changed files
- Comments generated: 0 new
- Review effort level: Balanced
There was a problem hiding this comment.
Review details
Suppressed comments (2)
python/copilot/client.py:2031
- Document this new public parameter in
create_session'sArgssection. That section documents every neighboring parameter but currently jumps directly fromworking_directorytoprovider, leaving users without the relative-path and resume behavior described by the other SDK APIs.
additional_directories: list[str] | None = None,
python/copilot/client.py:2723
- Document this new public parameter in
resume_session'sArgssection. The current docstring documentsworking_directoryand thenprovider, so the resume API omits the important relative-path behavior for this option.
additional_directories: list[str] | None = None,
- Files reviewed: 23/23 changed files
- Comments generated: 1
- Review effort level: Balanced
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Review details
Suppressed comments (6)
python/copilot/client.py:2723
- Document this new public keyword in the resume method's
Argssection. Without an entry, users cannot discover that relative paths use the resumed session's working directory; the surrounding public parameters are all documented.
additional_directories: list[str] | None = None,
python/copilot/client.py:2031
- Document this new public keyword in the
Argssection, including that relative paths resolve againstworking_directoryand must be supplied again on resume. Every neighboring session option is documented there, butadditional_directoriesis currently absent, so generated API documentation will omit its semantics.
This issue also appears on line 2723 of the same file.
additional_directories: list[str] | None = None,
java/src/main/java/com/github/copilot/rpc/SessionConfig.java:872
- Return an unmodifiable view, consistent with the other list-valued config getters such as
getSkillDirectories()at SessionConfig.java:1073-1075. Returning the backing list here uniquely lets callers mutate this config through its getter.
return additionalDirectories;
java/src/main/java/com/github/copilot/rpc/ResumeSessionConfig.java:822
- Return an unmodifiable view, as the other list-valued resume config getters do (for example ResumeSessionConfig.java:1390-1392). Exposing the backing list makes this new property behave differently from the rest of this API.
return additionalDirectories;
java/src/main/java/com/github/copilot/rpc/CreateSessionRequest.java:506
- Keep this list getter consistent with the request's existing directory getters, which return unmodifiable views (CreateSessionRequest.java:625-626, 635-636, and 647-648). Returning the backing list exposes mutable request state.
return additionalDirectories;
java/src/main/java/com/github/copilot/rpc/ResumeSessionRequest.java:511
- Keep this list getter consistent with the existing request directory getters, which return unmodifiable views (ResumeSessionRequest.java:841-842, 851-852, and 863-864). Returning the backing list exposes mutable request state.
return additionalDirectories;
- Files reviewed: 23/23 changed files
- Comments generated: 0 new
- Review effort level: Balanced
SteveSandersonMS
left a comment
There was a problem hiding this comment.
It seems like the underlying runtime feature only works for newly-created sessions, not resumed ones, but that won't affect the SDK code so I'll approve here anyway.
Hmm, it worked for me, will have a look. |
There was a problem hiding this comment.
Review details
Suppressed comments (2)
python/copilot/client.py:2732
- Add
additional_directoriesto the resume method'sArgsdocumentation. The new public parameter is currently the only nearby option missing from the documented parameter list, including its working-directory-relative path semantics.
additional_directories: list[str] | None = None,
python/copilot/client.py:2033
- Document
additional_directoriesin this method'sArgssection. Every other public parameter is described there, but this new option is omitted, so generated API documentation does not explain that relative paths resolve against the working directory or that callers must re-supply them on resume.
This issue also appears on line 2732 of the same file.
additional_directories: list[str] | None = None,
- Files reviewed: 23/23 changed files
- Comments generated: 0 new
- Review effort level: Balanced
additionalDirectoriesfield in various session-related configurations across SDKs (Java, Go, .NET, Node.js, Python, Rust).additionalDirectories.