Replies: 4 comments 1 reply
|
ask_user_question 在 run_code 里答案到达 host 却被静默丢弃——工具链的"交互反馈回路"断裂(工具结果没进会话流)。 这类工具返回/上下文注入问题第 8 章有排查思路(产物追踪/上下文注入):https://github.com/Electricitysheep/dsh-handbook/blob/main/docs/08-tools-context.md |
|
补充一个更明确的复现(我这边也踩到了):run_code 里调 ask_user_question,4ms 就返回空结果(同步执行不等异步),而内层 ask_user_question 12 秒后返回的结果被直接丢弃——答案到了但没进会话流。 这基本可以确认是 run_code 的执行模型问题,不是模型/文档约定能根解的:
AGENTS.md 约定只能"让模型别这么写"(治标),治本应该在 run_code 侧:要么支持异步工具回调(把结果挂回会话),要么对未完成的交互式工具返回 pending 状态让上层等待。 这个案例(run_code 内交互式工具的回调丢失)会记录进手册第 8 章工具链的坑位——欢迎在帖子里补充更多复现细节,方便给官方一个完整的 bug 报告。 |
|
基本上能提供的细节dsh已经帮我整理好了提交在这里了,我看了下也不能补充更多了 |
|
@xinhochen 你这个复现更精确:run_code 里调 ask_user_question,4ms 就返回空结果(同步执行不等异步),内层 12s 后返回的结果被直接丢弃(会话帧已结束)。 这和原帖的"答案到达 host 但被丢弃"是同一执行模型问题的两个面:
同意你的判断:这是 run_code 处理的问题(应支持异步工具回调挂回会话,或对未完成交互工具返回 pending),AGENTS.md 约定只能让模型别这么写,治标不治本。 这个案例我们已记录进手册第 8 章工具链坑位(run_code 内交互式工具异步回调丢失),也欢迎你补充更多复现细节,给官方一个完整 bug 报告。https://github.com/Electricitysheep/dsh-handbook/blob/main/docs/08-tools-context.md |
Uh oh!
There was an error while loading. Please reload this page.
ask_user_question inside run_code: the answer reaches the host but is silently dropped from the conversation
Environment
TL;DR
When the model calls
ask_user_questionfrom inside a run_code program, the question popup works and the user's selection does arrive at the host (the sub-call settle event carries the complete answer). But if the program doesn'treturn/print the ask result, the outerrun_codecompletes with "(run_code completed with no output)", the answer never re-enters the conversation, and the model wrongly concludes the user never answered. The information is in the transcript (thetool/code-dispatchevent), but it is discarded at the outer tool-result boundary. This is a footgun for interactive tools; suggesting a harness-level guard below.Steps to reproduce
(run_code completed with no output), and the model's next step reasons "The ask_user_question returned no output (maybe no answerer available or empty)" and proceeds with a wrong assumption (暂缓决策/ "defer the decision") even though the user explicitly selected an option.Actual behavior vs expected
Evidence from the session log (session.jsonl, turn 59)
tool/call(run_code)tool/code-dispatch-start...:code:1ask_user_questiontool/code-dispatch(settle)isError: false, content = {"answers":[{"id":"backend_choice","selected":["采纳:统一 zerolog(Recommended)"]}]} — the user's real selectiontool/result(run_code)"(run_code completed with no output)"So the question/answer pipeline (userQuestions service → apiproxy provider → web UI → answer back) works end-to-end. The answer is present in event 864010. Only the final hop — the run_code program propagating the value — is missing, and nothing downstream recovers it.
Root cause
The code-mode dispatch bridge correctly executes the nested
ask_user_questionthrough the full tool pipeline and settles the sub-call with the canonical answer. The worker program received the value but discarded it (noreturn/console.log), so the outerrun_coderesult is empty by contract ("absent result means the program returned undefined"). The agent then sees an empty tool result and misinterprets it as "no answerer available".Discussion points / proposed improvements
tool/code-dispatchevent already carries the data — it just needs to cross the outer-result boundary.ask_user_questioninside run_code (force a direct top-level call, whose result reaches the conversation automatically), or make the bridge auto-print the answer for such tools.Related observation: the model also reported the failure as "ask_user_question returned no output", which led it to conclude the user never answered — a misleading failure signature for a case where the answer actually arrived.
Impact
Low severity (no data loss — the answer is recoverable from the log), but high confusion cost: the agent proceeds against an explicitly stated user decision. This happened in a long-running multi-round review session (turn 59) and silently derailed the plan until the user noticed.
All reactions