format_skills_as_xml escapes quotes in skill description, corrupting the prompt text
维护者通常 3 天内回复
评估
这个 Issue 还没有评估数据。
描述
🔴 Required Information
Describe the Bug:
google.adk.skills.prompt.format_skills_as_xml calls html.escape() with its default quote=True. Every " and ' in a skill's description is therefore turned into " / ' before the text goes into the system prompt. The skills block is plain text for an LLM, not an XML attribute value, so only <, > and & need escaping to keep the structure valid. Escaping quotes makes the description harder for the model to read and changes what the skill author wrote.
Steps to Reproduce:
- Run the following:
from google.adk.skills import models, prompt skills = [ models.Frontmatter( name="my-skill", description='never break the user\'s spaghetti, "al dente" is the law', ) ] print(prompt.format_skills_as_xml(skills)) - Look at the
<description>block in the output.
Expected Behavior:
The description is rendered as written:
<description>
never break the user's spaghetti, "al dente" is the law
</description>
Observed Behavior:
Quotes are HTML-escaped:
<description>
never break the user's spaghetti, "al dente" is the law
</description>
Environment Details:
- ADK Library Version (pip show google-adk): main (2.14.1) @
e1deb17f5 - Desktop OS: Linux
- Python Version (python -V): 3.11.18
Model Information:
- Are you using LiteLLM: No
- Which model is being used: N/A (the bug is in prompt construction, before any model call)
🟡 Optional Information
Regression:
Not checked. The html.escape(...) calls in src/google/adk/skills/prompt.py look like they were added with the escaping of </>/&, and the default quote=True was probably not intended.
Logs:
N/A
Screenshots / Video:
N/A
Additional Context:
The fix is to pass quote=False to both html.escape calls in format_skills_as_xml (name and description). <, > and & are still escaped, so the XML structure stays protected. The existing test desc<ription> still passes. A regression test, test_format_skills_as_xml_preserves_description_quotes, is added in tests/unittests/skills/test_prompt.py.
The fix is also applied to the name attribute, even if its field validator currently doesn't allow such values.
Minimal Reproduction Code:
from google.adk.skills import models, prompt
description = 'never break the user\'s spaghetti, "al dente" is the law'
xml = prompt.format_skills_as_xml(
[models.Frontmatter(name="my-skill", description=description)]
)
assert description in xml # fails: quotes are rendered as " / '
How often has this issue occurred?:
- Always (100%)
- 主要语言
- Python
- 星标
- 22.3k
- 派生
- 4.4k
- 平均合并
- 1 天 2 小时
- 30 天内合并 PR
- 6
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
google/adk-python 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
google/adk-python#8360 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
google/adk-python#8359 ·
维护者通常 3 天内回复
-
Can pin to litellm version be changed?可能已有人在做 @llalitkumarrr 于 10 天前认领。 未关闭models
难度 1/5 1 小时以内 新手友好度 65/100
google/adk-python#8129 · 2 条评论 · 已指派 1 人 ·
维护者通常 3 天内回复
-
OpenAPI tools ignore operation- and path-level server overrides可能已有人在做 @sanketpatil06 于 14 天前认领。 未关闭tools
难度 2/5 1-3 小时 新手友好度 75/100
google/adk-python#8064 · 4 条评论 · 已指派 1 人 ·
维护者通常 3 天内回复
-
Two docstrings in openapi_tool document parameters the signatures do not accept可能已有人在做 @surajksharma07 于 17 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 88/100
google/adk-python#8024 · 1 条评论 · 已指派 1 人 ·
维护者通常 3 天内回复
查看 google/adk-python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
vllm-project/vllm#70030 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
TigreGotico/tugaphone#408 ·
维护者通常 1 天内回复
-
needs-triage
难度 2/5 1-3 小时 新手友好度 74/100
gke-labs/kube-agents#7308 ·
维护者通常 1 天内回复
-
t: bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 3 天内回复
-
chore
难度 1/5 1-3 小时 新手友好度 88/100
lugassawan/swe-workbench#841 ·