Repository navigation
feat: sanitize skill descriptions in the skill index - #30341
jscottmiller wants to merge 1 commit into
Conversation
b5c65e6 to
89aa107
Compare
90ea16c to
f10b3ef
Compare
89aa107 to
b44574d
Compare
f10b3ef to
2f64b42
Compare
b44574d to
1d22c4d
Compare
2f64b42 to
3e9087c
Compare
|
/coder-agents-review |
|
Chat: Review posted | View chat Review historydeep-review v0.13.0 | Round 3 | Last posted: Round 3, 16 findings (2 P2, 5 P3, 7 P4, 2 Nit), COMMENT. Review Finding inventoryFindings
Contested and acknowledgedRound logRound 1Full panel (round 1). Netero: 1 P3, 1 Note. Panel: ging-go, kurapika, ryosuke, pariston, mafuuu, bisky, hisoka, gon, leorio, mafu-san, meruem (wildcard, random). 11 panel reviewers, multi-domain target (security-sensitive input handling). Result: 1 P2, 5 P3, 4 P4, 2 Nit, 2 Note (body), 3 dropped, 2 out of scope. Orchestrator corrected CRF-10 evidence: plugin.go:264 calls strutil.Truncate without TruncateWithEllipsis. Tag-character pass-through and entity split reproduced by orchestrator. Reviewed against 1d22c4d..3e9087c. Round 2 updateBLOCKED. CRF-13 (P4, user docs) silent; 11 other open findings addressed in amended commit 49d2520 (unverified by panel). No review panel. Reviewed against 3e9087c..49d2520. Round 3Restructure round (docs file added to the PR diff; PR rebased onto new base 1c5c928). Churn guard PROCEED: CRF-13 addressed. Netero: reused R1 agent did not write output, spawned a new agent; 1 P4, 1 Note. Full panel: ging-go, kurapika, ryosuke, pen-botter (docs trigger), pariston, mafuuu, bisky, hisoka, gon, leorio, mafu-san, meruem (wildcard, random). 12 panel reviewers. Fixes for CRF-1, 3 to 12 verified by Netero, Kurapika, Ryosuke, Bisky (mutation), Leorio, Mafu-san. New: 2 P2, 4 P4, 3 Note (body), 2 dropped, 1 out of scope. CRF-25 and CRF-26 have no file line, posted in the review body. Reviewed against 1c5c928..6c12d9e. About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
There was a problem hiding this comment.
This PR sanitizes and caps skill descriptions rendered in the <available-skills> index. Findings: 1 P2, 5 P3, 4 P4, 2 Nit.
Out of scope (needs a ticket or explicit acceptance by a human):
codersdk/promptsanitize.go:54:isVisiblekeeps Unicode tag characters (U+E0000 to U+E007F) and variation selectors, so everySanitizePromptTextcaller (custom system prompts, workspace context files, plugin descriptions) passes hidden ASCII-encoded text to the model.coderd/x/chatd/instruction.go:49: workspace context file content is written into<workspace-context>without escaping, so it can close that block and open any tag in the system prompt, which is the case this PR blocks for skill descriptions.
Notes:
coderd/x/chatd/chattool/skill.go:84: the alias next to each description is not escaped, and coderd does not validate workspace skill names (context_prompt.go:270-286); the index relies on the agent rejecting names that failSkillNamePattern.coderd/x/chatd/chattool/skill.go:121: the prompt is not parsed as XML, so the model reads<and>literally;Use for List<T> genericsreaches it asList<T>.
docs/ai-coder/agents/extending-agents.md:83
P4 [CRF-13] The user docs say each skill contributes its name and description to <available-skills> but do not say the description is now flattened to one line, has < and > escaped, and is cut at 1024 runes for workspace skills. (Leorio)
A skill author whose long or multi-line description worked before this PR gets a truncated single line with nothing in the docs to explain it. Add one sentence after this line describing the rendering.
🤖
🤖 This review was automatically generated with Coder Agents.
3e9087c to
49d2520
Compare
|
/coder-agents-review |
There was a problem hiding this comment.
The amended commit 49d2520 changes the code for 11 of the 12 findings from the previous review. One finding has no change and no reply:
docs/ai-coder/agents/extending-agents.md:83(P4, CRF-13): the user docs still say each skill contributes its name and description to<available-skills>, without saying that descriptions are now flattened to one line, have<and>escaped, and are cut at 1024 runes for non-personal skills. This finding was in the previous review body because the file is outside the diff.
The next full review runs after you add the docs sentence, file an issue for it, or reply with why the docs should not change.
🤖 This review was automatically generated with Coder Agents.
1d22c4d to
1c5c928
Compare
49d2520 to
6c12d9e
Compare
Docs previewCheck off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here. |
|
/coder-agents-review |
There was a problem hiding this comment.
This PR sanitizes and caps skill descriptions rendered in the <available-skills> index. Findings this round: 2 P2, 4 P4 (two of them, on the PR description and the commit message, are in this body because they have no file line).
The changes in 49d2520 and 6c12d9e address all 13 findings from the first review. Truncation now runs before escaping, tag characters and variation selectors are removed, the docs state what escaping does and does not guarantee, and tests check the cap boundary with inputs that upload accepts.
- PR description (P2): it still says descriptions are "truncated with
...at 4096 runes for personal skills (the upload limit) or 1024 runes otherwise". The code no longer truncates personal descriptions, cuts other descriptions with…before escaping, and 4096 is a byte limit. Rewrite that sentence to match the commit message and mention theextending-agents.mdchange, since the description is what reviewers and the squash commit read. - Commit 6c12d9e body (P4): "(codersdk.SanitizePromptText, plus every format rune except U+200C, including Unicode tag characters, and variation selectors)" can be read as "variation selectors are kept". The code removes them. For example: "everything codersdk.SanitizePromptText strips, every format rune (Cf) except U+200C, which includes Unicode tag characters, and every variation selector."
Out of scope (needs a ticket or explicit acceptance by a human):
docs/ai-coder/agents/extending-agents.md:175-177: the Personal skills section gives the 64 KB file limit but not the 4096-byte description limit (coderd/x/skills/skills.go:23), so users learn about it only from the upload error.
Notes:
coderd/x/chatd/chattool/skill.go:108: the comment's range U+E0000 to U+E007F includes 31 unassigned codepoints (U+E0000, U+E0002 to U+E001F) thatunicode.Cfdoes not match; they have no ASCII mapping.coderd/x/chatd/ARCHITECTURE.md:1064: the alias list omitsplugin/<plugin>/<name>from the new base. It is accurate whilemergeTurnSkillspassesnilplugin skills; the change that passes them needs to update this paragraph and theread_skill_filewording.coderd/x/chatd/chattool/skill.go:111: removing all ofunicode.Cfdiffers from the explicit list incodersdk.SanitizePromptText, which avoids blanketCfstripping to keep subdivision flag emoji. A description with the England flag renders as a plain black flag.
🤖 This review was automatically generated with Coder Agents.
FormatResolvedSkillIndex now sanitizes every skill description before rendering it in the <available-skills> block, whatever the skill's source: invisible runes are removed (everything codersdk.SanitizePromptText strips, every format rune (Cf) except U+200C, which includes Unicode tag characters, and every variation selector), control runes and whitespace runs collapse to one space, and ASCII < and > are escaped as < and > so a description cannot end the block or add entries. The text is still read by the model; this keeps the block's structure, it does not make the text trusted. Non-personal descriptions are cut to the Agent Skills limit of 1024 runes, ending in an ellipsis, before escaping; personal descriptions are already bounded at 4096 bytes on upload. This changes how personal and workspace skill descriptions render today: a multi-line or tag-bearing description becomes one escaped line. The chatd architecture document gains a Skill index section covering the block, the skill tools and the sanitization, and extending-agents.md describes how workspace and personal skill descriptions render.
6c12d9e to
0a8167f
Compare
tl;dr: Sanitize and cap every skill description rendered in the chat skill index, so a description cannot break out of the
<available-skills>block.chattool.FormatResolvedSkillIndexnow passes each description throughsanitizeSkillDescription: invisible runes are removed, control runes and whitespace runs collapse to one space,<and>are escaped, and the result is truncated with...at 4096 runes for personal skills (the upload limit) or 1024 runes otherwise (the Agent Skills limit). This changes how all skill descriptions render in the skill index, not only plugin skills: existing personal and workspace skills with multi-line or tag-bearing descriptions now render as one escaped line.The chatd architecture document gains a Skill index section.
SanitizesDescriptionsandCapsDescriptionsPerSourceinchattoolcover the behavior; the plugin cases stay in #29323.This PR was generated by Coder Agents on behalf of @jscottmiller.