-
Notifications
You must be signed in to change notification settings - Fork 331
fix(maker-core): surface Claude subagent launch failures to the parent task #3024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 6 commits
559b19b
e47400a
68452e1
43be3a5
01d6527
6d166f0
a59f8c7
0c51141
3a63d8c
b1c3fe5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -174,15 +174,44 @@ export function deriveAgentTaskStatus( | |
| options?: { | ||
| resultIsLaunchReceipt?: boolean; | ||
| persistedStatus?: AgentTaskTerminalStatus; | ||
| resultIsError?: boolean; | ||
| }, | ||
| ): AgentTaskStatus { | ||
| const persistedStatus = normalizeAgentTaskTerminalStatus(options?.persistedStatus); | ||
| if (persistedStatus) return persistedStatus; | ||
| const hasResult = typeof result === 'string' && result.trim().length > 0; | ||
| if (options?.resultIsError && hasResult) return 'failed'; | ||
| if (updateStatus === 'running' && hasResult && !options?.resultIsLaunchReceipt) return 'completed'; | ||
| return updateStatus ?? (hasResult ? 'completed' : 'running'); | ||
| } | ||
|
|
||
| /** | ||
| * 判断子任务工具结果是否以失败收尾(历史回放恢复 failed 的依据)。判定为“是”的 | ||
| * 形态:结构化 JSON 错误记录(ok:false / success:false / status ∈ error|failed|failure | ||
| * / 非空 error|errors|exception|stderr 字段)、`<tool_use_error>` 标记、或以 | ||
| * Error/失败句式开头的短结果。与 messagePresentation.isErrorRecord 语义对齐 | ||
| * (该函数不可达:agentTask 是叶子模块),但只读 result 字符串,不依赖工具元数据。 | ||
| */ | ||
| export function isSubagentResultError(result: string | undefined): boolean { | ||
|
Battleplus marked this conversation as resolved.
|
||
| const text = typeof result === 'string' ? result.trim() : ''; | ||
| if (text.length === 0) return false; | ||
| // Only trust protocol-level error markers. Subagent result content is arbitrary | ||
| // user work product -- fields like "errors", "status", "stderr" in JSON output | ||
| // are data, not execution failure signals. Parsing arbitrary body for | ||
| // error-looking fields creates false positives that mark successful tasks as | ||
| // failed after Desktop reload / Mobile reconnect. | ||
| // | ||
| // Authority sources: | ||
| // 1. Claude protocol <tool_use_error> -- emitted by the SDK when a tool call fails | ||
| // 2. Persisted structured terminal status (agentTaskStatus) -- written by | ||
| // messagePersistBroadcaster on terminal observations | ||
| // | ||
| // Note: <error> prefix removed -- too generic. A subagent returning | ||
| // `<error>校验报告</error>` as work output would be misclassified as failure. | ||
| // Only <tool_use_error> is a reliable protocol-owned error marker. | ||
| return text.startsWith('<tool_use_error>'); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 当 Mobile 重连后只有配对的 Useful? React with 👍 / 👎. |
||
| } | ||
|
|
||
| /** | ||
| * Tool names that spawn a sub-agent task: Claude `Task`/`Agent`, Codex collab agents, | ||
| * PI `subagent`(Cindy 自有扩展注册的工具名,与 pi 社区惯例一致)。 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.