Skip to content

Carry over the remaining SessionConfig fields in copilot copyResumeSessionConfig so multi-turn options persist - #710

Open
PratikDhanave wants to merge 2 commits into
microsoft:mainfrom
PratikDhanaveFork:copilot-resume-session-config-fields
Open

Carry over the remaining SessionConfig fields in copilot copyResumeSessionConfig so multi-turn options persist#710
PratikDhanave wants to merge 2 commits into
microsoft:mainfrom
PratikDhanaveFork:copilot-resume-session-config-fields

Conversation

@PratikDhanave

Copy link
Copy Markdown
Contributor

What

copilotprovider.openSession uses two paths to build the SDK session config:

  • First turn (no service ID) goes through copySessionConfig, which does clone := *source and therefore preserves every copilot.SessionConfig field.
  • Later turns (with a service ID) go through resumeSessionConfig -> copyResumeSessionConfig, which hand-copied only 18 fields.

The SDK's copilot.ResumeSessionConfig shares far more fields with SessionConfig than those 18. The rest — ClientName, GitHubToken, Providers/Models/Capi, ReasoningSummary, ContextTier, ModelCapabilities, OnMCPAuthRequest, MCPOAuthTokenStorage, DefaultAgent/Agent/ExcludedBuiltInAgents, PluginDirectories, InstructionDirectories, LargeOutput, ToolSearch, Memory, RemoteSession, EnableSessionTelemetry, EnableCitations, SessionLimits, EnableConfigDiscovery, SkipEmbeddingRetrieval, EmbeddingCacheStorage, OrganizationCustomInstructions, EnableOnDemandInstructionDiscovery, EnableFileHooks, EnableHostGitOperations, EnableSessionStore, EnableSkills, IncludeSubAgentStreamingEvents, SkipCustomInstructions, CustomAgentsLocalOnly, CoauthorEnabled, ManageScheduleEnabled — were silently dropped.

The result: a multi-turn agent's configured options quietly stopped taking effect after the first turn.

Fix

Extend copyResumeSessionConfig to carry over every SessionConfig field that also exists on copilot.ResumeSessionConfig, mirroring the create path. Each added field was verified to exist on both structs in the vendored SDK. Streaming still defaults via copyBoolDefaultTrue.

Why (parity)

This mirrors the copilot SDK's own Client.CreateSession / Client.ResumeSessionWithOptions, which map the same shared set of options onto the create and resume wire requests. The create-vs-resume asymmetry in the provider was the sole reason those options were honored on turn 1 but not afterward; carrying them over restores the intended per-session configuration across turns.

Testing

  • Extended richSessionConfig() to populate the previously-dropped fields (ClientName, Providers/Models, ContextTier, ReasoningSummary, DefaultAgent/Agent, EnableSkills, GitHubToken, RemoteSession, the Enable*/Skip* toggles, etc.).
  • Extended TestCopyResumeSessionConfig_CopiesAllProperties to resume an existing-service-ID session and assert the corresponding wire params are now present on the session.resume request and match what the create path sends.
  • The test fails before the change (clientName = <nil>, want "test-client") and passes after.
  • go build ./..., go vet ./provider/copilotprovider/..., and go test ./provider/copilotprovider/... all pass.

Copilot AI review requested due to automatic review settings July 24, 2026 02:40
@PratikDhanave
PratikDhanave requested a review from a team as a code owner July 24, 2026 02:40

Copilot AI 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.

Pull request overview

This PR fixes a create-vs-resume configuration asymmetry in copilotprovider.openSession by ensuring multi-turn sessions retain the same effective copilot.SessionConfig options after resuming with an existing service ID.

Changes:

  • Expanded copyResumeSessionConfig to carry over additional SessionConfig fields into copilot.ResumeSessionConfig, restoring multi-turn option persistence.
  • Extended richSessionConfig() and TestCopyResumeSessionConfig_CopiesAllProperties to cover the newly preserved fields on the session.resume wire request.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
provider/copilotprovider/copilot.go Copies additional session config fields into resume config so resume path matches create path behavior.
provider/copilotprovider/copilot_test.go Adds richer config fixtures and assertions to verify new fields are sent on session.resume.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread provider/copilotprovider/copilot.go Outdated
ReasoningEffort: source.ReasoningEffort,
ReasoningSummary: source.ReasoningSummary,
ContextTier: source.ContextTier,
Tools: source.Tools,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — fixed in f989f62: copyResumeSessionConfig now sets Tools: slices.Clone(source.Tools) so the per-turn append in resumeSessionConfig can no longer mutate the shared base SessionConfig backing array.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

The first turn of a copilot-backed agent has no service ID and creates the
session via copySessionConfig, which clones the full SessionConfig. Later
turns carry a service ID and go through copyResumeSessionConfig, which
hand-copied only 18 of the fields shared with copilot.ResumeSessionConfig.
Every other configured option (ClientName, Providers/Models, Capi,
ReasoningSummary, ContextTier, the Enable*/Skip* toggles, DefaultAgent/Agent,
PluginDirectories, GitHubToken, RemoteSession, and more) was silently dropped,
so a multi-turn agent's configuration quietly stopped taking effect after the
first turn.

Mirror the create path by copying every SessionConfig field that also exists
on ResumeSessionConfig, matching the SDK's own CreateSession/ResumeSession
parity. Extend the rich fixture and the resume test to assert the wire params
now match the create request.
@PratikDhanave
PratikDhanave force-pushed the copilot-resume-session-config-fields branch from f989f62 to 9f49289 Compare July 24, 2026 09:33
@github-actions

Copy link
Copy Markdown
Contributor

Parity Review — PR #710

Scope: provider/copilotprovider/copilot.go + copilot_test.go

Verdict: ✅ No parity issues. No exported API changes.

This PR is a bug fix entirely within unexported implementation helpers (copyResumeSessionConfig). It extends the internal field-copy from copilot.SessionConfigcopilot.ResumeSessionConfig to include all fields that exist on both structs, mirroring what copySessionConfig already does on the first turn. No exported types, functions, methods, option structs, or public-facing behavior are added or removed.

Cross-repo consistency: The concept of mapping shared session configuration fields uniformly between a create-session path and a resume-session path is a Go-internal implementation detail of the Copilot provider wrapper. There is no analogous copyResumeSessionConfig surface in the .NET or Python implementations to compare against. The fix restores the intended per-session configuration semantics that the Copilot SDK itself expects, consistent with the upstream create/resume API contract.

Label: public-api-change label not applicable — no exported API changed. parity-approved label is correctly present.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

Generated by Go API Consistency Review Agent · 22.7 AIC · ⌖ 4.92 AIC · ⊞ 5.9K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parity-approved Go API consistency review found no parity issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants