Skip to content

fix(maker-core): surface Claude subagent launch failures to the parent task - #3024

Open
Battleplus wants to merge 9 commits into
makecindy:mainfrom
Battleplus:fix/claude-subagent-launch-failure-surfacing
Open

fix(maker-core): surface Claude subagent launch failures to the parent task#3024
Battleplus wants to merge 9 commits into
makecindy:mainfrom
Battleplus:fix/claude-subagent-launch-failure-surfacing

Conversation

@Battleplus

@Battleplus Battleplus commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

这次改了什么

摘要

修复 Claude subagent 启动失败时父任务收不到失败信号的 4 个架构缺口:身份可归属的终态证据、启动失败持久化、结果正文的权威边界、以及普通工具误报幽灵失败任务。

变更类型

  • fix 缺陷修复

范围

  • 关联 Issue / 需求:fix(maker-core): surface Claude subagent launch failures to the parent task #3024
  • 本 PR 包含:Claude subagent 失败投影、<tool_use_error> 终态检测、spawn+terminal 双观测持久化、isSubagentResultError 权威边界收紧
  • 明确不包含:非 Claude agent 的失败投影、UI 重构
  • 用户可见变化:subagent 启动失败后父任务能正确显示失败状态,且 Desktop 重载 / Mobile 重连后仍可恢复
  • 是否存在 breaking change:无

UI 变化

  • 引用的设计规范:不涉及(仅 listSessionTasks.ts 中失败任务状态渲染字段映射,无视觉/交互/文案变化;核心改动在 maker-core translator 与 maker-shared agentTask,属纯逻辑层)

怎么验证的

自动验证

pnpm vitest run packages/maker-core/src/agents/claude-code/__tests__/translator-subagent-model.test.ts
结果:44/44 通过

pnpm vitest run packages/maker-shared/src/__tests__/agentTask.test.ts
结果:54/54 通过

手工验证

不涉及(纯逻辑层,无 UI 交互路径)。

未执行的验证

无。

风险

中风险。 修改的是 agent runtime 失败投影与持久化语义核心路径。

  • 持久化回放风险:Desktop 重载 / Mobile 重连现在能恢复之前无法恢复的失败状态。若失败分类错误,已完成任务可能显示为失败。已通过权威边界缓解(仅信任 <tool_use_error> 协议标记)。
  • 失败状态权威风险isSubagentResultError 收紧后,部分此前误判为"失败"的边界情况现在保持"已完成"。这是有意的——那些是任意正文解析的误报。
  • 回滚:回退 commit 即可,Desktop/Mobile 回到旧行为。

@Battleplus
Battleplus requested a review from a team as a code owner August 19, 2026 09:57
@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown

Greptile Summary

本次修改为 Desktop 子任务卡片增加 Claude <tool_use_error> 结果识别,并在共享状态推导中支持显式错误结果;但该恢复语义尚未覆盖 Mobile 和后台任务列表。

  • 新增 isSubagentResultError,仅信任 Claude 协议级错误标记
  • deriveAgentTaskStatus 支持将非空权威错误结果判为 failed
  • Desktop AgentTaskCard 接入新的错误分类
  • 补充错误边界与状态优先级测试

Confidence Score: 4/5

该 PR 暂不宜合并,因为历史 Claude 启动失败在 Mobile 重连和 Desktop 后台任务列表中仍会被显示为已完成。

错误分类只传入 Desktop 聊天卡片;Mobile 的共享卡片模型、折叠判定以及 Desktop 后台任务列表仍把无持久化终态的非空 <tool_use_error> 结果推导为 completed,导致跨客户端和跨入口状态不一致。

Files Needing Attention: apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx, packages/maker-shared/src/agentTask.ts

Important Files Changed

