You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(e2b): transfer files via envd Filesystem REST API #3339
Single-file transfers go through shell+base64 over exec (33% inflation, per-argument length limits, 512KB truncation).
Additionally, filesystem calls must use the https://{port}-{sandboxId}.{domain} subdomain pattern (same as process calls): the https://sandbox.{domain} + header-routing form is rejected by self-hosted gateways with 400 {"error":"bad request"}.
Scope
Add E2bEnvdProcessClient.uploadFile (multipart POST) and downloadFile (GET) against /files, routed via envdHost(); keep E2b-Sandbox-Id/Port/X-Access-Token/Authorization headers. Plus unit tests.
Local branch: split/e2b-b-filesystem-rest (stacked on #3338's fix, split from #2196).
Category: enhancement | Status: Evaluated — mostly confirmed, one claim not reproducible from main (verified against main @ 525706267) | Feasibility: feasible | Severity: medium
Claim
Result
Evidence
Single-file transfers go through shell + base64 over exec
Confirmed
E2bSandbox extends AbstractBaseSandbox (E2bSandbox.java:42) and does not implement SandboxFileTransfer, so uploads fall back to building a one-file tar and calling hydrateWorkspace (SandboxBackedFilesystem.java:162-167, :261-280), and downloads run base64 <path> through exec (:197-213)
512 KB truncation
Confirmed, and it is the sharpest symptom
exec output is capped at OUTPUT_TRUNCATE_BYTES = 512 * 1024 (E2bEnvdProcessClient.java:55, applied :93-105, :400-403); a truncated download is not detected as partial data — the trimmed base64 is decoded and the failure surfaces downstream (SandboxBackedFilesystem.java:201-207)
~33% base64 inflation
Confirmed by construction
Base64.getEncoder().encodeToString(all) on the whole archive (E2bSandbox.java:159-187)
Per-argument length limits on upload
Partially
the E2B upload path already splits base64 into B64_CHUNK (4000-char) pieces written via python3 -c (E2bSandbox.java:159-187), so a single oversized argv entry is not what main does today; the cost is N sequential exec round trips instead
Filesystem calls must use https://{port}-{sandboxId}.{domain}
Not verifiable from main
main never issues a filesystem call: envdHost() already returns the subdomain form for process calls (E2bEnvdProcessClient.java:384-391) and uploadFile/downloadFile//files do not exist yet. The self-hosted-gateway 400 bad request behaviour is an external observation we cannot reproduce from source
Assessment. This is a well-scoped capability addition rather than a bug fix: implementing SandboxFileTransfer-style multipart upload/download against envd /files removes both the 512 KiB download ceiling and the multi-round-trip upload path, and it aligns E2B with KubernetesSandbox, which already has a native path. Keeping envdHost() as the single host builder for both process and filesystem calls is the right call, since the subdomain form is what main uses and validates today.
Open points for the PR to settle (not blockers for the direction):
Auth model for /files — X-Access-Token plus the Authorization: basicAuthUser(runUser) header are both sent on process calls today (:126-140); which does the Filesystem REST endpoint require on self-hosted envd?
Relative vs absolute paths and the fallback rule when a path is not absolute.
Streaming vs buffering — the upload path currently materializes the full archive in memory (archive.readAllBytes(), E2bSandbox.java:159-162); multipart still needs a bound.
Failure semantics: HTTP status vs error body, and whether a 413/gateway rejection falls back to exec or fails fast.
Test split: unit tests for URL/header construction plus an integration test gated on E2B credentials, matching the existing E2bEnvdProcessClientTest / E2bSandboxRecoveryTest layout.
Coordination:#3338 (the envd stream-parsing fix) is the base of this stack and already has PR #3341 open; #3340 is stacked on this issue. Since you stated you will submit the PR, we are not generating one here — reply /approve if you would rather have an automated fix proposal from us.
Proposal window closed — no automated PR will be generated, and no competing PR will be filed from this proposal window
The 72 h feedback window opened by the evaluation above (5871815695, posted 2026-09-28T14:18:24Z) reached its bound on 2026-10-01T14:18:24Z. Between the gate and that bound the thread received one non-maintainer comment (5878113443, @shleder, 2026-09-28T20:40:50Z) that carried none of the three feedback commands, so the window closes unanswered and automated PR generation for this issue is skipped.
This is not a case of an unowned fix path. Community PR #3343 (feat(e2b): transfer files via envd Filesystem REST API [2/3], authored by @chcodex) cross-references this issue and implements exactly the seam the evaluation described — envd Filesystem REST transfer as the native path, stacked on the #3338/#3341 work. As of this read #3343 is open, not a draft, unmerged (merged_at: null), head 8fd39b3270c50007f6e6555bed61583e8f3ffe95, last updated 2026-09-28T16:36:32Z. Filing a second PR against the same seam is the duplicate-fix collision this window policy exists to prevent, which is why the proposal is stood down rather than escalated.
The reporter also stated in the issue that they would submit the PR themselves, which is what the evaluation above deferred to; nothing here changes that.
Nothing in this notice disputes the evaluation. The confirmed findings stand on main: single-file uploads fall back to tar + hydrateWorkspace and downloads to base64 through exec, E2bSandbox does not implement SandboxFileTransfer, and the OUTPUT_TRUNCATE_BYTES = 512 * 1024 ceiling on exec output makes an oversized download a silent truncation that only fails downstream. The open points recorded there — the auth model for /files, relative-vs-absolute path handling and the fallback rule, streaming versus buffering bounds, HTTP-status versus error-body failure semantics, and the unit/integration test split — remain the useful review checklist for #3343.
The productive thread now is review of #3343: merge it, request changes, or close it. If #3343 is closed unmerged and this capability is still wanted, say so on this issue and the question will be re-evaluated against whatever main looks like at that point. No action is needed from anyone else, and this issue remains open as a feature request.
Automated feedback-window maintenance by github-manager-bot
Some measurements that may help prioritize this, from Alibaba Cloud Agent Sandbox (E2B protocol, cn-hangzhou, agentscope-extensions-sandbox-e2b 2.0.3):
With the current 4000-char base64 chunks over envd process calls, uploading a ~300 KB workspace projection (skills) takes about 9 s, and restoring a workspace of similar size from a snapshot is in the same range. Downloading (persisting the snapshot via tar to stdout) is fast by comparison.
As an experiment, writing a 1 MB file via exec with ~96 KB base64 chunks (just under Linux's 128 KB per-argument limit) took 1.1–2.5 s, i.e. roughly 5x faster than 4000-char chunks.
So the transfer path dominates cold-start time whenever a sandbox is (re)created; a native file API as proposed here would remove most of it.
Activity
oss-maintainer commentedon Sep 28, 2026
Issue Evaluation
Category:
enhancement| Status: Evaluated — mostly confirmed, one claim not reproducible frommain(verified againstmain@525706267) | Feasibility: feasible | Severity: mediumE2bSandbox extends AbstractBaseSandbox(E2bSandbox.java:42) and does not implementSandboxFileTransfer, so uploads fall back to building a one-file tar and callinghydrateWorkspace(SandboxBackedFilesystem.java:162-167,:261-280), and downloads runbase64 <path>through exec (:197-213)OUTPUT_TRUNCATE_BYTES = 512 * 1024(E2bEnvdProcessClient.java:55, applied:93-105,:400-403); a truncated download is not detected as partial data — the trimmed base64 is decoded and the failure surfaces downstream (SandboxBackedFilesystem.java:201-207)Base64.getEncoder().encodeToString(all)on the whole archive (E2bSandbox.java:159-187)B64_CHUNK(4000-char) pieces written viapython3 -c(E2bSandbox.java:159-187), so a single oversized argv entry is not whatmaindoes today; the cost is N sequential exec round trips insteadhttps://{port}-{sandboxId}.{domain}mainmainnever issues a filesystem call:envdHost()already returns the subdomain form for process calls (E2bEnvdProcessClient.java:384-391) anduploadFile/downloadFile//filesdo not exist yet. The self-hosted-gateway400 bad requestbehaviour is an external observation we cannot reproduce from sourceAssessment. This is a well-scoped capability addition rather than a bug fix: implementing
SandboxFileTransfer-style multipart upload/download against envd/filesremoves both the 512 KiB download ceiling and the multi-round-trip upload path, and it aligns E2B withKubernetesSandbox, which already has a native path. KeepingenvdHost()as the single host builder for both process and filesystem calls is the right call, since the subdomain form is whatmainuses and validates today.Open points for the PR to settle (not blockers for the direction):
/files—X-Access-Tokenplus theAuthorization: basicAuthUser(runUser)header are both sent on process calls today (:126-140); which does the Filesystem REST endpoint require on self-hosted envd?archive.readAllBytes(),E2bSandbox.java:159-162); multipart still needs a bound.errorbody, and whether a413/gateway rejection falls back to exec or fails fast.E2bEnvdProcessClientTest/E2bSandboxRecoveryTestlayout.Coordination: #3338 (the envd stream-parsing fix) is the base of this stack and already has PR #3341 open; #3340 is stacked on this issue. Since you stated you will submit the PR, we are not generating one here — reply
/approveif you would rather have an automated fix proposal from us.Automated evaluation by github-manager-bot
oss-maintainer commentedon Oct 1, 2026
Proposal window closed — no automated PR will be generated, and no competing PR will be filed from this proposal window
The 72 h feedback window opened by the evaluation above (
5871815695, posted 2026-09-28T14:18:24Z) reached its bound on 2026-10-01T14:18:24Z. Between the gate and that bound the thread received one non-maintainer comment (5878113443, @shleder, 2026-09-28T20:40:50Z) that carried none of the three feedback commands, so the window closes unanswered and automated PR generation for this issue is skipped.This is not a case of an unowned fix path. Community PR #3343 (
feat(e2b): transfer files via envd Filesystem REST API [2/3], authored by @chcodex) cross-references this issue and implements exactly the seam the evaluation described — envd Filesystem REST transfer as the native path, stacked on the #3338/#3341 work. As of this read #3343 is open, not a draft, unmerged (merged_at: null), head8fd39b3270c50007f6e6555bed61583e8f3ffe95, last updated 2026-09-28T16:36:32Z. Filing a second PR against the same seam is the duplicate-fix collision this window policy exists to prevent, which is why the proposal is stood down rather than escalated.The reporter also stated in the issue that they would submit the PR themselves, which is what the evaluation above deferred to; nothing here changes that.
Nothing in this notice disputes the evaluation. The confirmed findings stand on
main: single-file uploads fall back to tar +hydrateWorkspaceand downloads tobase64through exec,E2bSandboxdoes not implementSandboxFileTransfer, and theOUTPUT_TRUNCATE_BYTES = 512 * 1024ceiling on exec output makes an oversized download a silent truncation that only fails downstream. The open points recorded there — the auth model for/files, relative-vs-absolute path handling and the fallback rule, streaming versus buffering bounds, HTTP-status versus error-body failure semantics, and the unit/integration test split — remain the useful review checklist for #3343.The productive thread now is review of #3343: merge it, request changes, or close it. If #3343 is closed unmerged and this capability is still wanted, say so on this issue and the question will be re-evaluated against whatever
mainlooks like at that point. No action is needed from anyone else, and this issue remains open as a feature request.Automated feedback-window maintenance by github-manager-bot
xuchaoguo1983 commentedon Oct 3, 2026
Some measurements that may help prioritize this, from Alibaba Cloud Agent Sandbox (E2B protocol, cn-hangzhou, agentscope-extensions-sandbox-e2b 2.0.3):
tarto stdout) is fast by comparison.execwith ~96 KB base64 chunks (just under Linux's 128 KB per-argument limit) took 1.1–2.5 s, i.e. roughly 5x faster than 4000-char chunks.So the transfer path dominates cold-start time whenever a sandbox is (re)created; a native file API as proposed here would remove most of it.
feat(e2b): transfer files via envd Filesystem REST API [2/3] (agentsc…
feat(e2b): route native file transfer through SandboxFileTransfer [3/…