Skip to content

Show the pinned session mode on the delegation card - #501

Open
Adam-Dalloul wants to merge 3 commits into
xintaofei:mainfrom
Adam-Dalloul:feat/delegation-card-mode
Open

Show the pinned session mode on the delegation card#501
Adam-Dalloul wants to merge 3 commits into
xintaofei:mainfrom
Adam-Dalloul:feat/delegation-card-mode

Conversation

@Adam-Dalloul

Copy link
Copy Markdown
Contributor

Stacks on #499, which adds the optional permission_mode argument. This PR is the read side of it.

Problem

When a parent pins a session mode for one delegated child, nothing in the transcript records it. Reviewing a conversation afterwards you can see which agent ran and what it was asked to do, but not what it was allowed to do without being asked. That is the one detail you want when auditing what a sub-agent was permitted to touch.

Change

A quiet monospace chip beside the task id on the delegation card, rendered only when the parent actually pinned a mode.

  • No chip means the child used the configured per-agent default, which is the common case, so existing transcripts look unchanged.
  • The value comes from the already-parsed permission_mode argument, so there is no new wire field, no broker change, and no migration.
  • Hosts that strip tool arguments simply show no chip, which reads correctly rather than misleading.
  • parseInput now also recognises a lone permission_mode as delegation args, matching how task / agent_type / working_dir are each treated as sufficient.

The tooltip string is added to all ten locale files with the English text, for translators to pick up.

Tests

Three added to delegation-card.test.ts: parses and trims the value, treats a blank string as absent, leaves it null when the argument is omitted.

Verification

Run locally on this branch:

  • npx tsc --noEmit -p tsconfig.json clean, exit 0
  • npx vitest run src/components/message/ src/lib/delegation-card.test.ts 31 files, 344 tests, all passing

npx eslint reports Delete ␍ on these files, but it does so on untouched files too (276 on delegation-settings.tsx), so that is this Windows checkout's CRLF state rather than anything in this change. The committed diff is 57 insertions with no line-ending churn.

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.
When a parent pins a session mode for one delegated child, nothing in the
transcript records it. Reviewing a conversation afterwards you can see which
agent ran and what it was asked to do, but not what it was allowed to do
without being asked.

Surfaces it as a quiet monospace chip beside the task id, rendered only when
the parent actually pinned a mode. A card with no chip means the child used
the configured per-agent default, which is the common case, so existing
transcripts look unchanged.

The value comes from the parsed `permission_mode` argument, so no new wire
field is needed. Hosts that strip tool arguments simply show no chip, which
reads correctly rather than misleading.

Tests: parses and trims the value, treats blank as absent, leaves it null when
the argument is omitted.
@Adam-Dalloul

Copy link
Copy Markdown
Contributor Author

Review order: merge #499 first. Cross-fork PRs cannot use a fork branch as their base, so this is opened against main and currently shows #499's commit too. Once #499 lands, this diff collapses to its own single commit. Only the second commit, 'show the pinned session mode on the delegation card', is new here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant