Skip disk sub-agents below `'operator'` authority and keep the parent's authority for `working_directory` delegates
Reading guide: two small changes. First, _load_folder in subagents/_disk.py skips a definition file below 'operator' before names are compared, so a planted .agents/agents/reviewer.md can't shadow the operator's .claude/agents/reviewer.md. SubAgents.before_run warns about the skipped files. Second, _with_parent_authority at the end of subagents/_toolset.py holds the key decision: a working_directory delegate gets one level for all its files. That level is the lowest of what the parent gives the directory and of every parent path_authority entry inside it, whether written or resolved. It's conservative: a file the parent ranks higher can rank lower in the delegate, but none ranks higher. Copying the parent's entries one by one lost the parent's symlink caps (bot findings). Read it next to test_selected_directory_keeps_the_parents_authority and test_a_linked_directory_keeps_the_parents_cap. You can skip the docs.
Ported from Workspace.trusted to authority (#11836, #12473), now decided per file instead of per workspace.
SubAgentsdoesn't load a disk definition file below'operator'(authority_of(path)). A definition's body becomes a delegate's instructions and its description goes in the parent's roster, so there's no lower-authority form to send instead. It warns naming the files, and only when there are some. Aworkspace=of its own at'operator'is still read.- A delegate given a
working_directory=never gets more authority than the parent gives its files, as it already kept the read-only policy. Its workspace is lowered to the lowest of the directory's level in the parent and any parentpath_authorityentry inside it. The host's resolver knows nothing of those levels, so without this a delegate invendor/would readvendor/libat'operator'. A parent without a workspace leaves the delegate unchanged. A directory outside the parent's working directory gets'none', as the parent gives it, unless one of the parent'spath_authorityentries contains it; the operator opts such a directory back in with an entry, such as{'/srv/checkouts': 'operator'}. - The earlier
CapabilityCreationdocs change is dropped:mainnow refuses a directory below'operator'(#12558). - Docs: SubAgents docstrings, page, README twin,
docs/workspace.md, and the harnessDELEGATION-AND-PLANNINGreference.
Nothing changes for 'operator' workspaces.
Review notes
_with_parent_authorityuses the publiclowest_authority_under(workspace, directory)that #11837 adds topydantic_ai.workspaces, not the privateWorkspace._authority_layers(). The single level is conservative. Per-path faithfulness would need a wrapper that delegatesauthority_ofto the parent, and core doesn't support that for outer layers today.
Compatibility impact
Labeled compatibility impact. Release note:
SubAgentsno longer loads a sub-agent definition from disk whose file is below'operator'authority, such as every file in a workspace atauthority='none': it's skipped with a warning naming the file. Aworking_directory=delegate's workspace is also lowered to the lowest authority the parent gives that directory. A directory outside the parent's working directory is at'none'unless one of the parent'spath_authorityentries contains it, so a resolver that returns, say, a checkout elsewhere on disk now gives the delegate's repository instructions, skills and agent definitions no authority: add apath_authorityentry for that directory on the parent's workspace to keep them as instructions. Pax'sReviewspecialist is one such delegate: aworking_directoryoutside the session directory, such as another checkout, now gives Review that repository'sAGENTS.mdas data rather than as instructions, and pax has no setting to opt a directory back in yet.- Durable runs using
SubAgentswithagent_foldersrecord onerealpathper agent definition file at run start; let in-flight runs finish, or use Temporal worker versioning / a new DBOS app version, before upgrading.
Follow-ups: #13775 (a two-level delegate wrapper that keeps operator authority for a trusted subdirectory of an untrusted workspace).
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