fix: handle queue.Empty in task mode to prevent crash on LLM timeout#291
Open
Jeason00011 wants to merge 1 commit intolsdefine:mainfrom
Open
fix: handle queue.Empty in task mode to prevent crash on LLM timeout#291Jeason00011 wants to merge 1 commit intolsdefine:mainfrom
Jeason00011 wants to merge 1 commit intolsdefine:mainfrom
Conversation
The reflect mode already catches this exception, but task mode did not, causing an unhandled crash when LLM response exceeds 120s between chunks. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
63312a1 to
ae81626
Compare
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.
Problem
--taskmode crashes with unhandledqueue.Emptywhen LLM response has no chunk output for 300s.Trigger:
stream=False+ slow model (queuing/rate-limited), or network stall where TCP hasn't timed out yet.Evidence: reflect mode already handles this
Same pattern, same timeout mechanism, but wrapped in try/except. Task mode was missed.
Fix
Add try/except around the task mode drain loop. On timeout, write error to output file and break gracefully (consistent with reflect mode behavior).
Discovery
Found by systematic code health scan — checking symmetric code paths for inconsistent error handling (hint from repo maintainer to inspect the dual-mode pattern).