docs: fix non-compiling Rust external-transport example - #2142
Merged
Conversation
The Rust tab of "Connecting the SDK to the external server"
constructed `Transport::External { host, port }` and omitted the
variant's third field, so the example failed to compile:
error[E0063]: missing field `connection_token` in initializer of `github_copilot_sdk::Transport`
`connection_token` was added to the variant after the example was
written. `None` is the value that matches this section: the server
it tells you to start (`copilot --headless --port 4321`) has no
token, and the other Rust example that constructs this variant, in
docs/setup/multi-tenancy.md, already passes `None`.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the Rust external CLI transport example so it compiles with the current SDK API.
Changes:
- Adds the required
connection_tokenfield withNone.
Show a summary per file
| File | Description |
|---|---|
docs/getting-started.md |
Corrects the Rust external transport example. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Medium
SteveSandersonMS
approved these changes
Jul 30, 2026
SteveSandersonMS
left a comment
Contributor
There was a problem hiding this comment.
Reviewed for scope, correctness, cross-language consistency, and manual Rust API validation. The one-line documentation fix is necessary, correct, and minimal.
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.
The Rust example under "Connecting to an external CLI server" in
docs/getting-started.mdconstructedTransport::External { host, port }and omitted the variant's third required field, so the documented example did not compile. This addsconnection_token: None,.Fixes #2141
Why
Nonecopilot --headless --port 4321, which on startup reportsNo COPILOT_CONNECTION_TOKEN was set, so connections will be accepted from any client.docs/setup/multi-tenancy.md, already passesconnection_token: None.Before and after
Against the published crate, installed the way the guide instructs (
cargo add github-copilot-sdk --features derive, which resolves to 1.0.8), with the example pasted into an asyncmainas the guide's own complete examples do:Before:
After:
The fixed example was also run against a real
copilot --headless --port 4321server: it connects and creates a session, and fails withConnectionRefusedonce the server is stopped, so the connection is genuinely going to the external server.Checks
docs/getting-started.mdwas compiled before and after. This change removes the file's only compile error and introduces none.just validate-docsgives the same per-language results before and after; the only difference is a one-line shift in generated block metadata.No regression test
There is no test to add:
scripts/docs-validation/extract.tshas norustentry inLANGUAGE_MAP, so Rust fences underdocs/are never extracted and no validator covers them. That is also why this drifted unnoticed. Adding Rust coverage needs a validator and a workflow job, so I have left it out of this change.Out of scope
Noted while here, kept separate: the TypeScript tab in this same section is separately stale, as it passes
cliUrl, which is no longer aCopilotClientOptionsfield.