Skip to content

fix: retry empty completions in skills_like tool re-query - #10925

Open
gongfpp wants to merge 5 commits into
AstrBotDevs:masterfrom
gongfpp:fix/skills-like-requery-empty-output
Open

gongfpp wants to merge 5 commits into
AstrBotDevs:masterfrom
gongfpp:fix/skills-like-requery-empty-output

Conversation

@gongfpp

@gongfpp gongfpp commented Nov 1, 2026 •

Copy link
Copy Markdown

Fixes #10924

Modifications / 改动点

  • astrbot/core/agent/runners/tool_loop_agent_runner.py
    • Added _requery_tool_params(), which runs a skills_like tool re-query (through _recorded_responses, so request events are still emitted) with the same EmptyModelOutputError retry policy the main step loop already uses (EMPTY_OUTPUT_RETRY_ATTEMPTS + wait_exponential).
    • Both re-query call sites (the initial parameter re-query and the "stronger instruction" repair attempt) now go through it, passing their re-query contexts explicitly.
    • When every attempt still returns no usable output, _resolve_tool_exec() returns None and the step loop appends an explicit notice to the run context. The light-schema tool call is not executed, because those arguments never carried the real parameter values.
    • The notice goes through _append_context_messages(), not a raw run_context.messages.append(...), so it is also emitted as context.appended like every other framework-injected message — otherwise the host conversation record would never learn that no tool ran.
    • The unusable reply is flushed first (_flush_pending_response()). A non-raising empty reply only stages its message.appended, so appending the notice first left the transcript holding an explanation whose reply it explains was missing entirely; the flushed reply keeps _no_save, so it still never enters future context.
  • tests/test_tool_loop_agent_runner.py
    • test_skills_like_requery_retries_empty_completion — two empty completions, then a valid re-query: the tool runs with the re-queried arguments.
    • test_skills_like_requery_reports_failure_without_executing_light_call — exhaustion reports the failure, executes nothing, and the agent can continue in the next step.
    • test_skills_like_requery_reports_failure_after_empty_repair — the repair attempt also exhausting retries keeps the unvalidated light call out.
    • test_skills_like_requery_reports_failure_after_semantically_empty_repair — an empty non-exception repair reply is still unusable output.
    • test_skills_like_requery_failure_notice_reaches_conversation_sink — the failure notice reaches the conversation sink as context.appended, not just the runner's run_context.messages.
    • test_skills_like_requery_failure_notice_follows_every_recorded_reply — every settled reply reaches the transcript (_no_save for the unusable one) and the notice lands after it.

Why

With tool_schema_mode = "skills_like" every tool call goes through an extra provider request that re-queries the model for tool parameters. That request had no retry: provider-level retries (request_retry.retry_provider_request) only cover connection errors and HTTP 408/409/429/5xx, so EmptyModelOutputError bubbled straight out of agent_runner.step() into astr_agent_run_util.run_agent(). A single intermittent empty completion from an OpenAI-compatible provider therefore ended a multi-step task with no reply to the user.

Observed completion (SiliconFlow + deepseek-ai/DeepSeek-V4.1-Flash), note completion_tokens=151 with every content field empty:

ChatCompletion(id='01a195819dd71b9ba52d4527de1183aa',
  choices=[Choice(finish_reason='stop',
    message=ChatCompletionMessage(content='', refusal=None, tool_calls=None))],
  usage=CompletionUsage(completion_tokens=151, prompt_tokens=35307,
    completion_tokens_details=CompletionTokensDetails(reasoning_tokens=0)))

The main step loop already retries this and then switches to a fallback provider; the re-query path simply never got the same treatment. full schema mode is unaffected because it does no re-query.

Related: #7409 reports the same "no usable output" symptom on the main loop path, which already has the retry + fallback that this PR mirrors for the re-query path.

  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果

Merged current master (2d3384f1d) into the branch. #10077 replaced the standalone re-query request helper with inline loops over _recorded_responses(), so this revision wraps that generator and passes the re-query contexts through it. The later _flush_pending_response() / context.appended rework is why the failure notice is routed through _append_context_messages() here. Windows 11 x64, Python 3.12.

$ ruff check astrbot/core/agent/runners/tool_loop_agent_runner.py tests/test_tool_loop_agent_runner.py
All checks passed!
$ python -m pytest tests/test_tool_loop_agent_runner.py -q
84 passed, 4 warnings in 12.23s
$ python -m pytest tests/test_tool_loop_agent_runner.py tests/unit/test_astr_agent_tool_exec.py \
    tests/unit/test_star_context.py tests/unit/test_tool_generator_lifecycle.py -q
198 passed, 4 warnings in 13.78s

Regression check — with only the retry policy removed (single attempt, everything else unchanged), the three cases that depend on retry fail and the non-exception case still passes, which is the expected split; restoring the retry makes all four pass:

$ python -m pytest tests/test_tool_loop_agent_runner.py -k "requery_retries_empty_completion or reports_failure"
E   astrbot.core.exceptions.EmptyModelOutputError: OpenAI completion has no usable output.
FAILED tests/test_tool_loop_agent_runner.py::test_skills_like_requery_retries_empty_completion
FAILED tests/test_tool_loop_agent_runner.py::test_skills_like_requery_reports_failure_without_executing_light_call
FAILED tests/test_tool_loop_agent_runner.py::test_skills_like_requery_reports_failure_after_empty_repair
3 failed, 1 passed, 79 deselected

$ # restore the retry wrapper
$ python -m pytest tests/test_tool_loop_agent_runner.py -q
83 passed

Both transcript regressions fail on their own, one defect reverted at a time:

$ # revert: notice appended by a raw run_context.messages.append(...) (list identical, no event)
$ python -m pytest tests/test_tool_loop_agent_runner.py -q -k failure_notice_reaches_conversation_sink
FAILED ...::test_skills_like_requery_failure_notice_reaches_conversation_sink
1 failed, 83 deselected

$ # revert: skip _flush_pending_response() before the notice
$ python -m pytest tests/test_tool_loop_agent_runner.py -q -k failure_notice_follows_every_recorded_reply
FAILED ...::test_skills_like_requery_failure_notice_follows_every_recorded_reply
1 failed, 83 deselected

Reproducing the original failure in a live deployment is timing dependent (it needs the provider to return an empty completion), so the tests drive ToolLoopAgentRunner with a scripted provider that raises EmptyModelOutputError on the re-query.


Checklist / 检查清单

  • 😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
    / 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。

  • 👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
    / 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。

  • 📚 I checked the affected WebUI instructions and screenshots in docs/zh and docs/en against the changed navigation, page structure, and labels, and updated them in this PR (or explained why no documentation update is needed). For renamed, moved, or merged entry points, I included an old entry → new entry mapping in the documentation and changelog.
    / 我已对照变化后的 WebUI 入口、页面结构和术语,核对并在本 PR 中更新 docs/zh 和 docs/en 的相关操作说明与截图(或说明无需更新文档的原因)。入口改名、移动或合并时,已在文档和 changelog 中补充 旧入口 → 新入口 对照。

    No WebUI navigation, page structure, or label changes; docs need no update.

  • 🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
    / 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到 requirements.txt 和 pyproject.toml 文件相应位置。

  • 😮 My changes do not introduce malicious code.
    / 我的更改没有引入恶意代码。

Summary by Sourcery

Make skills_like tool parameter re-queries resilient to empty model completions while safely reporting failures without executing incomplete tool calls.

Bug Fixes:

  • Retry empty or unusable skills_like tool-parameter completions instead of aborting the agent run.
  • Report exhausted parameter-generation failures through the conversation context and skip execution of unvalidated tool calls.

Enhancements:

  • Centralize skills_like parameter re-query handling, including retry behavior for initial and repair requests.

Tests:

  • Add coverage for successful retries, exhausted retries, failed repair attempts, semantically empty responses, conversation-sink notifications, and prevention of invalid tool execution.

@dosubot

dosubot Bot commented Nov 1, 2026

Copy link
Copy Markdown

📄 Knowledge review

✏️ Suggested updates

1 page suggestion needs review.

