Chunk very long commands when writing file. #247
Merged
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.
This pull request introduces improvements to file writing in the workspace and enhances the logger's debug mode activation. The most significant changes are the addition of chunked file writing to handle large contents, more robust detection of debug mode via environment variables, and expanded test coverage for edge cases in file writing.
Workspace file writing improvements:
write_filemethod indebug_gym/gym/workspace.pynow splits content into 32kB chunks when writing to files, ensuring compatibility with shell command length limits and supporting very large files.Logger enhancements:
debug_gym/logger.pyis now activated if theDEBUG_GYM_DEBUGenvironment variable matches common truthy values like"1","true","yes", or"on", making it more flexible and user-friendly.Test coverage improvements:
test_write_fileintests/gym/test_workspace.pynow includes checks for writing empty content and very large content (2MB), verifying that the new chunked writing logic works correctly for these edge cases.Closes #245