fix(#2397): replace inline python3 edit with download-edit-upload [FaaFyfxR9WAQrL7FcAgEHJvztd8cVMxvjHRS55rw1nwH] - #2436
Open
waterWang wants to merge 1 commit into
Conversation
…it-upload [FaaFyfxR9WAQrL7FcAgEHJvztd8cVMxvjHRS55rw1nwH]
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
This comment was marked as abuse.
This comment was marked as abuse.
oss-maintainer
suggested changes
Jul 28, 2026
oss-maintainer
left a comment
Collaborator
There was a problem hiding this comment.
Review: fix(#2397): replace inline python3 edit with download-edit-upload
The approach is correct — replacing the fragile inline python3 -c script with a download → edit → upload pipeline eliminates:
- The
\nvs newline interpretation issue - Incomplete JSON escaping (
jsonEscape()missing control chars) - Hard dependency on
python3in sandbox images
However, CI is failing due to Spotless formatting violations in BaseSandboxFilesystem.java. Please run mvn spotless:apply and push the fix.
Code observations
- Clean removal of
jsonEscape()andBase64import — good cleanup - Error handling for download/upload failures is thorough
- Using
FilesystemUtils.performStringReplacement()reuses existing tested logic
Once formatting is fixed, this should be good to merge.
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.
Description
Fixes #2397
Restructures
BaseSandboxFilesystem.edit()to usedownloadFiles()→FilesystemUtils.performStringReplacement()→uploadFiles()instead of executing an inline Python script viapython3 -c.Problems Fixed
\\nnot recognized as newline bypython3 -c— The old code used literal backslash+n to represent newlines in the Python script, butpython3 -ctreats\nas a line continuation character, causingSyntaxError.jsonEscape()only escaped\,",\n,\r,\t, missing other JSON control characters (U+0000-U+0008, U+000B, U+000C, U+000E-U+001F). The new approach uses Java'sString.replace()viaFilesystemUtils.performStringReplacement().python3in sandbox images —edit()was the only method requiringpython3in the sandbox image. All other methods (ls/grep/glob/write/read) use pure shell commands or the upload API. The fix removes this dependency.Changes
BaseSandboxFilesystem.java: Rewroteedit()to download → edit → upload; removedjsonEscape()method; replacedimport java.util.Base64withimport java.nio.charset.StandardCharsetsTesting
python3can now useedit()Wallet: FaaFyfxR9WAQrL7FcAgEHJvztd8cVMxvjHRS55rw1nwH