Skip to content

fix(session): keep permission prompts in subagent views - #56906

Open
AILIFE4798 wants to merge 2 commits into
anomalyco:devfrom
AILIFE4798:subagent-permission
Open

AILIFE4798 wants to merge 2 commits into
anomalyco:devfrom
AILIFE4798:subagent-permission

Conversation

@AILIFE4798

@AILIFE4798 AILIFE4798 commented Oct 19, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #56907

Type of change

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

What does this PR do?

Viewing a subagent dropped that session's permission requests. The prompt never opened, and auto-accept walked the same empty list, so the session hung with nothing to approve.

The TUI now keeps the viewed session and its descendants. Ancestors and siblings stay out. A pending permission prompt is shown instead of the forced subagent composer. The desktop dock is no longer covered by the child placeholder while a request is pending, and auto-accept also scans permissions that were synced before the session info arrived.

How did you verify your code works?

Opened a subagent that requested shell permission. With auto-accept off, the prompt appeared in that view and accepting it ran the command. With auto-accept on, the request was approved and the command finished. bun test test/util/session.test.ts in packages/tui passed.

Screenshots / recordings

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #52411, #44007

Viewing a subagent dropped its permission requests, so the dialog never
opened and auto-accept approved nothing. Keep the viewed session and its
descendants, and do not let the child composer cover the prompt.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Oct 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot removed needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Oct 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TUI part fixes the reported bug. I reproduced it with opencode-drive and the simulated model: with a request pending on a subagent, base shows no prompt in that subagent's view, and Enter does nothing. With this PR the prompt appears and Enter approves it. bun test test/util/session.test.ts and typecheck in packages/tui and packages/app pass. I did not run the desktop app changes; I only read them.

Public API: unchanged.

Two things are worth fixing before merge (details inline):

  • TUI pickers blocked (shown in a test run): while a request is pending in the parent view, the subagent and terminal pickers can't be opened, and the hidden open state makes the picker reappear later.
  • Desktop auto-approve (from reading the code): for sessions the app hasn't loaded, the new loop ignores a project's own auto-accept setting.

Related: #52411, #44007

Before

After

sessionID={route.sessionID}
open={composer.open || (!!session()?.parentID && forms().length === 0)}
open={
promptedPermissions().length === 0 &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check now also overrides composer.open, which is the user's explicit request to open the Down (subagents) or terminal picker. It is not limited to the forced subagent composer.

I saw this with a request pending in the root view: Down no longer opens the subagent picker. composer.open stays true behind the prompt. My next Enter answered the permission prompt, and then the picker popped up. On base the same keys open the picker and move into the child.

Suggested fix: only let a pending prompt override the forced child composer, e.g. composer.open || (!!session()?.parentID && forms().length === 0 && promptedPermissions().length === 0). Use the same condition in the Match at line 1494.

...input.data.session.list().map((session) => session.id),
...input.data.session.permission.sessions(),
])
for (const id of ids) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Session IDs that come only from permission.sessions() are, by definition, not in data.session yet. So approve(request) gets projectID = undefined, and covers(undefined) checks the app-wide default instead of the project's own setting.

If auto-accept is on by default and a project turns it off, that project's requests would still be auto-approved here. That is the case consider() was written for: it fetches the session's project before approving. Calling consider(request) for IDs not returned by session.list() keeps the per-project override working.

A pending prompt no longer hides an explicitly opened picker. Unloaded
sessions go through consider() so a project auto-accept override still applies.

This branch has not been deployed

No deployments
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.

Permission prompt hangs when viewing a subagent

1 participant