You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This frontmatter parsing + "first prose line" extraction duplicates logic already present in editedSkillDisplay() (Memory/src/service/evidence/history-skill-policy.ts:70-83), which also parses YAML frontmatter with parseYaml/isRecord and picks the first non-heading prose line (agent-source/runtime.ts:1325 frontmatterValue is a third variant). Two independently maintained implementations will drift and produce different descriptions for the same skill. Consider extracting a shared skillFrontmatterSummary(body) helper and reusing it in both places.
The start/end --- pair is treated as frontmatter unconditionally, so a guide that opens with a Markdown horizontal rule (--- on line 1) and contains another --- separator later has everything between the two rules discarded, even though that text is ordinary prose (the YAML parse fails / returns a scalar, then the prose extraction only runs on the already-sliced body). Conversely, when a leading --- is an HR with no later ---, body is emptied entirely and the description becomes (not provided) despite valid prose below it. Consider only treating the block as frontmatter when it actually parses into a record (i.e. move the body = body.slice(...) inside the successful-parse branch) and falling back to the full body otherwise.
maxChars is not validated: if a caller ever passes NaN/Infinity (e.g. a malformed tuning/config value reaching skillSummaryChars), Math.floor yields NaN, Math.max(1, NaN) is NaN, description.length <= NaN is false and the function returns just "…"; with Infinity truncation is silently skipped. Guard with Number.isFinite before using it.
slice(0, limit - 1) operates on UTF-16 code units, so an emoji or astral-plane CJK character at the cut boundary is split into a lone surrogate and the injected description contains a broken glyph. Truncate by code point, e.g. Array.from(description).slice(0, limit - 1).join("").
A guide that legitimately starts with a Markdown horizontal rule (--- on line 1) and contains no second --- falls into this branch, so the whole guide is discarded and the injected Description degrades to (not provided) even though plenty of prose exists. Only drop the body when the opening --- actually looks like a YAML header (e.g. a key: line follows); otherwise keep the body and let the prose scan skip the rule itself.
💡 Suggested Change
Before:
} else if (/^---(?:\r?\n|$)/u.test(body)) {
// An unterminated header has no safe prose boundary.
body = "";
}
After:
} else if (/^---(?:\r?\n|$)/u.test(body) && /^[\w.-]+\s*:/u.test(body.split(/\r?\n/u)[1] ?? "")) {
// An unterminated header has no safe prose boundary.
body = "";
}
Generated by cloud-assistant via Open Code Review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题与修复
Skill 摘要注入原先直接把调用指南的第一段当作简介,导致自动生成的 Skill 简介重复名称,导入的 Skill 简介可能显示原始 YAML 文件头。
本次按以下优先级选取有效简介:
retrievalBlurb→triggerContext→ YAML 文件头中的description→ 有效正文。跳过标题、重复名称和代码块;没有可用内容时输出(not provided)。全文(full)注入模式保持不变。对应云效工单:MEMMY-814。本 PR 仅包含简介修复;MEMMY-815 的注入预算限制另行提交。两个修复也已放在一起进行联合验证。
验证结果
目标分支为
v1.2.7,修复基线为88edd02a。本次修复不改变召回排序或候选条数。