Repository navigation
fix: retry a live command result that is still being written - #788
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
read_from_file stopped polling on any non-empty output and parsed it after the loop, so reading a result file while Lean was writing it raised JSONDecodeError. Parse inside the loop and read again until the timeout.
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 #784
Root cause:
DockerManager.read_from_filestopped polling on any non-empty output and parsed the JSON after the loop. Lean writes the result file withFile.WriteAllText, so a read that overlaps the write can see a prefix, which aborted the command withJSONDecodeErroreven though the full result would have been there within the timeout.Fix: parse inside the polling loop. Incomplete JSON now goes through the existing error handling, which sleeps for
intervaland reads again, bounded bytimeout. A complete result is still returned immediately and clears any earlier transient error. A file that stays invalid until the timeout returns a failed result with the parse error instead of raising.Tests: two tests for a partial read followed by the full result, and for a result that stays incomplete. Both fail before the change with
JSONDecodeErrorand pass after;tests/components/docker/test_docker_manager.pyandtests/commands/livepass.This change was prepared with AI assistance.