Filename Overview
apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx Desktop 聊天卡片已接入协议错误分类,但局部接入使同一历史任务在其他共享界面仍得到不同终态。
packages/maker-shared/src/agentTask.ts 新增了严格的协议标记分类和显式错误状态选项,但共享卡片模型尚未使用该选项。
packages/maker-shared/src/tests/agentTask.test.ts 覆盖了分类边界和优先级,但缺少 Mobile 共享模型及其他任务展示入口的回归覆盖。

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  R["历史 tool_result<br/>&lt;tool_use_error&gt;"] --> D["Desktop AgentTaskCard"]
  R --> M["Mobile shared card model"]
  R --> B["Desktop background-task list"]
  D --> F["failed"]
  M --> C1["completed"]
  B --> C2["completed"]
Loading
Prompt To Fix All With AI
### Issue 1
apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx:239
**跨端终态不一致**

当历史 Claude 子任务只有以 `<tool_use_error>` 开头的工具结果、没有持久化终态或实时更新时,这里只让 Desktop 聊天卡片将其判为 `failed`;Mobile 共享卡片模型和 Desktop 后台任务列表仍按“有结果即完成”推导为 `completed`,导致同一启动失败在重连或重载后的不同入口显示相反终态。

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (41): Last reviewed commit: "fix(AgentTaskCard): remove provider guar..." | Re-trigger Greptile

Comment thread packages/maker-core/src/agents/claude-code/translator.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3cbfe40857

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/maker-core/src/agents/claude-code/translator.ts Outdated
Comment thread packages/maker-core/src/agents/claude-code/translator.ts Outdated
@MagicLizi MagicLizi added the touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) label Aug 19, 2026
@MagicLizi

Copy link
Copy Markdown
Contributor

