Backtestsopenai-agents-pythonrun-20261024-184640#4401
[Sandbox] Add a run-scoped cwd across capabilities when reusing a live session
The judges split evenly between our patch and the merged fix.
In this judgment, Patch B = our agent, Patch A = the merged fix.
Both patches resolve the issue at its root: each binds a run-scoped cwd onto the per-run cloned capabilities (never mutating session state), defaults shell commands to it, re-bases relative shell workdir, view_image and apply_patch paths beneath it, leaves Manifest.root and direct session calls alone, preserves behavior when cwd is omitted, and renders the working directory in the model instructions. All nine independent tests pass on both, including the concurrent shared-session scenario. Patch B does this with a small, convention-following change: a `cwd` field on `Capability` with `bind_cwd` mirroring the existing `bind_run_as` pattern, one helper `resolve_path_from_cwd`, cwd validated against the session path policy (rejecting escapes with a clear UserError), the directory auto-created with the run user, Skills/Memory instruction paths rendered absolute so they do not resolve beneath the cwd, and the guide updated where the issue pointed. Its tests cover config normalization, shell workdir resolution, the three tools sharing one base on a real Unix-local session (including the approval callback seeing canonical paths), two concurrent runs with distinct cwds, the no-cwd case, the escape rejection, and Skills/Memory rendering. The whole test module is skipped on Windows, which also skips a few pure unit tests, but the issue's scenarios are Unix-based. Patch A is more elaborate (a `SandboxWorkspaceScope` abstraction with cwd-relative display paths, lazy-skill path rewriting, stricter cwd validation) and has a broader test suite, but it carries meaningful scope risk beyond the ask: a ~130-line rewrite of custom-tool reconciliation in `run_internal/turn_resolution.py` (the core HITL resume path for all custom tools, not just sandbox), a rework of the runtime's prepared-agent cache keyed on run_as, and a 289-line example. It also validates the cwd by issuing two `session.exec` probes (`test -d`, `test -x`) on every `prepare_agent` call, including the cached path, which adds per-turn round trips on remote sandboxes and depends on a `test` binary. None of that is required by the issue's scenarios (concurrent runs, no approvals), and the core-runner changes are the kind that obscure the fix and add regression risk. B's minor gaps (root-relative rather than cwd-relative display strings, lazy `load_skill` result path not rewritten) are cosmetic relative to the issue's stated requirements. Weighing correctness as roughly equal, A's tests as stronger but B's as adequate and non-tautological, and B clearly ahead on scope and risk, B is the better fix.
Four judges ruled on this ticket in parallel, and the verdict comes from counting their votes. Each saw the issue and the two patches, labelled A and B in random order (two of them saw ours as A), with issue links and version numbers removed. Where tests could check the fix, they also saw the results of tests a separate agent wrote for the issue, run on both patches. None was told which patch was ours. The reasoning above is one judge's, shown verbatim.
Solve
21m 22s
Wall-clock time in the container
Full test suite
No new failures
2,817 passed · 6 skipped · 2,823 total
Contamination audit
Clean
No sign the agent saw the real fix
Patch size
496vs 2,719 merged
Changed lines, ours vs merged
The issue
View on GitHubDescribe the feature
I would like to bind each SandboxAgent run to a logical working directory inside a developer-owned live sandbox, with consistent relative-path behavior across sandbox capabilities.
The SDK currently supports sharing one live sandbox session, but every run uses the session-wide Manifest.root for filesystem path resolution:
exec_command(workdir=...)changes the directory for that shell command only.view_image("plot.png")resolves from the session workspace root.apply_patchpaths are workspace-root-relative, not relative to the shellworkdir.run_aschanges the OS identity and permissions, but not path resolution.
This behavior is documented, so I am filing this as a feature request rather than a bug.
Relevant current behavior: