[Bug] subagent在使用官方 DeepSeek-V4.1 时,出现 DSML 融毁

Open
#11,151 5 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
ai, backend

Research direction

The log points to runners.tool_loop_agent_runner (the handoff tool result at line 1438 and tool dispatch around line 1185) and sources.openai_source (the raw completion at line 586). Start by finding where a subagent's reply that contains DSML markup is passed back as a tool result instead of being parsed into tool calls. Done means a DeepSeek response with DSML tool-call text is either executed as a tool call or turned into a clean error, with a test covering that case.

Written by the indexing model from the issue text.

Description

bug
问题描述

我尝试指引我家 BOT 使用我创建的 subagent:astrbot_dev进行插件开发,BOT 转接给 subagent 之后,subagent 返回 DSML 工具调用(因为携带了 DSML 所以没有正常工具调用)

如何复现?

1.开启 subagent
2.模型设置为 DeepSeek flash
3.简单写一个提示词
4.让 AI 调用subagent

AstrBot 版本

v4.29.4

操作系统

Linux

部署方式

Podman(docker)

使用的消息平台适配器

QQ 官方机器人(WebSocket)

错误日志
[2026-11-15 02:13:38.307] [Core] [DBUG] [sources.openai_source:586]: completion: ChatCompletion(id='d449b665-7afd-44f0-b922-74d16c931689', choices=[Choice(finish_reason='tool_calls', index=0, logprobs=None, message=ChatCompletionMessage(content='', refusal=None, role='assistant', annotations=None, audio=None, function_call=None, tool_calls=[ChatCompletionMessageFunctionToolCall(id='call_00_ET_ejCgcVWUoaYijoBVwKrL7023', function=Function(arguments='{"input": "请接手一个 AstrBot 插件示例的编写与校验任务(用户在进行 subagent 测试)。\\n\\n已完成的部分:/AstrBot/data/plugins/astrbot_plugin_helloworld 目录下已创建 main.py、metadata.yaml、README.md、requirements.txt、.gitignore,实现了一个 /hello 指令,回复 \\"Hello, <昵称>!\\",并通过了 py_compile 语法检查。\\n\\n请你:\\n1. 读一下 /AstrBot/data/skills/skill-astrbot-dev-v4.29.4/SKILL.md 及相关规范;\\n2. 复核该插件结构、metadata.yaml 字段、代码写法是否符合 AstrBot v4 插件规范,必要时直接改进文件;\\n3. 检查插件是否依赖当前 AstrBot 版本的 astrbot_version 约束(当前版本见环境),确认放错位置或无第三方依赖问题;\\n4. 给出简短的复核结论和不通过点。", "background_task": false}', name='transfer_to_astrbot_dev'), type='function', index=0)], reasoning_content=''))], created=1794708816, model='deepseek-flash', object='chat.completion', metadata=None, moderation=None, service_tier=None, system_fingerprint='bc19ba97cbe016479903222bb1578db6', usage=CompletionUsage(completion_tokens=[REDACTED], prompt_tokens=[REDACTED], total_tokens=[REDACTED], completion_tokens_details=[REDACTED], audio_tokens=[REDACTED], reasoning_tokens=[REDACTED], rejected_prediction_tokens=[REDACTED], text_tokens=[REDACTED], prompt_tokens_details=[REDACTED], cache_write_tokens=[REDACTED], cached_tokens=[REDACTED], image_tokens=[REDACTED], text_tokens=[REDACTED], prompt_cache_hit_tokens=[REDACTED], prompt_cache_miss_tokens=[REDACTED]
[2026-11-15 02:13:38.309] [Core] [INFO] [runners.tool_loop_agent_runner:1185]: Agent 使用工具: ['transfer_to_astrbot_dev']
[2026-11-15 02:13:38.310] [Core] [INFO] [runners.tool_loop_agent_runner:1241]: 使用工具:transfer_to_astrbot_dev,参数:{'input': '请接手一个 AstrBot 插件示例的编写与校验任务(用户在进行 subagent 测试)。\n\n已完成的部分:/AstrBot/data/plugins/astrbot_plugin_helloworld 目录下已创建 main.py、metadata.yaml、README.md、requirements.txt、.gitignore,实现了一个 /hello 指令,回复 "Hello, <昵称>!",并通过了 py_compile 语法检查。\n\n请你:\n1. 读一下 /AstrBot/data/skills/skill-astrbot-dev-v4.29.4/SKILL.md 及相关规范;\n2. 复核该插件结构、metadata.yaml 字段、代码写法是否符合 AstrBot v4 插件规范,必要时直接改进文件;\n3. 检查插件是否依赖当前 AstrBot 版本的 astrbot_version 约束(当前版本见环境),确认放错位置或无第三方依赖问题;\n4. 给出简短的复核结论和不通过点。', 'background_task': False}
[2026-11-15 02:13:38.313] [Core] [DBUG] [runners.base:70]: Agent state transition: AgentState.IDLE -> AgentState.RUNNING
[2026-11-15 02:13:38.313] [Core] [DBUG] [runners.tool_loop_agent_runner:696]: [BefCompact] messages -> [2] system,user
[2026-11-15 02:13:38.316] [Core] [DBUG] [runners.tool_loop_agent_runner:696]: [AftCompact] messages -> [2] system,user
[2026-11-15 02:13:39.433] [Core] [DBUG] [sources.openai_source:586]: completion: ChatCompletion(id='555f77bb-ae92-4fbe-816f-bf444c5f76a1', choices=[Choice(finish_reason='stop', index=0, logprobs=None, message=ChatCompletionMessage(content='\n\n<||DSML|| calls>\n<||DSML|| invoke name="exec">\n<||DSML|| parameter name="command" string="true">pwd; ls -la; echo ---; ls -la /AstrBot 2>&1 | head -20</||DSML|| parameter>\n</||DSML|| invoke>\n</||DSML|| calls>', refusal=None, role='assistant', annotations=None, audio=None, function_call=None, tool_calls=None, reasoning_content="Let me start by exploring the workspace. The task says files are in /AstrBot/data/plugins/... but my workspace is limited. Let me check what's readable.\n\nLet me first try to read the skill file and the plugin."))], created=1794708818, model='deepseek-flash', object='chat.completion', metadata=None, moderation=None, service_tier=None, system_fingerprint='bc19ba97cbe016479903222bb1578db6', usage=CompletionUsage(completion_tokens=[REDACTED], prompt_tokens=[REDACTED], total_tokens=[REDACTED], completion_tokens_details=[REDACTED], audio_tokens=[REDACTED], reasoning_tokens=[REDACTED], rejected_prediction_tokens=[REDACTED], text_tokens=[REDACTED], prompt_tokens_details=[REDACTED], cache_write_tokens=[REDACTED], cached_tokens=[REDACTED], image_tokens=[REDACTED], text_tokens=[REDACTED], prompt_cache_hit_tokens=[REDACTED], prompt_cache_miss_tokens=[REDACTED]
[2026-11-15 02:13:39.435] [Core] [DBUG] [runners.base:70]: Agent state transition: AgentState.RUNNING -> AgentState.DONE
[2026-11-15 02:13:39.437] [Core] [INFO] [runners.tool_loop_agent_runner:1438]: Tool `transfer_to_astrbot_dev` Result: <||DSML|| calls>
<||DSML|| invoke name="exec">
<||DSML|| parameter name="command" string="true">pwd; ls -la; echo ---; ls -la /AstrBot 2>&1 | head -20</||DSML|| parameter>
</||DSML|| invoke>
</||DSML|| calls>
[2026-11-15 02:13:39.438] [Core] [DBUG] [runners.tool_loop_agent_runner:696]: [BefCompact] messages -> [22] system,user,assistant,user,...,assistant,user,assistant,tool
[2026-11-15 02:13:39.440] [Core] [DBUG] [runners.tool_loop_agent_runner:696]: [AftCompact] messages -> [22] system,user,assistant,user,...,assistant,user,assistant,tool
[2026-11-15 02:13:41.218] [Core] [DBUG] [sources.openai_source:586]: completion: ChatCompletion(id='4db93a7e-b491-4525-95ab-31103a19d9d1', choices=[Choice(finish_reason='stop', index=0, logprobs=None, message=ChatCompletionMessage(content='已经转过去了,但返回的内容不对劲,没有正常结论,只返回了一串没解析的原始标签,内容只是执行 ls、pwd 之类的命令\n\n要不要我再转一次,还是先就这样', refusal=None, role='assistant', annotations=None, audio=None, function_call=None, tool_calls=None, reasoning_content="The tool returned something odd — it looks like the subagent's raw output leaked (a DSML tool call block). This is the handoff result. It seems the subagent's response is garbled. I should report to user briefly, in persona.\n\nThe handoff appears to have returned malformed content. Let me summarize: 转过去了,回来一堆乱码/原始标签,没拿到正经结论。\n\nMaybe try once more? Or just report. Keep it short.\n\nI'll report plainly and offer to rerun."))], created=1794708819, model='deepseek-flash', object='chat.completion', metadata=None, moderation=None, service_tier=None, system_fingerprint='bc19ba97cbe016479903222bb1578db6', usage=CompletionUsage(completion_tokens=[REDACTED], prompt_tokens=[REDACTED], total_tokens=[REDACTED], completion_tokens_details=[REDACTED], audio_tokens=[REDACTED], reasoning_tokens=[REDACTED], rejected_prediction_tokens=[REDACTED], text_tokens=[REDACTED], prompt_tokens_details=[REDACTED], cache_write_tokens=[REDACTED], cached_tokens=[REDACTED], image_tokens=[REDACTED], text_tokens=[REDACTED], prompt_cache_hit_tokens=[REDACTED], prompt_cache_miss_tokens=[REDACTED]
辅助信息

astrbot-diagnostics-20261115-021436.zip

检查清单
  • 我已在 Issue 列表中搜索过相关问题仍无法解决,或该问题从未被报告过。
  • 我已尝试过禁用所有插件,排除了可能是因插件导致的问题。
  • 我报告的问题与 AstrBot 本体相关,而非在报告某一插件的问题。
  • 我已阅读并同意本项目的贡献者行为准则。
  • (可选)我愿意提交 PR 以帮助修复该问题。
Dominant language
Python
Stars
46.9k
Forks
3.6k
Avg merge
1d 6h
Merged PRs (30d)
136

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AstrBotDevs/AstrBot

All issues in AstrBotDevs/AstrBot

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.