Skip to content

forward CustomAgentsLocalOnly in session.create and session.resume - #1899

Merged
roji merged 2 commits into
github:mainfrom
syf2211:fix/dotnet-custom-agents-local-only-session-create
Jul 31, 2026
Merged

forward CustomAgentsLocalOnly in session.create and session.resume#1899
roji merged 2 commits into
github:mainfrom
syf2211:fix/dotnet-custom-agents-local-only-session-create

Conversation

@syf2211

@syf2211 syf2211 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Forward CustomAgentsLocalOnly from SessionConfig / ResumeSessionConfig into the .NET SDK's session.create and session.resume wire payloads.

Motivation

Fixes #1888. Agent discovery runs during session initialization. The .NET SDK previously only sent customAgentsLocalOnly via the post-create session.options.update call, which arrives too late to restrict discovery to the working directory. The Go SDK already includes this field in session.create / session.resume.

Changes

  • Add customAgentsLocalOnly to internal CreateSessionRequest and ResumeSessionRequest records
  • Populate the field from config.CustomAgentsLocalOnly in CreateSessionAsync and ResumeSessionAsync
  • Add unit serialization tests (serialize when set, omit when null)
  • Add E2E wire-capture tests for create and resume requests

Tests

  • dotnet test test/GitHub.Copilot.SDK.Test.csproj --filter FullyQualifiedName~GitHub.Copilot.Test.Unit155 passed
  • New serialization tests for customAgentsLocalOnlypassed
  • E2E wire-capture tests added (same harness as existing ClientOptionsE2ETests; require tsx in CI)

Notes

  • Post-create session.options.update behavior is unchanged; this only ensures the value is present at initialization time.
  • Pre-submit review (composer-2.5): APPROVE 4/5 — minimal fix matching Go SDK behavior for explicitly configured values.

Fixes #1888

@syf2211
syf2211 requested a review from a team as a code owner July 3, 2026 10:09
@roji

roji commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Thanks. I've pushed an additional commit on top that propagates this to all other language SDKs and also fixes the CustomAgentsLocalOnly behavior in Empty mode.

@roji
roji force-pushed the fix/dotnet-custom-agents-local-only-session-create branch from 8fad5ce to a8726db Compare July 17, 2026 11:01
@roji
roji enabled auto-merge July 17, 2026 11:02
@roji

roji commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

@github/copilot-sdk can someone give this a look please?

syf2211 and others added 2 commits July 31, 2026 13:15
…ion.resume

CustomAgentsLocalOnly was only sent via the post-create
session.options.update call, which arrives after agent discovery
has already completed. Mirror the Go SDK by including
customAgentsLocalOnly in CreateSessionRequest and
ResumeSessionRequest wire payloads.

Fixes github#1888
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 6c5ceca0-342a-4fe7-8f7f-55637324e2b2
@SteveSandersonMS
SteveSandersonMS force-pushed the fix/dotnet-custom-agents-local-only-session-create branch from a8726db to 34f8e99 Compare July 31, 2026 13:22
@SteveSandersonMS SteveSandersonMS changed the title fix(dotnet): forward CustomAgentsLocalOnly in session.create and session.resume forward CustomAgentsLocalOnly in session.create and session.resume Jul 31, 2026

@SteveSandersonMS SteveSandersonMS left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fix is correct, complete, and consistent across all 6 SDK languages. Verified via manual regression testing (Python, Node.js, Rust) and .NET build. The timing bug — customAgentsLocalOnly arriving too late via post-create session.options.update — is resolved by forwarding the field in the session.create/session.resume wire payloads, matching the existing Go SDK behavior. Rebased onto latest main.

@roji
roji added this pull request to the merge queue Jul 31, 2026
Merged via the queue into github:main with commit e5cf2b6 Jul 31, 2026
104 of 106 checks passed
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.

CustomAgentsLocalOnly - Incorrect Behaviour

3 participants