Agent Sandbox Registry

agent-sandbox

Python SDK defect fixes the Node API layer must replicate (after the parity gate)

无中文版

parity/sdk-defect-fixes.md

Python SDK defect fixes the Node API layer must replicate (after the parity gate)

The Python SDK (python-sdk/client-sdk) fixed the defects python-sdk/e2e/KNOWN-ISSUES.md records as KI-001 .. KI-007 and KI-010 (they exist in the original v0.2.0 code that is the parity oracle of this CLI). The TypeScript port in cli/src/{api,protocol,transport} mirrors the original behaviour and was deliberately not changed. After the parity gate, apply the changes below so the Node API layer behaves like the fixed SDK. Every wire shape was captured from a real envd 0.5.2 sandbox; the Python regression tests are in python-sdk/client-sdk/tests/test_known_issues/ (copy their request/response fixtures into the vitest suite: helpers.py has the exact frames).

Nothing here touches cli/; this file is the only addition. Python files named below are in python-sdk/client-sdk/src/agent_sandbox/.

Summary table

KI TS place to change Python reference CLI-visible effect
001 protocol/process.ts ProcessProtocol.start protocol/process.py::ProcessProtocol.start per-call env (SDK / MCP run_command envs) reaches the command
002 protocol/filesystem.ts _parseFileInfo, stat (+ new _unwrapEntry, _parseSize) protocol/filesystem.py::_parse_file_info/_unwrap_entry abx sandbox files list / stat and MCP list_files show directory, real name/path/size
003 protocol/process.ts start (new guard generator), transport/http.ts envdStream protocol/process.py::_guard_command_timeout, transport/http.py::envd_stream timeout of a silent command is exit 5 E3001 "Command did not finish within Ns" instead of "Request timed out"
004 protocol/process.ts connectToProcess, update, sendInput, sendSignal, kill, sendStdin protocol/process.py abx sandbox process signal actually signals; stdin reaches the process; --signal other than 9/15 is an error
005 protocol/filesystem.ts (all envd calls), protocol/sandbox.ts, models/errors.ts, cli/src/cli/main.ts protocol/filesystem.py::_raise_file_error, protocol/sandbox.py::_sandbox_request, models/errors.py::SandboxNotFoundError exit 4 kept, but code/text change (E4001 / E2009 instead of E5000 "Resource not found (HTTP 404)")
006 transport/http.ts platformRequest transport/http.py::HttpClient.platform_request/_authentication_error exit 3 kept; message/code change (E1001/E1003 instead of the generic E1000 text)
007 protocol/filesystem.ts listDir protocol/filesystem.py::list_dir abx sandbox files list of a missing directory exits 4 instead of "Directory is empty."
010 none (the @sandbox decorator has no TS port) declarative/decorator.py::_build_json_script none
008 (report only) protocol/filesystem.ts uploadFile/downloadFile protocol/filesystem.py::_raise_transfer_timeout clear FileOperationError text instead of "Request timed out"

Common helpers to add first (TS):


KI-001 per-call env dropped

KI-002 directories reported as files, stat name/path blank

KI-003 command timeout surfaced as raw ReadTimeout

KI-004 kill / send_signal / send_input never reached the process

KI-005 not-found conditions leaked raw HTTPStatusError

KI-006 401 leaked raw HTTPStatusError

KI-007 files.list of a missing directory returned []

KI-010 @sandbox on async def

Python-only (declarative/decorator.py: _build_json_script(..., is_async) now emits asyncio.run(f(*args, **kwargs)) for coroutine functions). There is no declarative module in cli/src, so nothing to port.

KI-008 (platform throughput, report only)

uploadFile / downloadFile turn httpx write/read timeouts (TimeoutException) into FileOperationError("Upload to <path> (<n> bytes) timed out; the transfer took longer than the HTTP timeout.") (download: Download of <path> timed out; ...) with suggestion Raise the HTTP timeout (ABX_HTTP_TIMEOUT / http_timeout) or transfer smaller chunks. The timeout value itself is unchanged. TS: protocol/filesystem.ts uploadFile / downloadFile. CLI: exit 1 with that text instead of the Request timed out block (exit 5).

Parity-test notes