Page Library Status
pr4697的改动 AstrBotTeam's Space 🟡 Review
📝 pr4697的改动
@@ -1020,7 +1020,7 @@
 
 **重试前回退逻辑**
 
-修复前,当提供商返回空响应时,系统会立即切换到备用提供商(fallback provider)。修复后,系统会先对同一提供商进行重试,重试失败后再切换备用提供商:
+在主 step 循环中,修复前,当提供商返回空响应时,系统会立即切换到备用提供商(fallback provider)。修复后,系统会先对同一提供商进行重试,重试失败后再切换备用提供商。`skills_like` 参数补全 re-query 的空输出重试采用不同的耗尽处理,见下文「空 completion 异常重试」:
 
 - **重试参数**:
   - `EMPTY_OUTPUT_RETRY_ATTEMPTS = 3`:最多重试 3 次
@@ -2039,6 +2039,15 @@
 
 修复前,如果 LLM 在参数补全阶段返回空响应(既无工具调用也无有意义的文本回复),系统会直接失败,导致工具执行流程中断。
 
+##### 空 completion 异常重试
+初始参数补全 re-query 和强化指令 repair 请求均通过 `_requery_text_chat()` 调用 LLM:
+
+- 仅对 `EmptyModelOutputError` 进行重试,复用 `EMPTY_OUTPUT_RETRY_ATTEMPTS`、`EMPTY_OUTPUT_RETRY_WAIT_MIN_S` 和 `EMPTY_OUTPUT_RETRY_WAIT_MAX_S`,采用指数退避,每次请求最多尝试 3 次(包含首次调用)。
+- 全部尝试均为空输出时,记录警告并返回 `None`,不在此处切换备用提供商,也不因该异常中断整轮 Agent。
+- 初始 re-query 耗尽尝试后,沿用本轮已解析的工具调用及其参数继续执行工具;repair 请求耗尽尝试后,保留 repair 前的响应继续后续处理。
+
+该异常重试与下述针对“无工具调用且无有意义的 assistant 回复”的响应检查不同。
+
 ##### 两阶段重试机制
 PR #7101 在 `tool_loop_agent_runner.py` 的 `_resolve_tool_exec()` 方法中引入了两阶段重试机制:
 
@@ -2120,10 +2129,10 @@
 #### 技术实现要点
 
 ##### 重试逻辑集成
-重试逻辑完全集成在 `_resolve_tool_exec()` 方法中,避免影响其他工具模式:
+响应检查逻辑位于 `_resolve_tool_exec()` 方法中,空 completion 异常重试由 `_requery_text_chat()` 处理,避免影响其他工具模式:
 - 仅在 `tool_schema_mode == "skills_like"` 时激活
-- 重试条件:无工具调用且无有意义的 assistant 回复
-- 重试次数:最多两次(第一阶段 + 第二阶段)
+- 响应检查条件:无工具调用且无有意义的 assistant 回复
+- 上述两阶段响应检查与 `EmptyModelOutputError` 重试分别处理;初始 re-query 和 repair 请求各自最多尝试 `EMPTY_OUTPUT_RETRY_ATTEMPTS` 次
 
 ##### 上下文构建优化
 `_build_tool_requery_context()` 方法的增强确保额外指令正确注入:

Accept · Edit · Decline


Leave Feedback Ask Dosu about AstrBot Add Dosu to your team

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="astrbot/core/agent/runners/tool_loop_agent_runner.py" line_range="1579-1582" />
<code_context>
-                            abort_signal=self._abort_signal,
-                            request_max_retries=self.request_max_retries,
-                        )
+                    repair_resp = await self._requery_text_chat(
+                        repair_contexts, param_subset
                     )
                     if repair_resp:
                         llm_resp = repair_resp
</code_context>
<issue_to_address>
**Original tool call is skipped**

When the initial re-query has no tool call or meaningful reply and every repair attempt returns an empty completion, `_requery_text_chat()` returns `None`, so the guarded assignment leaves `llm_resp` as the no-tool response; `_resolve_tool_exec()` returns it and `step()` completes with an assistant response instead of executing the original parsed tool call.

