{{ message }}
Repository navigation
Stop OpenCode hanging on permission asks without a native policy - #145
Open
utkarsh261 wants to merge 3 commits into
Open
utkarsh261 wants to merge 3 commits into
utkarsh261 wants to merge 3 commits into
Conversation
Without a native policy m3 wrote no permission block, so OpenCode's defaults applied and external_directory stayed on ask. m3 cannot answer permission prompts, so the turn blocked until it timed out. Write an explicit block that turns each default ask into deny.
OpenCode's default ask prompts now map from permission_policy (deny by default, allow, or ask under prompt), and a responder answers this session's pending permission requests through the permission handler while a turn runs, so a stray ask can no longer stall the turn.
The permission responder now answers prompts from descendant sessions of the turn's session (Task subagents) and ignores unrelated session trees. A decision is made once per request and its reply is retried until OpenCode accepts it. The V2 dialect gets an ordered permissions rule list instead of the V1 permission object, without doom_loop.
This branch has not been deployed
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.

permissionblock, so OpenCode's defaults applied:external_directory,doom_loopand.envreads areask. Nothing answered those prompts, so any path outside the workspace stalled the turn until it timed out.permission_policy, the same setting Codex and ACP approvals use: denied by default, allowed with"allow", and left asaskunder"prompt".GET /permission,POST /permission/{id}/reply) from the turn's session and its descendants (Task subagents), through the permission handler with the permission, patterns and metadata inPermissionRequest.context. Each request is decided once and the reply is retried until OpenCode accepts it. No interactions means reject, so a strayaskcan't hang a turn in any mode.permissionsrule list (nodoom_loop) instead of the V1permissionobject, for native policies too.mcp_only/mcp_read_only/fullpolicies are unchanged; they already override everyaskthrough"*".Testing: unit tests for the rendered V1 and V2 config per policy, and for answering root and subagent prompts and retrying failed replies against a fake OpenCode server (failed before, pass now); OpenCode adapter tests, docs/skill reference checks, ruff and mypy pass.
PermissionRequest.contextmatches the same change in #143.