Skip to content

go: change LogOptions.Ephemeral from bool to *bool#827

Merged
SteveSandersonMS merged 1 commit intomainfrom
stevesa/fix-go-ephemeral-permission
Mar 13, 2026
Merged

go: change LogOptions.Ephemeral from bool to *bool#827
SteveSandersonMS merged 1 commit intomainfrom
stevesa/fix-go-ephemeral-permission

Conversation

@SteveSandersonMS
Copy link
Contributor

Summary

LogOptions.Ephemeral was a plain bool, making it impossible for callers to distinguish between "not set" (zero-value false) and an explicit false. The SDK only sent ephemeral on the wire when the value was true, so callers could never explicitly request non-ephemeral logging.

Changes

  • go/session.go - Change Ephemeral from bool to *bool. The Log method now checks opts.Ephemeral != nil and passes the pointer through directly.
  • go/types.go - Updated Bool helper doc to mention LogOptions.Ephemeral.
  • go/internal/e2e/session_test.go - Updated test to use copilot.Bool(true).

Breaking change

Callers must now write Ephemeral: copilot.Bool(true) instead of Ephemeral: true.

This aligns the Go SDK with how the other three SDKs (Node, Python, .NET) handle the field - all use nullable types that omit the field from the JSON-RPC payload when not set.

Copy link
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 updates the Go SDK’s session logging API to allow callers to distinguish between “unset” and an explicit false for LogOptions.Ephemeral, matching how the underlying JSON-RPC parameter is modeled and aligning with the other SDKs’ nullable behavior.

Changes:

  • Changed LogOptions.Ephemeral from bool to *bool and updated Session.Log to forward it whenever non-nil.
  • Updated the Bool helper doc comment to mention LogOptions.Ephemeral usage.
  • Updated the Go E2E session log test to use copilot.Bool(true).

Reviewed changes

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

File Description
go/types.go Doc update for Bool() helper to reference the new nullable LogOptions.Ephemeral pattern.
go/session.go API change: Ephemeral is now *bool, and Session.Log forwards it when set.
go/internal/e2e/session_test.go Adjusts the ephemeral log test to construct LogOptions.Ephemeral with a *bool.

go/types.go Outdated
Comment on lines +70 to +71
// AutoStart: copilot.Bool(false)
// Ephemeral: copilot.Bool(true)
@SteveSandersonMS SteveSandersonMS force-pushed the stevesa/fix-go-ephemeral-permission branch from 3207679 to 67ab1d5 Compare March 13, 2026 12:12
Previously, LogOptions.Ephemeral was a plain bool, so callers could not
distinguish between 'not set' (zero value false) and an explicit false.
This meant the SDK could never send ephemeral=false on the wire, always
deferring to the server default.

Change the field to *bool so nil means 'not set' (omitted from the
JSON-RPC payload) and a non-nil value is forwarded as-is. This is
consistent with how the other SDKs (Node, Python, .NET) handle the
field.

BREAKING CHANGE: Callers must now use copilot.Bool(true) or
copilot.Bool(false) instead of a bare bool literal.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@SteveSandersonMS SteveSandersonMS force-pushed the stevesa/fix-go-ephemeral-permission branch from 67ab1d5 to 08dfdb0 Compare March 13, 2026 12:15
@github-actions
Copy link
Contributor

✅ Cross-SDK Consistency Review: APPROVED

This PR successfully brings the Go SDK into alignment with the other three SDK implementations. Great work!

Summary of Changes

The PR changes LogOptions.Ephemeral from bool to *bool in the Go SDK, allowing callers to distinguish between "not set" and an explicit false value. This matches the nullable/optional approach used by all other SDKs.

Consistency Verification

I've verified that all four SDKs now consistently handle the ephemeral parameter as optional/nullable:

SDK Implementation Type ✅ Status
Node.js ephemeral?: boolean Optional via ? Consistent
Python ephemeral: bool | None = None Optional via | None Consistent
.NET bool? ephemeral = null Nullable via ? Consistent
Go Ephemeral *bool (after this PR) Pointer (nullable) NOW CONSISTENT

API Alignment

All SDKs properly:

  • Use nullable/optional types for the ephemeral field
  • Omit the field from JSON-RPC payload when not explicitly set
  • Allow users to explicitly request ephemeral or non-ephemeral logging
  • Provide helper utilities (Go: copilot.Bool(), .NET built-in nullable syntax, JS/Python native optional support)

Breaking Change Note

As documented in the PR description, this is a breaking change for Go users who must now write:

Ephemeral: copilot.Bool(true)

instead of:

Ephemeral: true

This is the correct design decision—it matches the established pattern across all other SDKs and fixes the inability to explicitly request non-ephemeral logging.

No further consistency changes needed across other SDKs. 🎉

Generated by SDK Consistency Review Agent for issue #827 ·

@SteveSandersonMS SteveSandersonMS merged commit 2a67ecc into main Mar 13, 2026
26 checks passed
@SteveSandersonMS SteveSandersonMS deleted the stevesa/fix-go-ephemeral-permission branch March 13, 2026 12:27
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