Skip to content

Add instructionDirectories session config support#1190

Merged
stephentoub merged 1 commit intomainfrom
stephentoub/instruction-directories
May 4, 2026
Merged

Add instructionDirectories session config support#1190
stephentoub merged 1 commit intomainfrom
stephentoub/instruction-directories

Conversation

@stephentoub
Copy link
Copy Markdown
Collaborator

@stephentoub stephentoub commented May 4, 2026

The runtime added an instructionDirectories option for session create and resume requests, but the SDKs did not expose it yet. This PR threads that session-level option through each language SDK so callers can provide additional custom instruction directories consistently.

Summary

  • Add create/resume config properties for TypeScript, Python, Go, and .NET using each SDK's naming conventions.
  • Forward the value into the session.create and session.resume JSON-RPC payloads.
  • Add unit coverage for request forwarding, request serialization, and .NET clone behavior.
  • Add E2E coverage and replay snapshots for create/resume behavior using .github/instructions/*.instructions.md fixtures.

Expose the runtime instructionDirectories session option across the SDKs and cover create/resume forwarding with unit and E2E tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 4, 2026 01:39
@stephentoub stephentoub requested a review from a team as a code owner May 4, 2026 01:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR exposes the runtime’s new instructionDirectories session option across the supported SDKs so callers can provide additional instruction search roots consistently when creating or resuming sessions. It fits into the SDK layer by threading a new session-level configuration field through each language’s public API, request serialization, and cross-language test coverage.

Changes:

  • Add instructionDirectories to the public session configuration surface for Node.js, Python, Go, and .NET.
  • Forward the new option into session.create and session.resume JSON-RPC payloads in each SDK.
  • Add unit/E2E coverage plus replay snapshots validating create/resume behavior with instruction directory fixtures.
Show a summary per file
File Description
test/snapshots/session_config/should_apply_instructiondirectories_on_session_resume.yaml Snapshot for one language’s resume E2E instruction-directory case.
test/snapshots/session_config/should_apply_instructiondirectories_on_session_create.yaml Snapshot for one language’s create E2E instruction-directory case.
test/snapshots/session_config/should_apply_instructiondirectories_on_resume.yaml Snapshot for another language’s resume E2E case.
test/snapshots/session_config/should_apply_instructiondirectories_on_create.yaml Snapshot for another language’s create E2E case.
test/snapshots/session_config/should_apply_instruction_directories_on_resume.yaml Snapshot for Python-style resume test naming.
test/snapshots/session_config/should_apply_instruction_directories_on_create.yaml Snapshot for Python-style create test naming.
python/test_client.py Adds Python unit tests for request forwarding.
python/e2e/test_session_config_e2e.py Adds Python E2E coverage for create/resume instruction directories.
python/copilot/session.py Extends Python session config TypedDicts with the new option.
python/copilot/client.py Threads Python API args into create/resume payloads and docs.
nodejs/test/e2e/session_config.e2e.test.ts Adds Node E2E coverage for create/resume instruction directories.
nodejs/test/client.test.ts Adds Node unit tests verifying request forwarding.
nodejs/src/types.ts Exposes the new field in Node session config types.
nodejs/src/client.ts Sends instructionDirectories in Node create/resume RPC requests.
go/types.go Adds Go public config fields and wire request fields.
go/internal/e2e/session_config_e2e_test.go Adds Go E2E coverage for create/resume instruction directories.
go/client_test.go Adds Go serialization tests for the new request field.
go/client.go Threads Go config values into create/resume requests.
dotnet/test/Unit/SerializationTests.cs Adds .NET serialization tests for instruction directories.
dotnet/test/Unit/CloneTests.cs Verifies .NET clone behavior copies the new collection.
dotnet/test/E2E/SessionConfigE2ETests.cs Adds .NET E2E coverage for create/resume instruction directories.
dotnet/src/Types.cs Adds .NET public config properties and clone support.
dotnet/src/Client.cs Sends InstructionDirectories in .NET create/resume RPC requests.

Copilot's findings

  • Files reviewed: 23/23 changed files
  • Comments generated: 0

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Cross-SDK Consistency Review ✅

This PR does an excellent job of adding instructionDirectories support consistently across all four SDK implementations. Here's a quick summary of what was verified:

SDK Config property Both create & resume Unit tests E2E tests
Node.js/TS instructionDirectories?: string[]
Python instruction_directories: list[str] | None
Go InstructionDirectories []string
.NET IList<string>? InstructionDirectories

Naming conventions, JSON wire key (instructionDirectories), parameter ordering relative to skillDirectories, and copy/clone semantics are all consistent.


Minor observation (non-blocking)

In python/copilot/client.py, there is a subtle behavioral difference between how skill_directories and instruction_directories are guarded before being added to the RPC payload:

# skill_directories: falsy check — an empty list [] is NOT sent
if skill_directories:
    payload["skillDirectories"] = skill_directories

# instruction_directories: None check — an empty list [] IS sent
if instruction_directories is not None:
    payload["instructionDirectories"] = instruction_directories

If the runtime treats instructionDirectories: [] and omitting the field differently (e.g., an empty list clears all instruction dirs), this distinction is intentional and fine. If they're equivalent, it may be worth making the guard consistent with how skill_directories is handled. Either way, this is a minor Python-internal detail and does not affect the cross-SDK API surface.

Generated by SDK Consistency Review Agent for issue #1190 · ● 684.5K ·

@stephentoub stephentoub merged commit d3abfa2 into main May 4, 2026
39 checks passed
@stephentoub stephentoub deleted the stephentoub/instruction-directories branch May 4, 2026 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants