fix(harness): fail sandbox filesystem read ops on non-successful execute responses - #2967
Open
Buktal wants to merge 1 commit into
Open
fix(harness): fail sandbox filesystem read ops on non-successful execute responses#2967Buktal wants to merge 1 commit into
Buktal wants to merge 1 commit into
Conversation
…ute responses BaseSandboxFilesystem's read paths (ls/read/grep/glob) parsed output without consulting the exit code, so sandbox execution failures — backend errors mapped to -1, timeouts mapped to 124, unknown codes — were masked as successful results (e.g. a backend timeout reported to the model as 'Empty directory'). All read methods now fail on any non-successful response, riding FilesystemTool's existing error branch. Failure messages carry operation context and fall back to the exit code when the response has no diagnostic output, so a null-output failure cannot collapse back into a success. The binary read keeps its designed file_not_found signal for positive exit codes other than 124 (timeout(1) convention), where the command ran and base64 could not read the file. Fixes agentscope-ai#2961
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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
main @
ea511ec2(defect observed in production on 2.0.1)Description
Fixes #2961
BaseSandboxFilesystem's read paths (ls/read/grep/glob) parsedoutputwithout consulting the exit code, so any non-successfulexecute()response was masked as a successful result — a sandbox-backend timeout surfaced to the model asEmpty directory: <path>, the raw error text as file content (read), or as fabricated file paths (glob).Changes
fail(...)on!ExecuteResponse.isSuccess(), ridingFilesystemTool's existing"Error: ..."branch (the same path fix(harness): make ls() report errors instead of silently returning empty results #2413 established for not-exists / not-a-directory). These methods' shell commands are constructed to exit 0 on every designed path, so any non-successful response meansoutputis not the protocol output the parsers expect.Error listing '<path>': ...) and fall back to the exit code when the response carries no diagnostic output — a null-output failure can no longer collapse back into a "success" (error == null).readkeeps its designedfile_not_foundsignal for positive exit codes other than 124 (timeout(1)convention), where the command ran andbase64could not read the file; null/negative/124 surface the execution-layer message instead.AbstractSandboxFilesystem.execute()Javadoc documents the non-success contract.nullexit code, 124 timeout, positive command failure) across all read methods.How to test
mvn -pl agentscope-harness test -Dtest=BaseSandboxFilesystemTest— 21 tests (16 run on non-Linux; 5 are the pre-existing Linux-only shell integration cases).Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test)