Add typed AuthError variants once the runtime distinguishes auth-missing/invalid/unreachable
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- rust
- 领域
- api, authentication
调研方向
这项工作受 github/copilot-agent-runtime#7485 阻塞;先阅读该 runtime issue,并定位 SDK 现有的 Error/Rpc 映射,因为这里没有指定 SDK 文件。存在不同的 wire code 后,将它们映射到 AuthErrorKind,并将未知 code 保留为 Rpc,然后验证 src-tauri/src/error.rs:115-120 和 handlers/auth.rs::emit_copilot_cli_auth_issue 不再需要字符串匹配或 connectivity workaround。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- Java
- 星标
- 10.5k
- 派生
- 1.5k
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 130
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/copilot-sdk 的其他 Issue
-
agentic-workflows
难度 2/5 1-3 小时 新手友好度 65/100
github/copilot-sdk#2760 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
github/copilot-sdk#2759 ·
-
documentation
难度 1/5 1 小时以内 新手友好度 85/100
github/copilot-sdk#2758 ·
-
agentic-workflows
难度 2/5 1-3 小时 新手友好度 68/100
github/copilot-sdk#2709 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 78/100
github/copilot-sdk#2673 ·
查看 github/copilot-sdk 的全部 Issue
相似的 Issue
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
apache/flink-agents#1152 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 70/100
jenkinsci/blueocean-plugin#5417 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
objectionary/eo-graphs#75 ·