fix(maker-core): 泄漏工具调用标记的回合不再按成功收口,纳入有界自动恢复 - #2541
Conversation
fix 部分 makecindy#2518(类 B 状态误判;LaTeX 渲染部分为独立 renderer 决策,不在 本 PR):模型偶发把工具调用块写坏(开标签的 < 与外层调用标签一起丢失), SDK 解析器从未进入工具调用状态,损坏标记连同参数正文被当普通 assistant 文本输出 —— 回合静默按成功收口,工具实际没执行,用户无从分辨「做完了」 和「压根没跑」(issue 实测 423 次调用中 3 次未被任何机制捕获)。 - 新增共享纯函数检测器 leaked-tool-markup.ts(标记语法集中定义,不在各 translator 复制正则):须同时命中 invoke 开标记(允许缺失前导 <)与其后 的 parameter 开标记;代码围栏/行内代码先剥离;name 有界不含换行。单独 出现 invoke/parameter 词汇、普通讨论、大写变体均不命中。 - claude-code translator 收口分类:非 is_error、非 interrupt、非 compact、 全轮零结构化 tool_use 且正文命中检测器 → 推带稳定 reason 'malformed-tool-markup' 的 terminal error,然后**继续** status Done + done —— 本轮有真实用量,砍 done 会丢整轮账(与 is_error 失败序列同构; empty-response 只发 error 是因为零用量无账可丢)。日志只记类别与长度, 不记正文。 - desktop 自动续跑 reason 门放行该 key:泄漏正文已落库,恢复走「已有进展 → 续跑提示 + checkpoint」分支(不重发原消息),模型基于上下文重发调用 即可救回(issue 实测 3/3);止损与既有放行 reason 共用连续失败上限 / 人工介入周期硬上限 / 退避。 测试:检测器 9 态单测(类 B / 带 < 泄漏 / 普通讨论 / 单标记 / 围栏与行内 代码 / 大写 / 未闭合围栏)+ translator 5 条收口回归(终态 error 且保 Done+done 记账 / 流式增量聚合 / 正常文本轮 / 执行过结构化工具不判 / interrupt 不判)+ desktop reason 门 2 态。 Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1fc2e5c3f6
ℹ️ 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".
| message: | ||
| '模型输出了格式错误的工具调用块,未能解析为结构化调用,本轮工具未执行。将自动请求模型重试。', | ||
| isTerminal: true, | ||
| reason: 'malformed-tool-markup', |
There was a problem hiding this comment.
Localize the new terminal error
When auto-resume is disabled, exhausted, or cannot take over, this terminal error is shown and persisted, but malformed-tool-markup was not added to renderer/components/chat/errorReasonI18n.ts or the live mappings in makerChatStore.ts:4941-4950. Those paths consequently fall back to this raw Chinese message for every locale, so non-Chinese desktop and remote/mobile users receive untranslated error text; add the reason to the normal locale-backed mapping and all supported catalogs.
AGENTS.md reference: AGENTS.md:L100-L102
Useful? React with 👍 / 👎.
|
| Filename | Overview |
|---|---|
| packages/maker-core/src/agents/shared/leaked-tool-markup.ts | 新增共享泄漏标记检测器,并处理围栏、行内代码、缩进代码、引用、列表和隐藏 HTML 块;先前报告的 CommonMark 边界问题在当前 HEAD 均已有针对性修复和回归测试。 |
| packages/maker-core/src/agents/claude-code/translator.ts | 在结果收口前检测损坏工具调用正文,覆盖流式聚合、未流式尾段和零工具错位结果,同时保持既有终态记账事件序列。 |
| packages/maker-core/src/agents/claude-code/index.ts | 新回合初始化路径现已同步清理检测偏移与历史命中,未发现 send、自动续跑或恢复入口遗漏。 |
| apps/desktop/src/main/maker-ipc/interruptedTurnAutoResume.ts | 将 malformed-tool-markup 纳入既有有界自动续跑 reason 白名单,沿用连续失败上限、人工介入周期和退避机制。 |
| packages/maker-core/src/agents/claude-code/tests/translator-leaked-tool-markup.test.ts | 新增覆盖检测语法、CommonMark 排除规则、结果正文聚合、多工具分段和回合状态生命周期的集中回归测试。 |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Claude Code SDK 输出"] --> B["聚合流式正文与结果尾段"]
B --> C["剥离代码块、代码 span 与隐藏 HTML"]
C --> D{"命中 invoke + parameter 标记对?"}
D -- 否 --> E["正常收口:Done + done"]
D -- 是 --> F["发送 terminal error\nreason: malformed-tool-markup"]
F --> G["继续发送 Done + done\n保留用量记账"]
G --> H["Desktop 有界自动续跑"]
H --> I["续跑提示 + checkpoint"]
H --> J["预算耗尽后交还用户"]
Reviews (44): Last reviewed commit: "fix(maker-core): type-6 标签表补 param" | Re-trigger Greptile
|
@fico-hub 👋 这个 PR 还有 5 条 review conversation 没 resolve(packages/maker-core/src/agents/claude-code/translator.ts / packages/maker-core/src/agents/shared/leaked-tool-markup.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
|
👋 此 PR 触发了维护者确认门:arch(核心路径改动 367 行,maker-core 工具调用标记与自动恢复逻辑)。 已创建讨论 issue #ISSUE_URL# 供维护者跟踪。在维护者 Approve 之前,此 PR 不会被自动合并。 维护者确认方式:直接在 PR 上 Approve(如需修改请 Request Changes,作者改完后再 Approve 即放行)。 讨论 issue:#2546 |
Review 反馈修复(Greptile P1 ×2 + Codex P2 ×1):
- 扫描正文改为「用户实际看到的全文」= emitted + fallbackTail —— 泄漏标记
只存在于 result.result 兜出的未流式尾段(截断兜底刚补推给 UI)时,原先只
扫 emitted 会漏检;前缀 mismatch 分支 fallbackTail 为空,退化为只扫
emitted,与实际展示一致。
- toolUses 累计非零不再整轮免判:TurnState 新增 uiTextLenAtLastToolUse
(最后一次结构化 tool_use 时的已推正文长度),检测只扫该偏移之后的正文
—— 之前的文本属于已正常执行过工具的讨论语境,之后再泄漏(先成功调 N 个
工具、第 N+1 个写坏成纯文本)仍要判;零 tool 轮偏移为 0 语义不变。
- 围栏剥离正则改为 (`{3,}|~{3,}) + 反向引用闭栏:波浪线围栏与 4+ 反引号
开栏(CommonMark 嵌套围栏惯用法)内的示例不再被误判,内层短围栏不会提前
闭合外层。
测试:检测器新增 3 态(~~~ 围栏 / 4 反引号围栏 / 长围栏嵌套短围栏),
translator 回归改写工具语境 2 态(工具前讨论不判 / 最后一次工具后泄漏判)
并新增 result 尾段泄漏 1 态;8 个既有 translator 测试的 TurnState 字面量
补齐新字段。
Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3cd13b12af
ℹ️ 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".
第二轮 review 反馈修复(Greptile P1 + Codex P1): - mismatch 分支补扫:result.result 与已流式正文前缀对不上时 fallbackTail 为空、full 不展示,泄漏若只在 full 里,「工具没执行却按成功收口」的实质 伤害不变 —— 检测依据是本轮模型输出,不限于已展示部分。仅零 tool 轮补扫: 有 tool 轮的 uiTextLenAtLastToolUse 偏移建立在 emitted 之上,无法映射进 错位的 full,保守跳过。 - inline code span 剥离从单行正则改为 CommonMark 等长闭合扫描(对齐 maker-shared mathMarkdown.ts 的语义):开 backtick 运行与等长闭合运行 配对、内容允许换行 —— 多行合法 code span 里演示的标记不再被留给检测器 造成误报;无闭合运行按字面量保留;按空行分段,两段各自的孤立 backtick 不会配对成 span 吞掉中间的真实泄漏。 测试:检测器 +2 态(多行 span 不判 / 空行屏障下真实泄漏仍判),translator +1 态(mismatch 正文泄漏在零 tool 轮命中且不补推正文)。 Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ba01022215
ℹ️ 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".
第三轮 review 反馈修复(Codex P1):合法文档回复用 4 空格缩进代码块演示 标记语法时,预处理只剥围栏与 inline span,缩进块里的标记会触发误报终态 错误 + 自动续跑。按 CommonMark 语义剥离缩进块,保留两条规则:缩进块不能 打断段落 —— 紧跟非空行的缩进行是段落惰性延续不算代码,顺带保住「真实 泄漏恰好缩进在段落中间」的检出;块内空行不终结块。 测试:检测器 +2 态(缩进块演示不判 / 段落惰性延续的缩进泄漏仍判)。 Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ef99b5a91
ℹ️ 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".
第四轮 review 反馈修复(Greptile P1 + Codex P1): - 围栏剥离锚定行首(允许 0-3 空格缩进,CommonMark 语义),闭栏同样要求 行首 —— 段落中间的行内 ``` / ~~~ 不是围栏,原正则会把它误作未闭合 围栏吞掉其后的真实泄漏。 - tool_use 推进扫描偏移前,对被跳过的前段正文单独过一遍检测器,命中记入 TurnState.leakedMarkupBeforeToolUse,收口时与尾段检测一起判 —— 平行 调用里前一个写坏成纯文本、后一个正常解析时,坏调用文本落在 tool_use 之前的段里,不能一律当讨论语境跳过;围栏/行内代码内的演示仍被检测器 剥离,语法讲解不误伤。 测试:translator 前段语义改写为「围栏内讨论不判 / 裸标记的平行调用泄漏 判」两态;既有围栏用例全部保持通过。 同轮 Greptile 的「多工具 + 错位 full 补扫」未采纳:错位 full 上无法映射 tool_use 偏移、无法排除讨论段,扫全量会重新引入前几轮反例约束的误报, 该复合形态退化为本 PR 之前的行为,已在 thread 说明。 Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4008ee14d6
ℹ️ 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".
第五轮 review 反馈修复(Codex P2):闭栏后缀原用 [`~]* 吸收超长闭栏, 会把 ```~~~ 这样的混合字符行误判为闭栏,导致合法围栏示例的剩余内容 暴露给检测器造成误报。按 CommonMark 语义拆成反引号/波浪线两个独立分支, 超长闭栏只由同字符吸收。 测试:检测器 +1 态(混合字符行不是闭栏)。 Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e7ef76c244
ℹ️ 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".
第六轮 review 反馈修复(Greptile P1 + Codex P1): - beginNewTurn 手工重置清单漏掉本 PR 新增的 uiTextLenAtLastToolUse 与 leakedMarkupBeforeToolUse:上一轮 abort/cancellation 未走到 result 的 resetTurnState 时,下一轮会从旧偏移扫描漏检,或沿用旧命中把正常回合 误报成 malformed-tool-markup。补齐两项重置。 - 检测预处理先剥行首 blockquote 前缀(> ,可叠加嵌套):引用里的围栏/ 缩进块(> ```xml、> code)剥掉前缀后交给既有围栏/缩进块剥离按 CommonMark 处理,不再把引用中的合法示例误报;引用里的裸泄漏剥掉前缀 后仍是裸文本,不丢检出。 测试:检测器 +2 态(引用内围栏不判 / 引用内裸泄漏仍判)。 Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c59e30ca61
ℹ️ 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".
|
@fico-hub 👋 这个 PR 还有 3 条 review conversation 没 resolve(packages/maker-core/src/agents/claude-code/translator.ts / packages/maker-core/src/agents/shared/leaked-tool-markup.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
第七轮 review 反馈修复(Codex P2 ×2),并偿还正则技术债:五轮迭代后的 FENCED_CODE_RE 已不可维护,整体替换为行级状态机 stripFencedBlocks + 容器分段递归 stripBlockStructures: - 开栏合法性按 CommonMark 判定:仅 0-3 个**空格**缩进(tab 缩进的是缩进 代码不是围栏);反引号开栏的 info string 不得含反引号,含则整行不是 开栏 —— 原正则会把这两种行误作开栏,把其后的真实泄漏吞到结尾。 - 容器边界不再先抹平:先剥当前层围栏,再把连续 blockquote 行摘出、去一层 前缀递归处理(深度限 8)—— 引用里未闭合的围栏只吞到该引用段末尾,不再 把引用外的真实泄漏一并吞掉。 - 状态机天然保持既有语义:同字符闭栏、不短于开栏、混合字符行不是闭栏、 内层短围栏不闭合外层、未闭合吞到段末。 - 文件头补充设计取向说明:误报(终态错误+自动续跑)与漏检(退化为现状) 代价不对称,剥离逻辑 fail-open 取向少剥少判。 测试:检测器 +3 态(tab 缩进行不是开栏 / info string 含反引号不是开栏 / 引用内未闭合围栏不吞引用外泄漏),全部 31 态通过。 Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a3c1860c67
ℹ️ 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".
第八轮 review 反馈修复(Codex P2,误报方向):模型把语法示例写成列表项内 的合法围栏(- ```xml,内容与闭栏随列表边距缩进)时,开栏带列表标记不被 识别、内容不足四空格也不算缩进代码,普通文档回复会被判成 malformed-tool-markup 触发终态错误 + 自动续跑。 围栏状态机扩展:开栏允许可选列表项标记前缀(- / * / + / 1. / 1) 等); 闭栏缩进上限改为「开栏容器边距 + 3」(CommonMark:闭栏缩进相对容器至多 3 空格,列表项内的闭栏随列表边距整体右移)。 测试:检测器 +3 态(无序/有序列表围栏不判 / 列表围栏闭合后的裸泄漏仍判)。 Signed-off-by: ficowang <fico@xd.com>
prevBlank 近似在「标题后无空行」的形态上失真:标题后的空列表项不被 识别,项内 4 空格缩进的引用围栏不进引用分组而误报。抽出共享 createBlockContext(段落/引用/列表状态,规则与围栏、HTML 状态机一致) 替换两处近似,并补「空列表项之后紧跟空行即关闭」规则(CommonMark: list item can begin with at most one blank line)—— 空行关闭空项后的 4 空格行是顶层缩进代码(渲染为可见代码块的示例),正确不判。缩进代码 的起始门槛同步从「空行后」改为「段落外」(标题后的缩进行是代码, micromark 实测同)。 Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d98cdcf184
ℹ️ 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".
- - inner 这类叠加标记行的每个标记都开启一层列表容器,此前只入栈最内 层内容列,外层项的 2 空格续行会把栈弹空 —— 续行上的未闭合围栏被当顶层 围栏吞到输入末尾,漏掉列表外的真实泄漏。listMarkerContentCols 逐段解析 前缀返回每层内容列(外层在前,最后一层保留 ≥5 空白 padding 规则), enterItem 接数组逐层压栈;围栏/HTML 开栏的标记前缀走同一解析。 Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9851daf5c1
ℹ️ 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".
空列表项之后紧跟空行即关闭该项(CommonMark:list item can begin with at most one blank line)—— 该规则此前只在共享 createBlockContext 里, 围栏与 HTML 两个内联状态机没有:过期的空项上下文会把其后顶层缩进代码 里的反引号行当成项内围栏,吞掉后续可见泄漏。两个状态机补 pendingEmptyItem(仅由空标记行置位、任意行清零、空行时弹层)。 Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: be34017460
ℹ️ 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".
整块无占位地删除会让相邻块重新拼成不同的 Markdown 结构:intro + 围栏 + 空列表项剥掉围栏后变成 intro + `-`,下游状态机把 `-` 误读成 setext 下划线,空列表项与其中 HTML 块的容器边界全部丢失,dedent 后的真实泄漏 被吞到 EOF。围栏 / HTML 块 / 缩进代码剥离时留下「原行首缩进 + \u0000」 的哨兵行:各状态机把它当块边界(收段落、不建段落、按缩进参与容器弹层), 检测前统一转为空行 —— 被剥块同时成为段落屏障,行内 code span / 注释 配对不再跨越被剥块。 Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 659c34a58f
ℹ️ 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".
\<!-- 是反斜杠转义的可见文本不是注释开启符(micromark 实测渲染为 <!--),行内闭合注释正则补 (?<!\\) lookbehind —— 它到后文 --> 之间 的真实泄漏不再被当注释吞掉。转义排除与 invoke/parameter 标记正则同为 单层 lookbehind 近似。 Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00bb01f301
ℹ️ 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".
标记后空白正则按字符吞 1-4 个,-\t\t 两个字符展开后是 7 列 —— 超过 4 列时只有 1 列算 padding,内容列应为标记末列 + 1(此前记成 8,其下 2 空格未闭合围栏被当顶层吞到输入末尾,漏掉列表外真实泄漏)。 listMarkerContentCols 逐段计算标记末列与空白末列的展开列差,>4 列或 最后一段之后还跟空白(≥5 字符)都按溢出处理;单 tab(3 列)照常。 Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17976076b0
ℹ️ 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".
\` 是反斜杠转义的字面反引号(micromark 实测渲染为普通文本),span 扫描此前不看转义,会把两个转义反引号配对成 span、吞掉中间可见泄漏。 run 扫描改为转义感知:转义只吞运行的首个反引号,剩余仍可作更短的 分隔符;单层 lookbehind 近似与其余正则一致。 Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 51f6f6f007
ℹ️ 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".
- item\nlazy 里 col-0 的 lazy 是列表项段落的惰性延续,列表项仍敞开, 其后 2 空格围栏属于该项 —— 此前无条件按 dedent 弹层,把项内未闭合围栏 当顶层吞掉列表外真实泄漏。三处状态机(围栏 / HTML / 共享跟踪器)统一: 敞开段落的纯段落行(非标题/分隔线/setext/引用/标记/HTML 开启)按惰性 延续处理不弹层;带普通文本内容的标记行敞开项内段落使惰性行可识别; 块级行(标题等)照常弹层结束列表(micromark 实测三种走向一致)。 Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: de7bb5a69d
ℹ️ 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".
|
@fico-hub 👋 这个 PR 还有 3 条 review conversation 没 resolve(packages/maker-core/src/agents/claude-code/translator.ts / packages/maker-core/src/agents/shared/leaked-tool-markup.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
CommonMark 的 code span 内容里反斜杠不转义:span 以「内容尾随反斜杠 + 闭合反引号」结尾时(`code \`)闭合照常成立(micromark 实测)。上一轮 的转义感知误伤了闭合端搜索,把这类合法 span 留给检测造成误报 —— 拆成 nextOpenRun(开启端跳过转义反引号)与 nextRawRun(闭合端不看转义)。 Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8b9955c0e
ℹ️ 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".
dashhuang
left a comment
There was a problem hiding this comment.
产品方向认可:工具实际上没有执行时,不能让这一轮按成功完成。
但当前实现为了识别一个上游异常,在客户端逐步维护了一套接近 Markdown/CommonMark 解析器的检测逻辑,范围和长期维护成本过重。请先在 #2546 补齐模型/SDK 根因调查:模型与 SDK 版本、原始事件类型、停止原因、请求 ID 和脱敏样本,并用较新 SDK 做对照验证;优先争取结构化的异常信号。
如果根因解决前仍需要临时兜底,请把客户端方案收窄到已观测协议特征:仅在没有结构化 tool-use 事件时触发,明确把本轮标为“工具未执行”并阻止成功收口;可以复用现有有界恢复,但不要执行泄漏文本或盲目重发原请求。泄漏正文的 Markdown/LaTeX 安全展示请独立处理。
同时请增加匿名命中统计和明确的移除条件,避免临时兼容层永久留在客户端。完成根因调查并把兜底显著收窄后再放行。
对照 micromark htmlBlockNames 逐项比对,param 是本表唯一缺项 —— <param …> 块在渲染端整块隐藏,块内协议示例不算泄漏。 Signed-off-by: ficowang <fico@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0a528acb9c
ℹ️ 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".
| // 这里看不到结论 —— 只陈述事实与始终存在的人工重试入口(第三十轮 | ||
| // Codex review)。 | ||
| message: | ||
| '模型输出了格式错误的工具调用块,未能解析为结构化调用,本轮工具未执行,可重新发送重试。', |
There was a problem hiding this comment.
当本轮先成功执行一个或多个结构化 tool_use、随后才泄漏下一个损坏调用时(下方新增测试明确覆盖此路径),这里仍向用户断言“本轮工具未执行”。若自动续跑未接管或额度耗尽,用户据此重新发送原请求可能重复此前已经产生的文件修改、命令或推送等副作用;请根据 ctx.turn.toolUses 区分“本轮没有工具执行”与“最后一个调用未执行”。 docs/dev-rules/maker-core-and-agent-behavior.mdL78-L81
Useful? React with 👍 / 👎.
|
@fico-hub 👋 这个 PR 还有 3 条 review conversation 没 resolve(packages/maker-core/src/agents/claude-code/translator.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
这次改了什么
摘要
fix 部分 #2518(类 B 状态误判与自动恢复;LaTeX 渲染部分为独立 renderer 决策,不在本 PR)。模型偶发把工具调用块写坏(开标签的
<与外层调用标签一起丢失),SDK 解析器从未进入工具调用状态,损坏标记连同参数正文被当普通 assistant 文本输出——回合静默按成功收口,工具实际没执行,用户无从分辨「做完了」和「压根没跑」(issue 实测 423 次调用中 3 次未被任何机制捕获)。agents/shared/leaked-tool-markup.ts(标记语法集中定义):须同时命中 invoke 开标记(允许缺失前导<)与其后的 parameter 开标记;代码围栏/行内代码先剥离;name 有界不含换行。单独出现 invoke/parameter 词汇、普通英文讨论、大写变体均不命中。malformed-tool-markup的 terminal error,然后继续 status Done + done——本轮有真实用量,砍 done 会丢整轮账(与 is_error 失败序列同构;empty-response 只发 error 是因为零用量无账可丢)。日志只记类别与长度,不记正文。变更类型
fix缺陷修复feat新功能refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
packages/maker-core检测器 + claude-code translator 收口分类;apps/desktop自动续跑 reason 白名单;对应测试UI 变化
不涉及(main/maker-core 收口分类;错误横幅复用既有 error 呈现,message 为兜底文案)。
怎么验证的
自动验证
指标影响评估(maker-core 规范 3.4)
手工验证
不涉及(泄漏形态为模型偶发输出,无法稳定手工复现;以 issue 提供的真实类 B 文本形态构造测试)。
未执行的验证
未在真实模型泄漏现场端到端验证自动续跑闭环(触发率约 0.9% 且依赖模型侧偶发);恢复路径复用 #2320 已验证的既有状态机,本 PR 只新增入口分类。
风险
风险分类
影响与回滚
提交前检查
git commit -s,见 DCO)