When repair returns `None`, preserve and return the original tool-call response instead of the earlier no-tool response.
</issue_to_address>

Linked issues

#10924 [Bug] skills_like 模式下工具重查询返回空输出会直接中断整轮 Agent,未复用主循环的空输出重试 · 1 of 2 met

# Requirement Status Notes
1 给两次 requery 调用复用主循环的空输出重试策略 ✅ Met Both the initial re-query and the stronger-instruction repair call use _requery_text_chat(), which retries EmptyModelOutputError with the configured attempt count and exponential backoff.
2 重试仍全部为空时,沿用上一轮已解析出的工具调用继续执行 🟡 Partly met Exhaustion of the initial re-query preserves the original tool call, but exhaustion of the stronger-instruction repair does not: llm_resp remains the earlier no-tool re-query response, so the caller falls back to an assistant response instead of executing the original tool call.

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: astrbot/core/agent/runners/tool_loop_agent_runner.py:1582


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@gongfpp

gongfpp commented Nov 1, 2026

Copy link
Copy Markdown
Author

Good catch — addressed in 63179b4.

You are right about the root cause. The repair re-query only runs when the first re-query produced neither a tool call nor any reply, and by that point llm_resp had already been replaced by that useless response. So when every repair attempt came back empty, _resolve_tool_exec() returned the no-tool response, step() took the "fallback to assistant response" path, and the tool call parsed in the current step was dropped — the exact failure this PR is meant to remove.

_resolve_tool_exec() now keeps the response parsed in the current step and returns it when the repair re-query exhausts, so both exhaustion paths degrade the same way.

Added test_skills_like_requery_degrades_when_repair_attempts_are_empty. Reverting just this hunk makes it fail with the dropped tool call you described:

WARNING  astrbot:tool_loop_agent_runner.py:959 skills_like tool re-query returned no tool calls; fallback to assistant response.
WARNING  astrbot:tool_loop_agent_runner.py:200 LLM returned empty assistant message with no tool calls.
FAILED tests/test_tool_loop_agent_runner.py::test_skills_like_requery_degrades_when_repair_attempts_are_empty

With the fix in place:

$ ruff format --check .
531 files already formatted
$ ruff check .
All checks passed!
$ python -m pytest tests/test_tool_loop_agent_runner.py -q
63 passed

@Soulter

Soulter commented Nov 1, 2026

Copy link
Copy Markdown
Member

The reported failure path looks valid: an EmptyModelOutputError from the skills-like re-query currently escapes without the main loop's empty-output retry handling. Retrying those requests makes sense.

However, I don't think we should execute the original tool call when the re-query exhausts its attempts. The first request uses get_light_tool_set(), whose parameter schema has empty properties; the re-query is what supplies the actual parameter schema. The original call can therefore have {} as its arguments. Executing it may fail for required parameters or invoke a tool with unintended defaults.

Could we instead report the parameter-generation failure back to the agent so it can decide whether to retry or explain the failure? The exhaustion tests should also cover an original call with empty arguments; the current fixtures supply {"query": "light"}, which does not reflect the light schema's usual behavior. Note that this PR retries the current provider but does not switch to a fallback provider.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linked issues

#10924 [Bug] skills_like 模式下工具重查询返回空输出会直接中断整轮 Agent,未复用主循环的空输出重试 · 1 of 2 met

# Requirement Status Notes
1 Retry empty completions in both skills_like tool re-query calls. ✅ Met Both the initial re-query and the repair re-query use _requery_text_chat(), which retries EmptyModelOutputError using the configured attempt count and exponential wait.
2 When retries are exhausted, continue with the tool call already parsed in the current step. 🟡 Partly met Exhaustion no longer propagates an exception, but the parsed tool call is not executed; the runner instead adds a message asking the agent to retry or explain the failure.

@gongfpp

gongfpp commented Nov 1, 2026

Copy link
Copy Markdown
Author

Thanks for the schema clarification. Updated in cd9eaaa:

  • Exhausting the initial or repair re-query no longer executes the original light-schema call (including the usual empty {} arguments).
  • Instead, the runner records that parameter generation failed and no tool ran, then leaves the next agent step to retry with valid parameters or explain the failure.
  • Also handles repair responses that are semantically empty without raising an exception.

Verification: tests/test_tool_loop_agent_runner.py — 64 passed; Ruff check and format checks passed. The new GitHub Actions runs are currently action_required and need upstream approval, not CI successes or failures.

This remains a current-provider retry fix; fallback-provider switching is outside this patch.

@Soulter Soulter moved this to In Progress in AstrBot Roadmap Nov 2, 2026
The skills_like re-query issued its provider request outside the main
step loop's EmptyModelOutputError retry/fallback wrapper, so a single
empty completion raised out of the runner and aborted the whole Agent
run. Route both the parameter re-query and the repair re-query through a
helper that retries empty completions with the main loop's timing.

When every attempt returns no usable output, return to the step loop
with an explicit notice instead of executing the light-schema arguments,
which do not carry the real parameter values.
@gongfpp
gongfpp force-pushed the fix/skills-like-requery-empty-output branch from cd9eaaa to f7b0335 Compare November 9, 2026 04:46

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linked issues

#10924 [Bug] skills_like 模式下工具重查询返回空输出会直接中断整轮 Agent,未复用主循环的空输出重试 · 2 of 3 met

# Requirement Status Notes
1 Retry EmptyModelOutputError for both the initial and repair skills_like re-queries using the main loop's retry timing. ✅ Met Both re-query call sites use _requery_tool_params(), which applies the configured attempt count and exponential backoff.
2 Avoid aborting the Agent run when all re-query attempts return empty output. ✅ Met On exhaustion, the step appends a failure notice and returns instead of letting EmptyModelOutputError escape.
3 When retries are exhausted, continue by using the already parsed tool call. 🟡 Partly met The runner lets the Agent continue, but skips executing the prior tool call so it can reconsider with complete parameters.

),
)
)
return

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Exhaustion skips prior tool call

The issue recommends continuing with the already parsed tool call when all re-query attempts are empty. This change instead appends a notice that no tool was executed and returns, allowing the Agent to reconsider on a later step but not performing the requested fallback.

Prompt for AI agents
In `astrbot/core/agent/runners/tool_loop_agent_runner.py` at line 1217:

**Exhaustion skips prior tool call**

The issue recommends continuing with the already parsed tool call when all re-query attempts are empty. This change instead appends a notice that no tool was executed and returns, allowing the Agent to reconsider on a later step but not performing the requested fallback.

From #10924:

When retries are exhausted, continue by using the already parsed tool call.

@gongfpp

gongfpp commented Nov 9, 2026

Copy link
Copy Markdown
Author

Rebased onto master (6b10af75e) and adapted the fix to the _recorded_responses() refactor: the retry helper now wraps that generator instead of calling text_chat directly, so the re-query still emits RequestStarted / RequestFinished.

On the three requirements above:

  1. Both re-query call sites (initial + repair) go through _requery_tool_params() with EMPTY_OUTPUT_RETRY_ATTEMPTS and the main loop's wait_exponential. ✅
  2. On exhaustion the step loop appends an explicit notice to the run context and returns; EmptyModelOutputError no longer escapes. ✅
  3. Intentionally not implemented. The original issue suggested reusing the previously parsed tool call, but per review on 2026-11-01 the first request uses get_light_tool_set(), whose parameter schema has empty properties — the parsed arguments can be {} and executing them would either fail required-parameter validation or invoke a tool with unintended defaults. The notice lets the agent reconsider instead. The exhaustion fixtures were updated accordingly and now start from {} arguments, as requested.

Also per that review, the re-query still retries only the current provider and does not switch to a fallback provider mid re-query (the main loop keeps owning provider fallback).

Verification on this head (Windows 11 x64, Python 3.12):

$ python -m pytest tests/test_tool_loop_agent_runner.py -q
78 passed
$ python -m pytest tests/test_tool_loop_agent_runner.py tests/test_agent_runner_media_resolver.py tests/agent -q
182 passed

With the source change reverted, the four new regression tests fail on EmptyModelOutputError.

