Repository navigation
End the run after repeated failed reads instead of spinning forever - #177
Merged
Merged
Conversation
…ver [patch] With stdin redirected, Console.ReadKey throws InvalidOperationException on every call. The input loop treated that as recoverable and retried at once, so RunAsync spun a core at ~200k reads a second and never returned. Failed reads are now counted, and after MaxConsecutiveReadFailures in a row the exception propagates out of RunAsync, which restores the cursor as usual. A successful read resets the count, and errors from handling input are not counted. Fixes #143 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCL6GX9wshgqiBeq6z98ZH
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCL6GX9wshgqiBeq6z98ZH
|
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.



Fixes #143
What changed
When stdin is redirected,
Console.ReadKeythrowsInvalidOperationExceptionon every call.ProcessInputAsynctreated that as recoverable and retried immediately, soRunAsyncnever returned and kept one core at 100%.MaxConsecutiveReadFailures(10) in a row, the exception propagates out ofRunAsync. The existingfinallystill restores the cursor.Tests
New
UIApplicationReadFailureTests:AReadThatAlwaysFailsEndsTheRun: with a provider whose reads always fail, the run ends withInvalidOperationExceptionwithin a bounded number of reads, and the cursor is visible again. Before the fix this failed because the run never ended. The test starts the run on the thread pool and cancels it on timeout, so a regression fails the test instead of hanging it.AFewFailedReadsDoNotEndTheRun: two failed reads followed by an exit key still end the run normally.The full suite passes (211/211).
🤖 Generated with Claude Code
https://claude.ai/code/session_01VCL6GX9wshgqiBeq6z98ZH
Generated by Claude Code