Skip to content

Conversation

@chahn
Copy link
Contributor

@chahn chahn commented Nov 11, 2025

Summary

This PR strengthens the WasmExecutor’s portability, standard-library handling, isolation, and failure visibility.

  • Automatically detect the Deno cache directory by calling deno info --json and feed that path into the --allow-read/--allow-write flags instead of hard-coding ~/.cache/deno, which fixes macOS errors caused by Deno storing its cache under ~/Library/Caches/deno. This makes the executor portable across Linux and macOS.
  • Bind the Deno bridge to a free port via the new find_free_port, inject that port into the runner JS/permission list, and poll the HTTP server for readiness (with logging and timeouts) so multiple WasmExecutors can coexist without collisions and we catch startup regressions immediately.
  • Prevent micropip from choking on stdlib modules (e.g., json) by adding a Pyodide-side getMissingPackages helper that filters additional_authorized_imports through importlib.util.find_spec, so only truly missing packages reach micropip while stdlib entries remain listed in the agent's system prompt.
  • Make package failures impossible to miss by installing via micropip, returning HTTP 500 responses when any package fails, calling micropip.destroy() afterward, and raising an AgentError on the smolagents/Python side so agents now surface actionable errors instead of silently skipping dependency errors.
  • Update the WasmExecutor unit test so it mocks both deno --version and deno info --json plus the dynamic port helper, keeping the new cache-directory detection covered without touching real sockets or Deno installs.
  • Doc: Update the secure-execution tutorial with a WasmExecutor cleanup tip so Deno sandboxes shut down cleanly after agent runs.
  • No breaking changes

Thank you for reviewing this PR, and especially for your feedback and support!

…ng 'deno info --json' command, improving permission handling for Deno execution.
- Introduced `find_free_port` function to dynamically find an available port.
- Updated `WasmExecutor` to use the dynamically allocated port for server communication.
- Enhanced server readiness check with a retry mechanism instead of a fixed sleep.
- Adjusted JavaScript runner file creation to incorporate the dynamic port.
…after failures and return detailed error responses
…ready importable modules before installation, enhancing efficiency and error handling during package loading.
- Updated test to mock subprocess calls for Deno version and info retrieval.
- Enhanced assertions to verify the correct number of calls and arguments for Deno commands.
- Introduced a mock for dynamic port allocation in the test setup.
@chahn
Copy link
Contributor Author

chahn commented Nov 13, 2025

Rebased on latest main to incorporate recent upstream changes.

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.

1 participant