Skip to content

go: preserve tri-state session flags#1536

Merged
SteveSandersonMS merged 1 commit into
github:mainfrom
qmuntal:go-tristate-session-flags
Jun 1, 2026
Merged

go: preserve tri-state session flags#1536
SteveSandersonMS merged 1 commit into
github:mainfrom
qmuntal:go-tristate-session-flags

Conversation

@qmuntal
Copy link
Copy Markdown
Contributor

@qmuntal qmuntal commented Jun 1, 2026

Summary

  • Change Go SessionConfig.EnableConfigDiscovery, ResumeSessionConfig.EnableConfigDiscovery, and ResumeSessionConfig.ContinuePendingWork from plain bool to *bool.
  • Forward non-nil values directly into session.create / session.resume, so explicit false is preserved instead of being omitted.
  • Update Go call sites and serialization coverage for nil / true / false behavior.

Impact

This is a breaking Go API change for callers assigning plain booleans to these fields. Callers now use copilot.Bool(true) or copilot.Bool(false) when they want to override the runtime default, and leave the field nil when they want the runtime default.

The behavioral impact is that Go callers can now intentionally send enableConfigDiscovery=false and continuePendingWork=false. Previously those false values were indistinguishable from unset, which meant the SDK silently omitted them and could not express user intent.

Why

The wire schema treats these options as optional booleans with tri-state semantics: unset means defer to runtime default, true means opt in, and false means explicitly opt out. The Go public API used plain booleans, collapsing unset and false into the same zero value. Aligning the API with the schema avoids surprising behavior for configuration discovery and pending-work resume flows.

Validation

Not run, per request.

@qmuntal qmuntal requested a review from a team as a code owner June 1, 2026 19:31
Copilot AI review requested due to automatic review settings June 1, 2026 19:31
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

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates session configuration options to support tri-state behavior (unset vs explicitly true/false) for config discovery and pending work continuation, allowing clients to preserve runtime defaults while still being able to explicitly disable features.

Changes:

  • Converted EnableConfigDiscovery and ContinuePendingWork from bool to *bool (tri-state) in public config types.
  • Updated client request construction to forward pointer values directly.
  • Adjusted samples/e2e usage and added unit tests to validate JSON omit/forward behavior.
Show a summary per file
File Description
go/types.go Changes config fields to *bool and updates GoDoc to describe tri-state semantics.
go/client.go Forwards *bool values into RPC request structs (instead of only sending true).
go/client_test.go Adds tests for JSON forwarding/omission of enableConfigDiscovery and continuePendingWork.
go/samples/manual_tool_resume/main.go Updates sample to pass copilot.Bool(true) for new pointer field.
go/internal/e2e/*_e2e_test.go Updates e2e configs to use copilot.Bool(...) for new pointer fields.

Copilot's findings

  • Files reviewed: 8/8 changed files
  • Comments generated: 3

Comment thread go/types.go
Comment on lines +904 to +911
// EnableConfigDiscovery, when non-nil, controls automatic discovery of MCP server configurations
// (e.g. .mcp.json, .vscode/mcp.json) and skill directories from the working directory
// and merges them with any explicitly provided MCPServers and SkillDirectories, with
// explicit values taking precedence on name collision.
// Nil leaves the runtime default unchanged; use Bool(false) to explicitly disable discovery.
// Custom instruction files (.github/copilot-instructions.md, AGENTS.md, etc.) are
// always loaded from the working directory regardless of this setting.
EnableConfigDiscovery bool
EnableConfigDiscovery *bool
Comment thread go/client_test.go
Comment on lines +500 to +508
t.Run("create omits enableConfigDiscovery when unset", func(t *testing.T) {
req := createSessionRequest{}
data, _ := json.Marshal(req)
var m map[string]any
json.Unmarshal(data, &m)
if _, ok := m["enableConfigDiscovery"]; ok {
t.Error("Expected enableConfigDiscovery to be omitted when unset")
}
})
Comment thread go/client_test.go
Comment on lines +525 to +533
t.Run("resume omits enableConfigDiscovery when unset", func(t *testing.T) {
req := resumeSessionRequest{SessionID: "s1"}
data, _ := json.Marshal(req)
var m map[string]any
json.Unmarshal(data, &m)
if _, ok := m["enableConfigDiscovery"]; ok {
t.Error("Expected enableConfigDiscovery to be omitted when unset")
}
})
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.

3 participants