[Bug]: Resolving directory symlinks drops COPY contents and cache inputs
Environment
Current main 3e72be3f08ec1a258ec0253c153df7ceed739f10, Python SDK/JS SDK 2.63.0, macOS, Python 3.12.13 and Node 24.15.0.
Timestamp and frequency
2026-11-13, Asia/Shanghai. Reproduces every time in a local test.
Expected behavior
Template.copy(..., resolve_symlinks=True) / resolveSymlinks: true should copy a linked directory's files and include those files in the build-cache hash. The default false setting should preserve the symlink.
Actual behavior
The linked directory is uploaded as an empty directory. Changing a target file does not change the upload hash, so a build can omit the files or reuse the empty layer.
Reproduction
Create real/app.py and a relative directory symlink linked -> real in the template context, then build:
from e2b import Template
context = "/path/to/context"
template = Template(file_context_path=context).from_python_image("3").copy(
"linked", "/app", resolve_symlinks=True,
)
Template.build_in_background(template, "directory-link-repro")
Equivalent JS: new Template({ fileContextPath: context }).fromPythonImage('3').copy('linked', '/app', { resolveSymlinks: true }) with Template.buildInBackground.
I reproduced this with the real public sync/async Python and JS build interfaces against a loopback HTTP API/upload fixture. The fixture replaces only E2B's cloud endpoints; file discovery, hashing, archive construction, HTTP upload and archive inspection actually run. No cloud sandbox/image execution was tested. Received tar members for the linked source: linked (directory), with no linked/app.py. The same SDK flow with real includes real/app.py; resolve_symlinks=False correctly sends a symlink.
Cause and next step
Both hashing and upload use a file-discovery helper that does not traverse directory symlinks, even when the caller enables resolution. I am preparing a focused fix for both SDKs, retaining ignore rules and rejecting cyclic directory links. Regression coverage exercises public builds and cache invalidation. OpenAI Codex assisted this investigation.
Triage
- type: bug
- priority: medium
- complexity: small
- affected_area: js-sdk/template + python-sdk/template (copy file discovery, hashing & upload)
- actionable: yes
- needs_clarification: false
- summary:
Template.copy(..., resolve_symlinks=True)/resolveSymlinks: trueuploads a directory symlink as an empty directory and leaves the linked files out of the build-cache hash, in both the JS and Python (sync/async) SDKs, so builds can miss the files or reuse a stale layer; the reporter has a clear repro and says a fix is in progress.