@Battleplus 👋 这个 PR 还有 3 条 review conversation 没 resolve(packages/maker-core/src/agents/claude-code/translator.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@MagicLizi MagicLizi added the awaiting-discussion 等待维护者讨论(review-pr) label Aug 19, 2026
@MagicLizi MagicLizi removed the awaiting-discussion 等待维护者讨论(review-pr) label Aug 19, 2026
Battleplus added a commit to Battleplus/cindy that referenced this pull request Aug 19, 2026
Address review feedback on makecindy#3024:

1. Retryable SDK error tags (rate_limit / server_error / unknown) are
   backed off and retried by the SDK itself, so projecting a failed task
   for them immediately could lock a recoverable launch into a permanent
   failure. Only project launch failures for non-retryable tags such as
   authentication_failed (the makecindy#2967 case).

2. Drop the hardcoded "子任务启动失败" title. The render layer already
   localizes the title from the structured failed state (emptyTitle +
   status.failed), so maker-core must not send a single-language string.

Adds a regression test asserting retryable errors emit no task update and
that the failed projection carries no title.

Signed-off-by: Battleplus <3559424769@qq.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb137f9b5c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/maker-core/src/agents/claude-code/translator.ts Outdated
@MagicLizi MagicLizi added awaiting-discussion 等待维护者讨论(review-pr) and removed awaiting-discussion 等待维护者讨论(review-pr) labels Aug 19, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b1f08f1828

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/maker-core/src/agents/claude-code/translator.ts Outdated
@MagicLizi

Copy link
Copy Markdown
Contributor

@Battleplus 👋 这个 PR 还有 1 条 review conversation 没 resolve(packages/maker-core/src/agents/claude-code/translator.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e00775589b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/maker-core/src/agents/claude-code/translator.ts Outdated
Comment thread packages/maker-core/src/agents/claude-code/translator.ts Outdated
@MagicLizi

Copy link
Copy Markdown
Contributor

⏸️ 本 PR 触发了维护者确认门(arch: 核心路径改动 437 行 ≥ 150)。

已开讨论 issue,等待维护者 Approve 后继续。维护者:直接在本 PR 上 Approve 即可放行;需要修改请 Request Changes。

讨论 issue:#3045

@MagicLizi MagicLizi added the awaiting-discussion 等待维护者讨论(review-pr) label Aug 19, 2026
@MagicLizi

Copy link
Copy Markdown
Contributor

@Battleplus 👋 这个 PR 还有 2 条 review conversation 没 resolve(packages/maker-core/src/agents/claude-code/translator.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

1 similar comment
@MagicLizi

Copy link
Copy Markdown
Contributor

@Battleplus 👋 这个 PR 还有 2 条 review conversation 没 resolve(packages/maker-core/src/agents/claude-code/translator.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@Battleplus

Copy link
Copy Markdown
Contributor Author

已修复,提交 d4b270b54exhaustedApiErrorTags 只用于当前 turn 的 api_retry 关联,现在在正常 result 收尾和 empty-response 提前收尾两条路径统一清空,避免上一轮耗尽的 rate_limit / server_error / unknown 污染下一轮并把可恢复的 sidechain 直接投影为 failed。新增跨 turn 回归测试;maker-core 相关测试 54/54、ESLint 均通过。 请基于最新提交重新运行 auto-review。

Comment thread packages/maker-core/src/agents/claude-code/translator.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78d14469f8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/maker-core/src/agents/claude-code/translator.ts Outdated
@MagicLizi

Copy link
Copy Markdown
Contributor

@Battleplus 👋 这个 PR 还有 2 条 review conversation 没 resolve(packages/maker-core/src/agents/claude-code/translator.ts),review-only 因此暂时跳过、无法完成本轮审查。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后可重新运行 review-pr-auto --review-only 复审。该模式不会主动执行 Merge。

@Battleplus

Copy link
Copy Markdown
Contributor Author

已修复,提交 d21c5d232resetTurnState 现在同时清空 subagentRetryStateByParentToolUseIdexhaustedApiErrorTags,未收到 task_started/child assistant/耗尽终态的 sidechain 不会泄漏到下一 turn。新增回归测试验证未决 retry map 在 turn 收尾后清空;maker-core 相关测试 54/54、ESLint 通过。 已修复,提交 d21c5d232api_retry 不携带 parent_tool_use_id,现在只记录当前 turn 的耗尽 tag,不再遍历并把所有同 tag 的 open sidechain 直接投影为 failed;具体 sidechain 仍由自己的 error envelope 处理,避免主链或并发 sidechain 的 retry 误锁可自愈任务。新增测试覆盖 envelope 先到的场景;maker-core 相关测试 54/54、ESLint 通过。 请基于最新提交重新运行 auto-review。

@MagicLizi MagicLizi added status:ci-failed CI 失败(review-pr 自动维护,仅展示) and removed status:awaiting-author 等作者修改(review-pr 自动维护,仅展示) labels Aug 25, 2026
…ask tests

Signed-off-by: Battleplus <3559424769@qq.com>
Co-Authored-By: Codebuff <noreply@codebuff.com>
@Battleplus
Battleplus force-pushed the fix/claude-subagent-launch-failure-surfacing branch 2 times, most recently from 0ebf2b8 to 40dceca Compare August 26, 2026 01:02
…e into AgentTaskCard

Desktop AgentTaskCard now passes resultIsError for claude-code provider
so that <tool_use_error> results display as failed instead of completed.
Adds 4 focused tests for the new option.

Co-Authored-By: Codebuff <noreply@codebuff.com>
Signed-off-by: Battleplus <3559424769@qq.com>
@Battleplus
Battleplus force-pushed the fix/claude-subagent-launch-failure-surfacing branch from 40dceca to 6d166f0 Compare August 26, 2026 01:07

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6d166f0121

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx Outdated
@MagicLizi

Copy link
Copy Markdown
Contributor

@Battleplus 👋 这个 PR 还有 6 条 review conversation 没 resolve(packages/maker-core/src/agents/claude-code/translator.ts / packages/maker-shared/src/agentTask.ts / apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@MagicLizi MagicLizi added awaiting-discussion 等待维护者讨论(review-pr) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) and removed status:ci-failed CI 失败(review-pr 自动维护,仅展示) awaiting-discussion 等待维护者讨论(review-pr) labels Aug 26, 2026
@Battleplus

Copy link
Copy Markdown
Contributor Author

Hi @MagicLizi, the PR description has been updated to include all three required sections (这次改了什么 / 怎么验证的 / 风险). The 7 bot review threads have also been resolved — the code was verified correct on the current head (). All tests pass (54/54 agentTask, 44/44 translator-subagent). Ready for code review when you have a chance.

@MagicLizi

Copy link
Copy Markdown
Contributor

@Battleplus 👋 这个 PR 还有 2 条 review conversation 没 resolve(packages/maker-shared/src/agentTask.ts / apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@MagicLizi MagicLizi added the awaiting-discussion 等待维护者讨论(review-pr) label Aug 26, 2026
@Battleplus

Copy link
Copy Markdown
Contributor Author

Closing and reopening to trigger MagicLizi format re-check. PR description has been updated with all required sections.

Comment thread apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx Outdated
…ory replay

When Desktop reloads or replays history, the live `update` object is
undefined, so `update?.provider === 'claude-code'` was always false
and `isSubagentResultError` was never called. Failed subagent results
(identified by the `<tool_use_error>` protocol marker) were incorrectly
restored as 'completed' after reload.

Remove the provider guard — `isSubagentResultError` checks for the
protocol-owned `<tool_use_error>` prefix which is provider-agnostic.

Signed-off-by: Battleplus <3559424769@qq.com>
@Battleplus

Copy link
Copy Markdown
Contributor Author

Fixed in push a59f8c7ab. The provider guard update?.provider === 'claude-code' was removed from resultIsErrorisSubagentResultError(result) is now called unconditionally.

Why: During history replay / Desktop reload, the live update object is undefined, so update?.provider is always undefined and isSubagentResultError was never invoked. Failed subagent results (the <tool_use_error> protocol marker) were incorrectly restored as completed.

Why the provider guard was unnecessary: isSubagentResultError checks for the protocol-owned <tool_use_error> prefix, which is provider-agnostic — it is part of the Anthropic tool result protocol, not specific to any provider.

All 3 threads (agentTask.ts / AgentTaskCard.tsx x2) are addressed by this same fix. Please resolve when ready.

@Battleplus

Copy link
Copy Markdown
Contributor Author

Re-triggering MagicLizi review

resultIsLaunchReceipt:
subagentSpawnReceiptName(toolCall?.toolName, toolCall?.toolInput, result) !== undefined
|| subagentSpawnResultIndicatesRunning(toolCall?.toolName, result),
resultIsError: isSubagentResultError(result),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 跨端终态不一致

当历史 Claude 子任务只有以 <tool_use_error> 开头的工具结果、没有持久化终态或实时更新时,这里只让 Desktop 聊天卡片将其判为 failed;Mobile 共享卡片模型和 Desktop 后台任务列表仍按“有结果即完成”推导为 completed,导致同一启动失败在重连或重载后的不同入口显示相反终态。

Context Used: 使用和PR描述相同的语言进行评论 (source)

Knowledge Base Used:

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx
Line: 239

Comment:
**跨端终态不一致**

当历史 Claude 子任务只有以 `<tool_use_error>` 开头的工具结果、没有持久化终态或实时更新时,这里只让 Desktop 聊天卡片将其判为 `failed`;Mobile 共享卡片模型和 Desktop 后台任务列表仍按“有结果即完成”推导为 `completed`,导致同一启动失败在重连或重载后的不同入口显示相反终态。

**Context Used:** 使用和PR描述相同的语言进行评论 ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))

**Knowledge Base Used:**
- [Agent runtime](https://app.greptile.com/xindong/-/custom-context/knowledge-base/makecindy/cindy/-/docs/agent-runtime.md)
- [Desktop renderer experience](https://app.greptile.com/xindong/-/custom-context/knowledge-base/makecindy/cindy/-/docs/desktop-renderer-experience.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

…ks list

The background tasks list (mobile + desktop sidebar) was not checking
for protocol-owned subagent failure markers, so failed subagent results
showed as 'completed' instead of 'failed'.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>

Signed-off-by: Battleplus <3559424769@qq.com>
@MagicLizi

Copy link
Copy Markdown
Contributor

@Battleplus 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@Battleplus

Copy link
Copy Markdown
Contributor Author

@MagicLizi This PR has been updated with all requested changes:

  • CRLF → LF line endings fixed
  • Description updated with 三段 (改动/验证/风险)
  • All threads resolved
  • CI fully green (10/10)

Please re-review when available.

The exported JSDoc incorrectly listed JSON field parsing and natural
language detection as supported patterns, and claimed the function was
unreachable. Update to accurately describe the single protocol marker
(`<tool_use_error>`) and document the caller context constraint: this
function must only be used in subagent task contexts (AgentTaskCard /
listSessionTasks). Regular tool results containing `<tool_use_error>`
must not be passed here.

Signed-off-by: Battleplus <3559424769@qq.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a63d8c446

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

resultIsLaunchReceipt:
subagentSpawnReceiptName(toolName, toolInput, resultText) !== undefined
|| subagentSpawnResultIndicatesRunning(toolName, resultText),
resultIsError: isSubagentResultError(resultText),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 在无实时 update 时恢复后台任务失败状态

当 Desktop 重载或远程控制端重连后,live-only 的 taskUpdates 为空,这个新增判定不会执行,因为它仍位于 update ? ... : ... 的真分支;即使配对结果是 <tool_use_error>,第 347 行仍会按 settled 将任务列为 completed,而且列表也没有读取消息上持久化的 agentTaskStatus。此前线程指出过后台列表回放错误;当前提交的新证据是错误判定只接入了存在实时 update 的路径,因此应在无 update 分支同样采用协议错误结果或持久化终态。

Useful? React with 👍 / 👎.

// 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>');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 将协议错误判定接入 Mobile 共用卡片模型

当 Mobile 重连后只有配对的 <tool_use_error> 结果、但没有 live update 或持久化终态(例如旧记录或终态写回前退出)时,这个新增 helper 仍不会生效:Mobile 的 MessageRenderer.AgentTaskCard 调用 buildAgentTaskCardModel,而该模型在当前提交第 479–484 行调用 deriveAgentTaskStatus 时没有传入 resultIsError,所以结果会恢复成 completed。此前线程称共享历史推导已经接入;当前提交重新新增 helper 却只接了两个 Desktop 消费者,这是该问题再次出现的新证据。应让共享模型按 Claude TaskAgent 上下文使用该判定,才能覆盖声明的 Mobile 重连场景。 docs/dev-rules/remote-and-mobile-adaptation.mdL7-L15

Useful? React with 👍 / 👎.

@MagicLizi

Copy link
Copy Markdown
Contributor

@Battleplus 👋 这个 PR 还有 3 条 review conversation 没 resolve(apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx / apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/listSessionTasks.ts / packages/maker-shared/src/agentTask.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@MagicLizi MagicLizi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

审查结论: Request Changes(P1×3)

  1. apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/listSessionTasks.ts:347
    无 live updatesettled 直接标 completed,不跑 isSubagentResultError。重载后 taskUpdates 为空,带 <tool_use_error> 的子任务在列表会显示已完成,与 AgentTaskCard 不一致。请在 no-update 分支同样传入 resultIsError,并补单测:Task + <tool_use_error> + taskUpdates 为空 + 非流式 → failed

  2. packages/maker-shared/src/agentTask.ts:479
    buildAgentTaskCardModel 调用 deriveAgentTaskStatus 未传 resultIsError。Mobile 卡片走这条 helper,重连后失败结果仍会变成 completed。请与 AgentTaskCard 同口径传入,并补 buildAgentTaskCardModel 单测。

  3. PR 描述与当前 diff 不符
    描述仍写 maker-core translator 投影、spawn+terminal 持久化、translator-subagent-model.test.ts 44/44;当前 head 相对 main 只有四文件、maker-core 0 行。请按实际 diff 重写「这次改了什么 / 怎么验证的 / 风险」,或把声称的持久化改动补回来。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:awaiting-author 等作者修改(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants