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 ·