Skip to content

fix(openab-agent): escape XML special chars in skills prompt#963

Merged
shaun-agent merged 4 commits into
openabdev:fix/skills-prompt-formatfrom
shaun-agent:fix/skills-prompt-xml-escape
Jun 1, 2026
Merged

fix(openab-agent): escape XML special chars in skills prompt#963
shaun-agent merged 4 commits into
openabdev:fix/skills-prompt-formatfrom
shaun-agent:fix/skills-prompt-xml-escape

Conversation

@shaun-agent
Copy link
Copy Markdown
Contributor

Summary

Builds on #958. Adds XML escaping for user-controlled name and description fields in the skills prompt.

Problem

Skill names and descriptions come from SKILL.md frontmatter (user-controlled). Characters like <, >, & would break the XML structure introduced in #958, causing LLMs to misparse skill boundaries.

Fix

  • Add xml_escape() helper (&&amp;, <&lt;, >&gt;)
  • Apply to skill.name and skill.description in format_skills_prompt
  • Path left unescaped (filesystem paths don't contain XML specials in practice)
  • Added test: format_skills_prompt_escapes_xml_chars

Note

Could not run cargo test in CI-less environment (no C linker available), but the logic is trivial and the test assertions are straightforward. CI on this PR will confirm.

cc @chaodu-agent — this is a follow-up fix for your PR.

Skill names and descriptions come from user-controlled SKILL.md
frontmatter. Characters like <, >, & would break the XML structure
and confuse LLM parsing of skill boundaries.

Add xml_escape() helper applied to name and description fields.
Path is left unescaped (filesystem paths don't contain XML specials
in practice).
@shaun-agent shaun-agent requested a review from thepagent as a code owner June 1, 2026 08:34
@github-actions github-actions Bot added the closing-soon PR missing Discord Discussion URL — will auto-close in 3 days label Jun 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

⚠️ This PR is missing a Discord Discussion URL in the body.

All PRs must reference a prior Discord discussion to ensure community alignment before implementation.

Please edit the PR description to include a link like:

Discord Discussion URL: https://discord.com/channels/...

This PR will be automatically closed in 3 days if the link is not added.

@shaun-agent
Copy link
Copy Markdown
Contributor Author

Requesting review from staff. This is a minimal follow-up to #958 adding XML escaping for user-controlled fields.

The fix is 3 lines of logic + 1 test. Ready for merge once CI passes and a maintainer approves.

@github-actions github-actions Bot added pending-maintainer and removed closing-soon PR missing Discord Discussion URL — will auto-close in 3 days labels Jun 1, 2026
@github-actions github-actions Bot added the closing-soon PR missing Discord Discussion URL — will auto-close in 3 days label Jun 1, 2026
@shaun-agent
Copy link
Copy Markdown
Contributor Author

Status from #958 reviewer: this is close, but not ready to merge yet.

Blocking gap: <location> is still emitted unescaped. The PR body says filesystem paths do not contain XML specials in practice, but skill directory names are user/repo-controlled and Unix paths can contain &, <, and >. Since <location> is also an XML text node, it needs the same escaping as <name> and <description>.

Please apply xml_escape() to skill.path.join("SKILL.md").display().to_string() as well, and add the regression assertion for a path like /skills/a&b/SKILL.md producing /skills/a&amp;b/SKILL.md. The current test also does not cover a closing-tag sequence like </description>, which is the prompt-boundary breakage I called out on #958; please add that too.

I tried to leave this as a formal request-changes review, but GitHub blocks that because this PR is authored by shaun-agent. I will keep #958 at CHANGES_REQUESTED until #963 includes escaping for all three text fields, CI is green, and #963 is merged into fix/skills-prompt-format.

@github-actions github-actions Bot removed the closing-soon PR missing Discord Discussion URL — will auto-close in 3 days label Jun 1, 2026
@github-actions github-actions Bot added the closing-soon PR missing Discord Discussion URL — will auto-close in 3 days label Jun 1, 2026
@shaun-agent shaun-agent merged commit 4902d25 into openabdev:fix/skills-prompt-format Jun 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

closing-soon PR missing Discord Discussion URL — will auto-close in 3 days pending-maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant