Add typed AuthError variants once the runtime distinguishes auth-missing/invalid/unreachable
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- rust
- Domain
- api, authentication
Research direction
This work is blocked on github/copilot-agent-runtime#7485; start by reading that runtime issue and locating the SDK's existing Error/Rpc mapping, since no SDK file is named here. Once distinct wire codes exist, map them to AuthErrorKind and preserve unknown codes as Rpc, then verify src-tauri/src/error.rs:115-120 and handlers/auth.rs::emit_copilot_cli_auth_issue no longer require string matching or the connectivity workaround.
Written by the indexing model from the issue text.
Description
Context
Companion to github/copilot-agent-runtime#7485 — the runtime today returns identical generic -32603 internal_error payloads for "no token," "invalid token," and "network unreachable." Once the runtime adds distinct codes (e.g., -32001 AuthMissing, -32002 AuthInvalid, -32003 AuthUnreachable), the SDK should expose them as a typed enum so consumers don't string-match.
Proposed shape
pub enum Error {
Rpc { code: i32, message: String, data: Option<Value> },
// ...
Auth(AuthErrorKind), // new
}
pub enum AuthErrorKind {
/// No token configured. User needs to sign in.
Missing,
/// Token rejected by CAPI (401/403). User needs to reauth.
Invalid,
/// Transport failure talking to CAPI. Retry, don't reauth.
Unreachable { cause: String },
}
The SDK can map known runtime codes to Error::Auth(...) and leave anything else as Error::Rpc { ... }.
What this lets consumers delete
In Copilot Desktop today (src-tauri/src/error.rs:115-120) we string-match three magic phrases:
pub fn is_copilot_auth_failure(&self) -> bool {
let message = self.to_string().to_ascii_lowercase();
message.contains("not authenticated")
|| message.contains("authenticate first")
|| message.contains("no authentication info available")
}
Plus the connectivity-tracker workaround in handlers/auth.rs::emit_copilot_cli_auth_issue whose only job is to second-guess whether the runtime's "not authenticated" really means "not authenticated" or "couldn't reach the auth service." Both go away with typed variants.
Dependencies
Blocked on the runtime change (github/copilot-agent-runtime#7485). No useful SDK work to land before the runtime distinguishes the cases on the wire.
Generated via Copilot (Claude Opus 4.7) on behalf of @tclem
- Dominant language
- Java
- Stars
- 10.5k
- Forks
- 1.5k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 130
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from github/copilot-sdk
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
github/copilot-sdk#2760 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
github/copilot-sdk#2759 ·
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 85/100
github/copilot-sdk#2758 ·
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
github/copilot-sdk#2709 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
github/copilot-sdk#2673 ·
All issues in github/copilot-sdk
Similar issues
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/flink-agents#1152 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
jenkinsci/blueocean-plugin#5417 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
objectionary/eo-graphs#75 ·