Skip to content

fix(e2b): add connect json codec support#1844

Merged
chickenlj merged 5 commits into
agentscope-ai:mainfrom
guslegend0510:fix/issue-1842-e2b-envd-codec
Jun 25, 2026
Merged

fix(e2b): add connect json codec support#1844
chickenlj merged 5 commits into
agentscope-ai:mainfrom
guslegend0510:fix/issue-1842-e2b-envd-codec

Conversation

@guslegend0510

Copy link
Copy Markdown
Contributor

Summary

Fix E2B envd command execution for environments that only accept application/connect+json (for example Alibaba Cloud FC envd v0.5.2).

Changes

  • Add E2bCodec with default PROTO
  • Make E2bFilesystemSpec / E2bSandboxClientOptions configurable for codec selection
  • Persist codec through E2bSandboxClient / E2bSandboxState
  • Update E2bEnvdProcessClient to emit connect+json requests and parse JSON responses when configured
  • Add focused tests for proto/json request envelope and response frame parsing

Verification

  • mvn -DskipTests compile
  • mvn test -Dtest=E2bEnvdProcessClientTest,E2bSnapshotRefsTest

Closes #1842

@guslegend0510 guslegend0510 requested a review from a team June 20, 2026 14:52
@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

@AgentScopeJavaBot AgentScopeJavaBot added bug Something isn't working area/extensions agentscope-extensions (general) labels Jun 21, 2026

@AgentScopeJavaBot AgentScopeJavaBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Review

This PR adds application/connect+json codec support for the E2B envd process.Process/Start endpoint, enabling compatibility with envd implementations (e.g., Alibaba Cloud FC envd v0.5.2) that only accept JSON. The change is well-structured: a new E2bCodec enum is threaded through E2bSandboxClientOptions, E2bSandboxState, and E2bFilesystemSpec; the core encoding/decoding logic in E2bEnvdProcessClient branches on the codec with clean helper methods; backward compatibility is preserved (default remains PROTO). Tests cover the key happy-path scenarios. One defensive-programming gap around Base64 decoding and a minor test-coverage gap are noted below.

@AgentScopeJavaBot AgentScopeJavaBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Review

This PR adds application/connect+json codec support for the E2B envd process.Process/Start endpoint, enabling compatibility with envd implementations (e.g., Alibaba Cloud FC envd v0.5.2) that only accept JSON. The change is well-structured: a new E2bCodec enum is threaded through E2bSandboxClientOptions, E2bSandboxState, and E2bFilesystemSpec; the core encoding/decoding logic in E2bEnvdProcessClient branches on the codec with clean helper methods; backward compatibility is preserved (default remains PROTO). Tests cover the key happy-path scenarios. One defensive-programming gap around Base64 decoding and a minor test-coverage gap are noted below.

@AgentScopeJavaBot AgentScopeJavaBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All previously raised review comments have been addressed.

@chickenlj chickenlj merged commit f048a78 into agentscope-ai:main Jun 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/extensions agentscope-extensions (general) bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: E2bFilesystemSpec 在阿里云 FC 部署的 envd 上无法执行命令 — Connect+protobuf codec 不被支持

4 participants