后台 Agent 显式模型选项未按当前账号权限过滤,导致反复 403
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 395
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
**提交人**: guoning
**客户端版本**: 0.1.52
---
## 现象
主会话使用 `codex/gpt-5.6-sol`,调用原生后台 Agent 时,工具允许显式选择 `sonnet` / `opus`。任务启动后才发现当前账号无权访问对应 Claude 模型并返回 403。
## 复现步骤
1. 在使用 GPT/Codex 模型的主会话中启动后台 Agent。
2. 显式传入 `model: sonnet`,随后尝试 `model: opus`。
3. 后台任务创建成功,但执行阶段返回模型访问权限错误。
4. 即使切换 Agent 类型,若其模型仍解析为不可访问的 Claude 模型,结果相同。
## 期望行为
- Agent 工具的模型选项应根据当前账号实际可用模型过滤或在启动前校验;或
- 默认继承主会话模型,并在显式覆盖为无权限模型时立即给出清晰的参数校验错误;或
- 错误信息明确建议省略 `model` 以继承当前会话模型。
## 实际行为
工具接口暴露了 `sonnet` / `opus` 等选项,但当前账号不具备对应模型权限。后台任务在启动后失败,返回类似:
```text
403 user not allowed to access model
Tried to access claude-sonnet-5 / claude-opus-5
```
这会造成无效任务启动和重复重试,也容易让用户误以为其主会话模型选择没有生效。
## 复现频率
本次连续 3 次复现:Sonnet、Opus,以及使用代码探索 Agent 但仍解析到 Sonnet。
## 已尝试
- 切换 Sonnet 到 Opus:仍因权限失败。
- 切换 Agent 类型:仍因底层模型解析到无权限模型失败。
- 最终停止使用后台 Agent,改由主会话直接完成任务。
## 建议
优先在工具 schema/运行时同步账号可用模型,并让不传 `model` 成为推荐路径;不可访问的显式模型应在创建任务前拒绝,而不是创建后异步失败。
---
**版本区域**: CN
**OS**: darwin arm64 (25.6.0)
**界面语言**: zh-CN
Contributor guide
Research direction
Start by tracing the Agent tool's model schema and runtime task-creation path described in the report, then inspect how the current account's available models are resolved. Verify the Sonnet and Opus cases, including an Agent type that resolves to Sonnet. Done means inaccessible explicit models are rejected before task creation or filtered, with a clear suggestion to omit model and inherit the main session model.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai, authorization, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100