Bug: #1862 broke global permissions #1270

Closed
opened 2026-02-16 17:30:14 -05:00 by yindo · 8 comments
Owner

Originally created by @AYM1607 on GitHub (Aug 12, 2025).

Originally assigned to: @thdxr on GitHub.

#1862 Introduces agent level permissions, but breaks global permissions, I believe this is the culprit: https://github.com/sst/opencode/pull/1862/files#r2271435440. Repro:

Set opencode.json to:

    {
      "$schema": "https://opencode.ai/config.json",
      "permission": {
        "edit": "ask"
      }
    }

Ask the build agent to write to a file, and it will do so without asking. Now set it to:

    {
      "$schema": "https://opencode.ai/config.json",
      "agent": {
        "build": {
          "permission": {
            "edit": "ask"          }
        }
      },
      "permission": {
        "edit": "ask"
      }
    }

And it will behave as expected.

Originally created by @AYM1607 on GitHub (Aug 12, 2025). Originally assigned to: @thdxr on GitHub. #1862 Introduces agent level permissions, but breaks global permissions, I believe this is the culprit: https://github.com/sst/opencode/pull/1862/files#r2271435440. Repro: Set opencode.json to: ```json { "$schema": "https://opencode.ai/config.json", "permission": { "edit": "ask" } } ``` Ask the build agent to write to a file, and it will do so without asking. Now set it to: ```json { "$schema": "https://opencode.ai/config.json", "agent": { "build": { "permission": { "edit": "ask" } } }, "permission": { "edit": "ask" } } ``` And it will behave as expected.
yindo closed this issue 2026-02-16 17:30:14 -05:00
Author
Owner

@thdxr commented on GitHub (Aug 12, 2025):

hm this is working for me

@thdxr commented on GitHub (Aug 12, 2025): hm this is working for me
Author
Owner

@thdxr commented on GitHub (Aug 12, 2025):

image.png

this promps me for permissions

@thdxr commented on GitHub (Aug 12, 2025): <img src="https://uploads.linear.app/a959060b-9262-4398-9650-16bf10f1450e/b34dfbfc-7b75-4a65-83b2-556b81ce98cd/42985642-74ac-4e81-b9f7-790f5307e6fc?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiL2E5NTkwNjBiLTkyNjItNDM5OC05NjUwLTE2YmYxMGYxNDUwZS9iMzRkZmJmYy03Yjc1LTRhNjUtODNiMi01NTZiODFjZTk4Y2QvNDI5ODU2NDItNzRhYy00ZTgxLWI5ZjctNzkwZjUzMDdlNmZjIiwiaWF0IjoxNzU1MDM4NDk2LCJleHAiOjMzMzI1NTk4NDk2fQ.RXAA4KzHCbVfsUzATxxzVaOJsqQzszhiGz6u5UZLiW8 " alt="image.png" width="870" data-linear-height="405" /> this promps me for permissions
Author
Owner

@AYM1607 commented on GitHub (Aug 12, 2025):

I can definitely reproduce on v0.4.40

@AYM1607 commented on GitHub (Aug 12, 2025): I can definitely reproduce on v0.4.40
Author
Owner

@AYM1607 commented on GitHub (Aug 12, 2025):

I actually think that the issue is here: https://github.com/sst/opencode/blob/4d4b3c478ae672201b5e0503902bbbdcde29c98f/packages/opencode/src/agent/agent.ts#L79 is cfg.agent is empty, then no merging occurs

@AYM1607 commented on GitHub (Aug 12, 2025): I actually think that the issue is here: https://github.com/sst/opencode/blob/4d4b3c478ae672201b5e0503902bbbdcde29c98f/packages/opencode/src/agent/agent.ts#L79 is cfg.agent is empty, then no merging occurs
Author
Owner

@rekram1-node commented on GitHub (Aug 12, 2025):

@thdxr confirmed, can reproduce

@rekram1-node commented on GitHub (Aug 12, 2025): @thdxr confirmed, can reproduce
Author
Owner

@AYM1607 commented on GitHub (Aug 12, 2025):

Fix POC: #1879

@AYM1607 commented on GitHub (Aug 12, 2025): Fix POC: #1879
Author
Owner

@AYM1607 commented on GitHub (Aug 12, 2025):

Just pushed an update to #1879 and have confirmed that it behaves as expected. If only the global permission is supplied, the build agent honors it. If the build agent has a different permission, its override is honored. If only the agent has a permission, it's also honored.

@AYM1607 commented on GitHub (Aug 12, 2025): Just pushed an update to #1879 and have confirmed that it behaves as expected. If only the global permission is supplied, the build agent honors it. If the build agent has a different permission, its override is honored. If only the agent has a permission, it's also honored.
Author
Owner

@AYM1607 commented on GitHub (Aug 13, 2025):

Fixed by #1879

@AYM1607 commented on GitHub (Aug 13, 2025): Fixed by #1879
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1270