go: change LogOptions.Ephemeral from bool to *bool#827
Conversation
There was a problem hiding this comment.
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.Ephemeralfromboolto*booland updatedSession.Logto forward it whenever non-nil. - Updated the
Boolhelper doc comment to mentionLogOptions.Ephemeralusage. - 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
| // AutoStart: copilot.Bool(false) | ||
| // Ephemeral: copilot.Bool(true) |
3207679 to
67ab1d5
Compare
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>
67ab1d5 to
08dfdb0
Compare
✅ Cross-SDK Consistency Review: APPROVEDThis PR successfully brings the Go SDK into alignment with the other three SDK implementations. Great work! Summary of ChangesThe PR changes Consistency VerificationI've verified that all four SDKs now consistently handle the
API AlignmentAll SDKs properly:
Breaking Change NoteAs documented in the PR description, this is a breaking change for Go users who must now write: Ephemeral: copilot.Bool(true)instead of: Ephemeral: trueThis 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. 🎉
|
Summary
LogOptions.Ephemeralwas a plainbool, making it impossible for callers to distinguish between "not set" (zero-valuefalse) and an explicitfalse. The SDK only sentephemeralon the wire when the value wastrue, so callers could never explicitly request non-ephemeral logging.Changes
Ephemeralfromboolto*bool. TheLogmethod now checksopts.Ephemeral != niland passes the pointer through directly.Boolhelper doc to mentionLogOptions.Ephemeral.copilot.Bool(true).Breaking change
Callers must now write
Ephemeral: copilot.Bool(true)instead ofEphemeral: 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.