Per-call permission_mode for delegated sub-agents - #499
Open
Adam-Dalloul wants to merge 1 commit into
Open
Conversation
A parent agent can already choose WHICH agent runs a delegated task, but not how much that child may do unattended. The child inherits whatever session mode the per-agent delegation default in Settings happens to be. For a one-off delegation that is the wrong granularity: you may want a specific child kept on a prompting or approval mode without changing the global default for that agent. Adds an optional `permission_mode` to `delegate_to_agent`. It is the target agent's own session mode id, the same vocabulary `AgentDelegationDefaults::mode_id` already uses, and it is forwarded verbatim as `ConnectionSpawner::spawn`'s existing `preferred_mode_id`, so no new mechanism is introduced. Behaviour: - omitted: configured default is used unchanged, so there is no behaviour change for existing callers and non-delegated sessions are untouched - provided: overrides the Settings default for that one call - blank or whitespace is treated as omitted, so a model emitting "" cannot clear the configured default by accident - agents exposing no session modes ignore it This is a cooperative permission scope enforced by the agent, not an OS sandbox. The schema description says so rather than implying isolation. Tests: per-call override beats the agent default; omitting keeps the default; override works with no agent default configured.
Adam-Dalloul
force-pushed
the
feat/delegate-permission-mode
branch
from
August 16, 2026 16:41
7a3a948 to
5e0b08b
Compare
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A parent agent can already choose which agent runs a delegated task, but not how much that child may do unattended. The child inherits whatever session mode the per-agent delegation default in Settings happens to be, which is the wrong granularity for a one-off delegation: you may want one specific child kept on a prompting or approval mode without changing the global default for that agent type.
This shows up when a parent fans work out to several children. Some slices are read-only research, others touch the filesystem, and today they all start in the same configured mode.
Change
Adds an optional
permission_modetodelegate_to_agent.It is the target agent's own session mode id, the same vocabulary
AgentDelegationDefaults::mode_idalready uses, and it is forwarded verbatim asConnectionSpawner::spawn's existingpreferred_mode_id. No new mechanism is introduced. This lets a caller reach the knob thatSettings > Delegation > per-agent defaultsalready sets, but scoped to a single call.""or whitespaceDeliberate properties:
""cannot silently clear a configured default.Tests
Three unit tests alongside the existing
agent_defaults_are_forwarded_to_spawner:Verification note
I could not run
cargo testlocally, as there is no Rust toolchain on this machine, so the Rust changes are unverified by compilation on my side and rely on CI. Everything else was checked by hand: the JSON schema parses, the schema diff is 4 added lines with formatting preserved, and everyDelegationRequestconstruction site was audited for the new field. Flagging this explicitly rather than implying a green local run.Possible follow-up
Surfacing the mode a child actually started in on the delegation card would pair well with this, so a reviewer of a transcript can see what a delegated child was allowed to do. Kept out to keep one concern per PR. The per-agent default UI already exists in
delegation-agent-defaults.tsx, so nothing is needed there.