Add `authority` and `path_authority` to the sandbox and `SSHWorkspace` capabilities
Reading guide: read with_authority in pydantic_ai_harness/_workspace.py and one capability, such as docker_container/_capability.py. The other capabilities get the same two fields and the same three-line get_workspace wrapper, so you can skim them. The key decision is the API shape: authority and path_authority copy LocalWorkspace exactly. The one difference is that paths are sandbox or host paths, so ~ isn't expanded, the same rule AuthorityWorkspace uses. BubblewrapSandbox is left out on purpose: it wraps another workspace capability, which already takes authority.
DockerContainer, E2BSandbox, KubernetesSandbox, ModalSandbox, DaytonaSandbox, BoxdSandbox, BoxLiteSandbox, OpenSandbox, RenderSandbox, SmolSandbox, SpritesSandbox and SSHWorkspace take authority and path_authority, like LocalWorkspace. When either is set below 'operator', the run's workspace is wrapped in an AuthorityWorkspace, for new and attached sandboxes alike. Before this, someone running an agent on an untrusted checkout in a sandbox or over SSH had to wrap the backend by hand.
get_workspacebuilds the backend as before (now_run_backend) and passes it through the sharedwith_authorityhelper. The defaults change nothing.- Tests:
DockerSandboxandSSHWorkspace(withread_only=Truetoo) checkauthority_offrom a tool and that the workspace ref is still the backend's. - Docs:
docs/workspace.mdand the harnessCODING-AND-WORKSPACESreference. Each field's docstring appears on its capability's API page.
Takeover notes
- Merged the latest
main(conflicts were adjacent field additions: boxdsecrets, E2Bnetwork, the harness skill'sworking_dirrow; both sides kept). KubernetesSandboxlanded onmainafter this PR opened, so it gets the same two fields,from_specarguments, docs rows and tests (authority_offrom a tool, and the run still closes its connection through theAuthorityWorkspace). Decision: include it here rather than a follow-up, since the issue asks for every sandbox capability.- Harness-only change; no core code outside
pydantic_ai_harness.
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
- PR title is fit for the release changelog.
š¤ Generated with Claude Code