Skip to content

fix(harness): strip base64 line wrapping in sandbox binary reads (#3966) - #4196

Merged
juruoO-o merged 1 commit into
agentscope-ai:mainfrom
aiyili:fix/sandbox-base64-wrap
Nov 19, 2026
Merged

juruoO-o merged 1 commit into
agentscope-ai:mainfrom
aiyili:fix/sandbox-base64-wrap

Conversation

@aiyili

@aiyili aiyili commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Reading a binary file through a sandbox filesystem returns a payload with embedded newline characters.

Root cause: POSIX base64 wraps output at 76 columns with newline separators, but BaseSandboxFilesystem.read only .strip()s the outer edges before handing the string to FileData(content, "base64"). The local and remote backends emit single-line base64 (Base64.getEncoder().encodeToString), so the sandbox backend is both inconsistent across backends and undecodable with the strict Base64.getDecoder() (which rejects line separators), while the model also sees broken payload text.

Fix

Strip all whitespace from the command output before constructing FileData — the POSIX base64 output is exactly the base64 alphabet plus separators, so \\s+ removal changes nothing for well-formed payload bytes.

Regression

read_binary_wrappedBase64Output_strippedToSingleLinePayload: an 80-byte fixture force-wrapped by Base64.getMimeEncoder(76, newline) must come back single-line and round-trip through the strict Base64.getDecoder().

Full harness module suite green on the merged batch state (1833/1833).

)

- POSIX base64 按 76 列换行输出;read 的 FileData 只 strip 首尾,
  内嵌 \n 留在载荷中,严格 Base64 解码器直接失败,模型侧也看到断行
- 全部空白剥离后与 local/remote 后端的单行载荷对齐
- 回归:MIME 编码器强制换行的 80 字节 fixture,断言载荷单行且
  严格解码器可完整还原
aiyili added a commit to aiyili/agentscope-java that referenced this pull request Nov 15, 2026
The ubuntu job failed on RocketMqExecutionTest.agentScopeResumesThroughSeparateLedgersDespitePublicationAndAckFailures (polling deadline 'Condition did not become true', 10s await under CI load). The test lives in the durable-rocketmq extension, references no HarnessAgent API, and passed on the sibling PR runs (agentscope-ai#4194/agentscope-ai#4196) minutes earlier — a timing flake, not a regression from this diff. Re-triggering CI.
@jujn jujn added the P0 重要紧急 label Nov 16, 2026
@juruoO-o
juruoO-o merged commit d96aea9 into agentscope-ai:main Nov 19, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P0 重要紧急

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants