| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
… edit:deny Three changes that together allow a subagent's explicit edit-class configuration to override inherited parent restrictions: 1. fromConfig() aliases write/apply_patch to the edit permission key (packages/opencode/src/permission/index.ts) The runtime layer already treats write, apply_patch, and edit as the same tool class via EDIT_TOOLS in core/src/permission.ts, but the config layer stored write: allow as permission: write, invisible to the edit lookup. Aliasing in fromConfig makes the config layer consistent with the runtime. 2. deriveSubagentSessionPermission skips parent edit denies when subagent explicitly allows edit-class tools (packages/opencode/src/agent/subagent-permissions.ts) PR anomalyco#26597 forwarded all parent agent denies to subagents (Plan Mode security). PR anomalyco#27201 scoped this to only edit denies. This change extends the same principle: if the subagent has explicit edit:allow (or write:allow via fix anomalyco#1), the inherited edit:deny is suppressed. The subagent's explicit config represents user intent and overrides inherited restrictions. Plan Mode's edit:deny still cascades to subagents without an explicit edit:allow. 3. prompt() merges tool-level denies into session permission instead of overwriting (packages/opencode/src/session/prompt.ts) The task tool calls ops.prompt() with tool-level denies for todowrite/task/primary_tools. prompt() was overwriting the entire session.permission, destroying any inherited rules (including the Plan Mode edit:deny that deriveSubagentSessionPermission just set up). This fix merges instead of replaces, preserving session-level permission integrity. Fixes the interaction between issues anomalyco#26514 (Plan Mode bypass) and anomalyco#26700 (parent denies over-constrain subagents).
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one related PR that appears to be addressing a very similar issue: Related PR:
This PR appears to directly address the same core issue: ensuring that a subagent's explicit edit:allow configuration takes precedence over a parent agent's edit:deny. It's likely either a prior attempt at the same fix, a related issue that was separately worked on, or potentially a duplicate effort. I also found:
The first match (#27654) is the most concerning as a potential duplicate since it has an almost identical title and purpose. |
Sorry, something went wrong.
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Sorry, something went wrong.
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Sorry, something went wrong.
|
Please reopen this PR. It was auto-closed by the cleanup bot due to lack of review/activity on the PR, not because the issue is resolved or the fix is incomplete. The fix was already implemented and is still needed. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Issue for this PR
Closes #26514
Closes #26700
Type of change
What does this PR do?
Fixes the interaction between #26514 (Plan Mode bypass) and #26700 (parent denies over-constrain subagents).
Subagents with an explicit write: allow (or edit: allow) configuration can now actually use edit-class tools, even when their parent agent has edit: deny (Plan Mode). Generic subagents without an explicit edit-class allow still inherit the parent's denies. Plan Mode security is preserved.
Three changes:
This is more complete than the similar PR #27654 which only covers fix 2.
The fromConfig() aliasing and prompt.ts merge are needed too.
This fix is also complementary to the approach in #24293 which propagated parent session permissions to subagents (enabling inheritance), while this PR adds the explicit allow check on top of that (allowing overrides when the subagent opts in).
How did you verify your code works?
All upstream test scenarios pass:
Screenshots / recordings
N/A, no UI changes.
Checklist