Add `Workspace.authority` and `AuthorityWorkspace` for workspaces whose files the operator does not control

Merged
AD
1mo ago
+191-11
  • Part of #11183 (1 of 4; stacked: #11837, #11838, #11839)

  • Adds Workspace.authority (default 'operator') and the AuthorityWorkspace(workspace, authority=...) wrapper, next to read_only and ReadOnlyWorkspace.

  • Adds LocalWorkspace(authority='user' | 'none'), mirroring read_only=True; it also works in agent specs.

  • The levels are Authority = Literal['operator', 'user', 'none'] in pydantic_ai.messages, the vocabulary CapabilityPart sources use in #11935. 'user' is for the user's own files (uploads), 'none' for files nobody on the application's side wrote (a cloned repo).

  • A wrapper only lowers the level: through a chain of wrappers the lowest wins.

  • Tools behave the same whatever the authority. A capability that puts workspace text in instructions sends it with no more authority than the workspace has. No built-in capability reads it yet; the stacked PRs add the readers.

  • Durable execution: AuthorityWorkspace returns its level from durable_policy(), so a run-level wrapper with a different level than the agent rebuilds is rejected, like ReadOnlyWorkspace.

  • Docs: a "Files you didn't write" section in docs/workspace.md, the durable-execution bullet, the API reference and the Pydantic AI skill references.

  • Nothing changes for existing users.

  • Not included: authority= on the sandbox and SSH capabilities (they don't take read_only= either). Planned as a follow-up.

This PR first added a trusted: bool flag and an UntrustedWorkspace wrapper. On 2026-11-03 Douwe decided to rename it to authority before merge, to match the three authority levels in #11935. trusted never shipped, so there are no deprecated aliases.

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.