fix(harness): use real newlines in sandbox edit python -c - #2573
Open
jialiuyang wants to merge 2 commits into
Open
fix(harness): use real newlines in sandbox edit python -c#2573jialiuyang wants to merge 2 commits into
jialiuyang wants to merge 2 commits into
Conversation
BaseSandboxFilesystem.edit() joined the python3 -c program with Java "\\n", which emits a literal backslash-n. POSIX shells pass that through, so Python raises SyntaxError before any file is touched. Use real newlines and surface non-zero exit codes instead of "unexpected server response". Fixes agentscope-ai#2571
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Raise patch coverage for the sandbox edit exit-code guard (null exitCode, null output, and long stderr truncation).
oss-maintainer
left a comment
Collaborator
There was a problem hiding this comment.
Summary
This PR modifies 2 files with 161 lines of diff.
Observations
- Files changed: 2
- Test coverage: ✅ Tests included
- CLA:
⚠️ Not signed / Unknown
Suggestions
- Please ensure all public API changes are backward compatible
- Consider adding unit tests for new logic paths
Automated review by github-manager-bot
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.
AgentScope-Java Version
2.0.x (main)
Description
BaseSandboxFilesystem.edit()built thepython3 -cprogram by joining lines with Java\"\\\\n\", which emits a literal backslash-n. On a POSIX sandbox shell that string is passed to Python unchanged and raisesSyntaxError, soreplaceAll=false(the defaultedit_filepath) never touches the target file.This change uses real newlines in the
-cprogram and fails fast whenexecutereturns a non-zero exit code, instead of reportingunexpected server response.ls/globprintf escapes andjsonEscapeare intentionally unchanged.Fixes #2571
Checklist
mvn spotless:applyBaseSandboxFilesystemTest)