feat: recover empty and stalled responses - #4
Open
wuxiaoqiang12 wants to merge 5 commits into
Open
Conversation
added 2 commits
August 11, 2026 12:47
Track assistant output evidence and retry strict empty unknown completions after idle. Prevent retries while aborted or waiting for questions and permissions, and cover the recovery flow with tests. Signed-off-by: XiaoqiangWu <wuxiaoqiang.rtos@huawei.com>
Abort busy requests that produce no assistant activity for 200 seconds, then continue after idle. Preserve user abort handling and cancel the watchdog on output, questions, permissions, or tool activity. Signed-off-by: XiaoqiangWu <wuxiaoqiang.rtos@huawei.com>
added 3 commits
August 11, 2026 20:50
Some OpenCode versions complete empty assistant messages without emitting an idle event. Trigger the existing guarded recovery path when the final unknown completion arrives and cover the behavior with a regression test. Signed-off-by: XiaoqiangWu <wuxiaoqiang.rtos@huawei.com>
OpenCode can update the original user message summary after an empty assistant completion. Track the active user message ID so duplicate updates do not reset the turn and cancel the queued retry. Signed-off-by: XiaoqiangWu <wuxiaoqiang.rtos@huawei.com>
Providers can emit partial text while completing a response with an unknown finish and zero output tokens. Treat these abnormal completions as recoverable so auto-continue matches the tab status warning. Signed-off-by: XiaoqiangWu <wuxiaoqiang.rtos@huawei.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
finish: "unknown", zero output tokens, no text, and no explicit errorcontinueafter idleretryEmptyResponsesandstalledRequestTimeoutMs, and commit rebuiltdistartifactsMotivation
Some provider failures do not emit a retryable
session.error. One observed failure records an assistant message withfinish: "unknown", zero output tokens, and no text, then emitssession.idle. Another leaves the session busy for an unusually long time without producing any assistant activity. Both cases stop useful progress until the user manually aborts and enterscontinue.This change uses strict per-turn evidence to distinguish completed empty responses and stalled first responses from normal replies, tool calls, user aborts, questions, and permission prompts. The stalled watchdog defaults to 200 seconds and can be disabled with
stalledRequestTimeoutMs: 0.Verification
bun test(21 tests passed)bun run checkbun run build/acand/auto-continueregistration