fix: continue pipeline after TTS fallback#9166
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds a yield statement at the end of the process method in ResultDecorateStage to ensure the fallback result is yielded after a TTS failure, and introduces a corresponding unit test to verify this behavior. The reviewer pointed out that a similar issue remains in the Text-to-Image (T2I) fallback path, where an early return in the exception handler prevents the execution from reaching the newly added yield statement.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Modifications / 改动点
Fixes #9131.
ResultDecorateStage.process()is an async generator, and the scheduler only continues to the following stages when the generator yields. When TTS failed, the fallback text was left inresult.chain, but the stage completed without yielding, soRespondStagewas not reached.This keeps the existing early returns for empty results, streaming results, stopped events, and t2i failures unchanged.
Screenshots or Test Results / 运行截图或测试结果
.venv/bin/pytest tests/test_qqofficial_group_message_create.py::test_result_decorate_yields_after_tts_fallback -q(failed before the fix withassert 0 == 1, passed after the fix).venv/bin/pytest tests/test_qqofficial_group_message_create.py::test_result_decorate_segments_qqofficial_ws_plain_result tests/test_qqofficial_group_message_create.py::test_result_decorate_yields_after_tts_fallback -q.venv/bin/pytest tests/test_qqofficial_group_message_create.py -q.venv/bin/ruff check astrbot/core/pipeline/result_decorate/stage.py tests/test_qqofficial_group_message_create.py.venv/bin/ruff format --check astrbot/core/pipeline/result_decorate/stage.py tests/test_qqofficial_group_message_create.pygit diff --checkNote: I used Codex while preparing this change, reviewed the final diff, and ran the listed checks locally.
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 have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in
requirements.txtandpyproject.toml./ 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到
requirements.txt和pyproject.toml文件相应位置。😮 My changes do not introduce malicious code.
/ 我的更改没有引入恶意代码。
Summary by Sourcery
Ensure the result decoration stage always yields once after decorating non-empty results so downstream response handling continues, even when TTS falls back.
Bug Fixes:
Tests: