Skip to content

feat(tasks): let skip-permissions be changed on an existing task - #283

Open
miadisabelle wants to merge 1 commit into
johannesjo:mainfrom
miadisabelle:contrib/task-skip-permissions-toggle
Open

miadisabelle wants to merge 1 commit into
johannesjo:mainfrom
miadisabelle:contrib/task-skip-permissions-toggle

Conversation

@miadisabelle

@miadisabelle miadisabelle commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Whether a task's agent launches with its skip-permissions flag is decided when the task is created and fixed for its whole life. Changing it means closing the task and starting again, which loses its worktree and conversation — and the title bar doesn't show which tasks are running with the flag.

What changes

  • setTaskSkipPermissions(taskId, enabled) changes the flag on an existing task and saves. It takes effect the next time the agent starts — a terminal restart or resume, or a new or reconnected chat. A running agent keeps the permissions it was launched with; I traced every restart path (restartAgent/switchAgent bump generation, which remounts TerminalView and rebuilds args) to confirm the flag is read at spawn, not cached.
  • A clickable badge in the title bar, after the verification badge and styled like the landing badge: "skip confirms" in the warning colour when on, "confirms on" muted when off. It appears when one of the task's agents takes such a flag (resolved by command via resolveSkipPermissionsArgs, so a definition restored without its flags still qualifies) and not on landed tasks.
  • The chat view's permission selector now follows the running session's own mode instead of the task flag. The session refuses a mode change based on how it was started (claude.ts — "This task skips permissions; turn that off to choose a mode."), and once the flag can change mid-chat, reading it would enable the selector for a session that rejects the choice. Claude reports its mode only in each turn's init message, so a session launched skipping permissions now sets bypassPermissions itself on connect — otherwise the selector would be enabled from connect until the first prompt.

Deliberately not covered

Tasks that start other tasks — coordinators and delegation parents — don't get the badge. Their children take the separate propagateSkipPermissions setting (fixed at registration for a coordinator), so turning the flag off there would stop only the parent's own agent from skipping prompts while its children kept skipping them. For a safety setting, partly applying is worse than not offering it. This matches the title bar's existing !coordinatorMode && !delegationParent checks.

Codex chat resume: resuming a Codex thread after turning the flag off sends no approvalPolicy/sandbox on thread/resume, exactly as today, so the thread may keep the policy it started with. I couldn't verify whether Codex keeps it across a resume without a live Codex session. A new chat or a terminal restart applies the change either way; if you'd rather the resume send on-request/workspace-write explicitly when the flag is off, that's a small follow-up — I left it alone because it would also change resume behaviour for tasks whose flag never changed.

Your call on the badge

With the default off, most tasks will show a muted "confirms on". Showing it only when on is a one-line change, but then turning it off from the title bar couldn't be undone there — and upstream's own chat note already tells users to "switch the task to skip permissions", which this gives them a place to do. Happy to go either way.

7 tests: the setter (on, off, no save when already off or absent, unknown task) and the Claude session reporting its mode on connect — which fails without that change. npm run compile, check:static and both suites pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SK5d1Qh4JcJVF39HEkFBxX

Whether a task's agent launches with its skip-permissions flag is decided when
the task is created and fixed for the life of the task. Changing it meant
closing the task and starting again, losing its worktree and conversation, and
the title bar did not show which tasks were running with the flag.

- `setTaskSkipPermissions(taskId, enabled)` changes it and saves. It takes
  effect the next time the agent starts: a terminal restart or resume, or a new
  or reconnected chat. A running agent keeps the permissions it was launched
  with.
- The title bar shows the setting as a clickable badge after the verification
  badge, styled like the landing badge: "skip confirms" in the warning colour
  when on, "confirms on" muted when off. It appears when one of the task's
  agents takes such a flag, resolved by command so a definition restored
  without its flags still qualifies, and not on landed tasks.
- Tasks that start other tasks do not get the badge: coordinators and
  delegation parents. Their children take the separate
  `propagateSkipPermissions` setting (fixed when a coordinator's MCP server
  registers), so turning the flag off there would stop only the parent's own
  agent from skipping prompts while its children went on skipping them. This
  matches the title bar's existing `!coordinatorMode && !delegationParent`
  checks.
- The chat view's permission-mode selector now follows the running session's
  own mode instead of the task flag. The flag can now change while a chat
  runs, and the session refuses a mode change based on how it was started, so
  reading the task flag would enable the selector for a session that rejects it.
  Claude reports its mode only in each turn's init message, so a session
  launched skipping permissions now sets `bypassPermissions` itself when it
  connects; without that the selector would be enabled until the first prompt.

A Codex chat resumed after turning the flag off is sent no approval policy on
`thread/resume`, as before, so it may keep the policy the thread started with.
Whether Codex keeps it across a resume was not verified here; a new chat, or
a terminal restart, applies the change.

7 tests: on, off, no save when already off or absent, an unknown task, and the
Claude session reporting its mode on connect (fails without the change) or
not, when it does not bypass.
@miadisabelle
miadisabelle force-pushed the contrib/task-skip-permissions-toggle branch from 273df62 to 1b20019 Compare September 23, 2026 12:47
@miadisabelle

Copy link
Copy Markdown
Contributor Author

Rebased onto 3.0.1 (f190ba0), no conflicts. One change for 3.x: delegation parents now also don't get the badge, alongside coordinators. Their children take propagateSkipPermissions (delegation.ts, assignment.propagateSkipPermissions ?? task.propagateSkipPermissions), which this badge doesn't change, so turning it off on a parent would only have stopped the parent itself — the same reason coordinators were excluded, and the same !coordinatorMode && !delegationParent pair the title bar already uses. The chat files are unchanged in 3.x, so that part stands as it was. compile, check:static and both suites pass.

miadisabelle added a commit to miadisabelle/mia-parallel-code that referenced this pull request Sep 23, 2026
Brings this fork's per-task skip-permissions toggle in line with the version
reviewed for upstream (johannesjo#283), where review found two
problems that apply here too, the first more so because this fork defaults
propagation to children on.

- The title-bar badge is no longer offered on coordinator or delegation-parent
  tasks. Their children take the separate `propagateSkipPermissions` setting,
  so turning the flag off there stopped only the parent's own agent from
  skipping prompts while every child it started went on skipping them.
- The chat view's permission selector follows the running session's own mode
  instead of the task flag. The session refuses a mode change based on how it
  was started, so once the flag can change mid-chat, reading it offered a
  choice the session rejects. Claude reports its mode only in each turn's init
  message, so a session launched skipping permissions now sets
  `bypassPermissions` itself on connect; otherwise the selector would be
  enabled until the first prompt.

2 tests on the Claude session's reported mode at connect.
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