Skip to content

fix(opencode): cascade auto permissions to subagent sessions - #42310

Open
vladislav-miroshnikov wants to merge 2 commits into
anomalyco:devfrom
vladislav-miroshnikov:auto-permission-cascade
Open

fix(opencode): cascade auto permissions to subagent sessions#42310
vladislav-miroshnikov wants to merge 2 commits into
anomalyco:devfrom
vladislav-miroshnikov:auto-permission-cascade

Conversation

@vladislav-miroshnikov

@vladislav-miroshnikovvladislav-miroshnikov commented Aug 13, 2026

Copy link
Copy Markdown

Issue for this PR

Fixes#41730

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When opencode run spawns a subagent, permission requests belong to the child session. Filtering only for the root session leaves that subagent waiting forever.

The run event loop now accepts permission requests from the attached root session and sessions whose parentID chain reaches that root. Proven descendants are cached. Requests from unrelated sessions in the same workspace remain untouched, so --auto cannot approve another concurrent session's request.

How did you verify your code works?

  • cd packages/opencode && bun test test/cli/run/run-process.test.ts — 16 pass, 0 fail
  • cd packages/opencode && bun test test/permission-task.test.ts — 21 pass, 0 fail
  • cd packages/opencode && bun typecheck

The subprocess matrix covers child auto-approval, child auto-rejection without --auto, and an attach-mode negative case proving an unrelated session's pending permission is not answered.

Checklist

  • I have read the contributing guide
  • I have verified my code works on the target platform

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search results, I found one potentially related PR:

#37902 - fix(acp): child/subagent session permission requests no longer hang forever

This PR appears to address a similar issue with child/subagent session permission requests hanging. It may be related to or a predecessor of the current PR's fix for cascading auto permissions to subagent sessions.

Sign up for freeto 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.

Auto-approve permissions (--auto) do not cascade down to subagents after running 'opencode run --auto'

1 participant

@vladislav-miroshnikov