Skip to content

fix(sandbox): preserve zero exit code in E2B JSON stream - #2609

Draft
ump45nose wants to merge 1 commit into
agentscope-ai:mainfrom
ump45nose:fix/e2b-json-zero-exit-code
Draft

fix(sandbox): preserve zero exit code in E2B JSON stream#2609
ump45nose wants to merge 1 commit into
agentscope-ai:mainfrom
ump45nose:fix/e2b-json-zero-exit-code

Conversation

@ump45nose

Copy link
Copy Markdown

AgentScope-Java Version

2.0.1-SNAPSHOT

Description

Fixes #2603.

In E2bCodec.JSON mode, an explicit {"end":{"exitCode":0}} frame was lost twice because proto3 does not include default scalar values in getAllFields() and reports no scalar presence through hasField(). As a result, successful commands kept the missing-exit sentinel and failed.

This change:

  • attaches the JSON end event when an integer exitCode was explicitly parsed, including zero;
  • reads the proto3 default scalar from the present end event instead of checking scalar presence;
  • adds a focused regression test for a zero exit code.

Related duplicate reports: #2601, #2602.

Tested with:

mvn -pl agentscope-extensions/agentscope-extensions-sandbox/agentscope-extensions-sandbox-e2b -am -Dtest=E2bEnvdProcessClientTest -Dsurefire.failIfNoSpecifiedTests=false test

Result: 8 tests passed, including jsonCodecPreservesZeroExitCode.

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with mvn spotless:apply
  • All targeted tests are passing
  • Javadoc comments are complete and follow project conventions (no public API changes)
  • Related documentation has been updated (not applicable; behavior fix with regression coverage)
  • Code is ready for review

@CLAassistant

CLAassistant commented Aug 7, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

E2bCodec.JSON mode fails on every successful command due to proto3 default-value semantics

2 participants