Upstream AstrBotDevs#10077 replaced the standalone re-query request helper with inline
loops over _recorded_responses(), so the retry wrapper now wraps that
generator and receives the re-query contexts explicitly.
@gongfpp

gongfpp commented Nov 14, 2026

Copy link
Copy Markdown
Author

Re-fitted onto current master (c5ec2392e).

#10077 removed the standalone re-query request and inlined both re-queries as loops over _recorded_responses(), so _resolve_tool_exec() no longer had a helper to wrap and no None short-circuit. This revision:

  • _requery_tool_params(payload, contexts=...) wraps _recorded_responses(payload, contexts=contexts, streaming=False) in the same AsyncRetrying policy the main step loop uses, and both call sites (initial re-query and the "stronger instruction" repair) pass their contexts through it.
  • _resolve_tool_exec() returns None again when every attempt comes back empty, and step() appends the same "no tool was executed" notice, so the light-schema call is still never executed with {} arguments.

Verified on Windows 11 x64 / Python 3.12: tests/test_tool_loop_agent_runner.py 82 passed; the four runner-related suites 196 passed; ruff check clean. With only the retry policy removed (single attempt), the three retry-dependent cases fail (3 failed, 1 passed) and the non-exception case still passes, which is the expected split.

The workflows on this branch are still action_required (first contribution) and need approval before they can report a result.

@sourcery-ai

sourcery-ai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Linked issues

Checked at commit 0361c8a

#10924 [Bug] skills_like 模式下工具重查询返回空输出会直接中断整轮 Agent,未复用主循环的空输出重试 · 1 of 2 met

# Requirement Status Notes
1 Retry empty skills_like parameter and repair re-queries using the main loop's retry count and backoff. ✅ Met Both re-query paths use _requery_tool_params(), which retries EmptyModelOutputError with EMPTY_OUTPUT_RETRY_ATTEMPTS and exponential backoff.
2 After retries are exhausted, continue using the previously parsed tool call rather than terminating the run. 🟡 Partly met The exception no longer terminates the run, but the previous tool call is not executed; the runner reports the failure and skips tool execution.

The skills_like re-query failure notice was appended to
run_context.messages directly, so the host conversation record never saw
it: every other framework-injected message goes through
_append_context_messages, which also emits context.appended.

Route it through the helper and assert the event carries the notice.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New gaps against the linked issues

@gongfpp

gongfpp commented Nov 16, 2026

Copy link
Copy Markdown
Author

Merged master (2d3384f1d) and fixed one thing my own revision got wrong.

The failure notice was appended with a raw run_context.messages.append(...). Since the event-log rework, every framework-injected message goes through _append_context_messages(), which also emits context.appended; a raw append leaves the message list right but the host conversation record never learns that no tool ran. It now goes through the helper, and test_skills_like_requery_failure_notice_reaches_conversation_sink asserts the context.appended payload carries the notice — reverting to the raw append makes that the only failure in the file.

83 passed for the file, 197 passed across the four suites; ruff check clean. ruff format --check still reports the file, but every hunk is in pre-existing code (the same file fails it on master with this ruff version), not in the added lines.

A non-raising empty reply leaves its message.appended staged in
_pending_assistant_event. Appending the failure notice first meant the
transcript could hold the notice with the reply it explains missing
entirely (never flushed in that turn).

Flush the pending reply before the notice; it is marked _no_save so it
still never enters future context.
@gongfpp

gongfpp commented Nov 16, 2026

Copy link
Copy Markdown
Author

Second fix pushed (baf29813f), same event-pipeline gap from the other side.

A non-raising empty reply only stages its message.appended in _pending_assistant_event. Appending the notice first left the transcript with the explanation and without the reply it explains — in this path the staged event was not flushed in that turn at all. Now the unusable reply is flushed first (still _no_save, so it never enters future context), and test_skills_like_requery_failure_notice_follows_every_recorded_reply asserts every settled reply reaches the transcript before the notice.

84 passed for the file, 198 passed across the four suites, ruff check clean. PR body updated.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

[Bug] skills_like 模式下工具重查询返回空输出会直接中断整轮 Agent,未复用主循环的空输出重试

2 participants