后台 Agent 启动失败后任务面板长期停留在进行中且无失败通知
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 395
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
**提交人**: liuzhanhao
**客户端版本**: 0.1.51
---
## 现象
在一个包含可见任务进度面板的长任务中,主会话启动了两个原生后台 Agent。两个 Agent 都因所选模型不在当前账号允许列表中,在启动约 1 秒后返回 403;但任务面板仍长期显示“正在等待独立冷读”,超过一小时没有变成失败,也没有向主会话发送完成/失败通知。
## 复现步骤
1. 在 Cindy 会话中创建一个可见任务,并将描述更新为“正在等待后台 Agent”。
2. 通过 Claude Code Agent/Task 机制以后台模式启动子 Agent,同时指定当前账号无权访问的模型。
3. 子 Agent 启动后立即收到 `403 user not allowed to access model`。
4. 等待并观察主会话及任务进度面板。
5. 尝试用已有 ID 查询或停止任务,只得到 `No task found`。
6. 检查本地诊断材料:子 Agent transcript 中已记录 403,临时 `.output` 文件为空。
## 期望行为
- 后台 Agent 在鉴权或模型权限检查失败时,立即向主会话发送失败通知。
- 与该 Agent 关联的可见任务应自动显示失败/受阻,而不是继续显示进行中。
- UI 至少应展示简短失败原因,例如“模型不可用,请切换模型”。
- 查询接口应能用启动时返回的标识读取终态,或明确返回“已失败”,而不是 `No task found`。
- 最好在启动前校验当前账号可用模型,避免创建注定失败的后台任务。
## 实际行为
- 子 Agent 实际在约 1 秒后失败,从未开始工作。
- 主会话未收到自动失败通知。
- 任务面板超过一小时仍显示“进行中/等待独立冷读”。
- 临时输出文件为空。
- 后续状态查询只返回 `No task found`,导致 Agent 一度误以为任务仍在工作并向用户作出错误进度说明。
## 复现频率
本次两个后台 Agent 均复现;分别尝试了两个当前账号无权限的 Claude 模型,结果一致。
## 已尝试
- 使用启动时返回的 Agent ID 查询和停止任务,均返回 `No task found`。
- 读取脱敏后的子 Agent transcript,确认根因是模型权限 403。
- 改用主会话完成任务,绕开后台 Agent。
- 后续计划改用 Cindy 协同模式 Worker,并在创建前查询可用模型;但这只能规避,不能解决原生后台 Agent 失败状态没有传播的问题。
---
**版本区域**: CN
**OS**: win32 x64 (10.0.26100)
**界面语言**: zh-CN
Contributor guide
Research direction
Start with the Claude Code Agent/Task background-launch flow, the visible task progress panel, and the task ID query/stop paths described in the report. Trace how a 403 model-access failure and empty temporary output are represented. Done means failures notify the main session, update the associated task as failed with a useful reason, and remain queryable instead of returning “No task found”.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, typescript
- Domain
- ai, backend, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100