fix(opencode): show what an OpenCode permission is for, safely - #1026
Merged
Merged
Conversation
Refs #878 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ion subjects Picks up Juliusolsson05/opencode-headless#14. One shared parser reads the subject OpenCode actually sends. bash shows the whole command, and questions read questions[].question. Tested on recorded 1.18.30 streams. Refs #878 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The recorded stream is replayed through the bumped package's real EventDispatcher and rendered by the real view. It fails first: the subject arrives but sits inline, and nothing says what Allow always covers. Refs #878 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ways scope With subjects populated for the first time, the modal has to render them safely. The command goes in a bounded, scrolling, wrapping block, untruncated, so a heredoc can no longer push the buttons off-screen while Allow once holds focus. The modal also says what Allow always covers, from the payload's own always list, and states plainly when that is '*', meaning every such request for the session. Fixes #878 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…rue Allow-always reach From the #1026 review. OpenCode's default rules allow bash and ask only for external_directory, so for most users the shell prompt read 'external_directory: /work/old/*' while the command that runs sat unseen in the payload's metadata. The modal now shows that command whenever the subject does not already contain it. The Allow-always line now names the permission and states its real reach: OpenCode keeps the grant in the server's memory, so it covers this agent and its subagents until the agent restarts, which is how OpenCode's own TUI words it. The wildcard case reads 'every <kind> request'. The scope line wraps long patterns, and the question body is bounded and scrollable, since the only button (Reject) must stay on screen now that questions render. Tests read the recording shipped in the bumped package. Refs #878 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Owner
Author
|
Review round 1 (independent): CHANGES REQUESTED → resolved in
Renderer suite 6/6; |
Juliusolsson05
added a commit
that referenced
this pull request
Sep 19, 2026
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Problem
#878 (release blocker). With OpenCode bundled, the structured runtime's permission modal said "OpenCode is requesting permission." with no subject, so users approved
bash: ls -1blind, and the question modal showed no question. The parsers didn't match the payload OpenCode actually sends.Implemented
opencode-headlessto62440add(fix(permissions): read permission and question subjects from the 1.18.30 payload opencode-headless#14, reviewed and merged). One shared subject parser, tested on recorded 1.18.30 streams:metadata.command), socd x && …orexport …&&prefixes can't hide;permission: patterns;questions[].question.views.tsx): the subject is now populated for the first time, so render it safely:<pre>, untruncated, because this modal is the only place the user sees it. A 100-line heredoc can no longer push the buttons off-screen while the auto-focused "Allow once" answers Enter;alwayslist, with an explicit warning when it is*(edit, write and MCP asks mean every such request for the session). OpenCode's own UI confirms this scope; ours showed nothing.Verification (fail-first, recorded input)
opencodePermissionView.renderer.test.tsxreplays the recorded OpenCode 1.18.30 stream through the bumped package's realEventDispatcherinto the real view. It asserts the subject is in the scroll container, the recordedalwaysscope (ls *) is shown, and a derived 60-line heredoc renders in full.SPAN) with no scope.tsc -bis clean.Follow-up
Questions are now visible but can only be rejected; answering them is a separate issue: #1025
🤖 Generated with Claude Code