Conversation
Go SDK fixes: - NewClient returns *Client (not error), takes *ClientOptions - CreateSession requires context.Context and *SessionConfig (pointer) - Updated all Go examples in debugging.md, hooks/*.md Session API fixes: - sendPrompt/SendPrompt doesn't exist - use send/sendAndWait - Fixed all TypeScript, Python, Go, .NET examples in session-persistence.md Link fixes: - getting-started.md: ./mcp.md → ./mcp/overview.md (file moved)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes documentation accuracy issues found during an audit, specifically correcting Go SDK API signatures and session API method names across multiple documentation files.
Changes:
- Fixed Go SDK API signatures:
NewClienttakes*ClientOptionspointer and returns only*Client,CreateSessionrequirescontext.Contextas first parameter and takes&copilot.SessionConfig{}pointer - Corrected session API method names from non-existent
sendPrompt/SendPromptto actual SDK methodssend/sendAndWait/SendAndWait/SendAndWaitAsyncacross TypeScript, Python, Go, and .NET examples - Fixed broken MCP documentation link from
./mcp.mdto./mcp/overview.md
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| docs/debugging.md | Fixed Go NewClient to accept &copilot.ClientOptions{} pointer parameter instead of value |
| docs/hooks/overview.md | Added context import, fixed NewClient and CreateSession signatures, added _ = session to avoid unused variable warning |
| docs/hooks/pre-tool-use.md | Fixed CreateSession to use context.Background() and &copilot.SessionConfig{} pointer |
| docs/hooks/post-tool-use.md | Fixed CreateSession to use context.Background() and &copilot.SessionConfig{} pointer |
| docs/hooks/user-prompt-submitted.md | Fixed CreateSession to use context.Background() and &copilot.SessionConfig{} pointer |
| docs/hooks/error-handling.md | Fixed CreateSession to use context.Background() and &copilot.SessionConfig{} pointer |
| docs/guides/session-persistence.md | Corrected method names from sendPrompt/SendPrompt to sendAndWait/SendAndWait/send_and_wait/SendAndWaitAsync across all languages; fixed Go NewClient and CreateSession signatures; contains bug in ResumeSession call |
| docs/getting-started.md | Fixed broken MCP documentation link to correct path |
| ```go | ||
| // Resume from a different client instance (or after restart) | ||
| session, _ := client.ResumeSession("user-123-task-456", copilot.ResumeSessionOptions{}) | ||
| session, _ := client.ResumeSession(context.Background(), "user-123-task-456", nil) |
There was a problem hiding this comment.
The ResumeSession method only takes two arguments: ctx context.Context and sessionID string. The third nil argument should be removed. According to the Go SDK source code (go/client.go:660), the correct signature is func (c *Client) ResumeSession(ctx context.Context, sessionID string) (*Session, error). If additional options are needed, use ResumeSessionWithOptions instead.
Suggested change
| session, _ := client.ResumeSession(context.Background(), "user-123-task-456", nil) | |
| session, _ := client.ResumeSession(context.Background(), "user-123-task-456") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes documentation accuracy issues found during audit.
Go SDK Fixes
NewClientreturns*Clientonly (no error tuple)NewClienttakes*ClientOptions(pointer), notClientOptionsCreateSessionrequirescontext.Contextas first parameterSessionConfigmust be passed as pointer (&copilot.SessionConfig{})Files updated:
docs/debugging.mddocs/hooks/overview.mddocs/hooks/pre-tool-use.mddocs/hooks/post-tool-use.mddocs/hooks/user-prompt-submitted.mddocs/hooks/error-handling.mdSession API Fixes
sendPrompt/SendPromptdoesn't exist - SDK usessend/sendAndWaitFile updated:
docs/guides/session-persistence.mdLink Fixes
./mcp.md→./mcp/overview.md(file was moved)File updated:
docs/getting-started.md