Skip to content

Plan Agent does modifications to files. #2709

Closed

Description

@juri-diener

Hello I encountering that when I'm in the plan mode. It sometimes does modification to my codebase.

This should never be happen. And sometimes in plan mode i get an error that it could not create me code examples in the chat so that i could just look up what the agent would be doing.

This all worked in version v0.3.133 now in version v0.911 it's broken.

This is really unpleasant, it stops the workflow. I hope you guys can fix this in later releases.

Thanks for a such good tool.

Activity

  1. rekram1-node commented on Sep 20, 2025

    @rekram1-node
    Contributor

    @juri-diener mind updating to latest?

    The plan agent can't made modifications to files, it does have bash commands but they require approvals so maybe the llm tried to run a bash command that had some side effects to edit a file?

    We should probably do better prompting but maybe you can share the session and/or your config?

  2. self-assigned this
    on Sep 20, 2025
  3. NaikSoftware commented on Sep 20, 2025

    @NaikSoftware

    I created a similar ticket #2631
    There are two problems:

    1. Any action MUST be approved with default settings, no matter how the internal team uses it (with or without approvals)
    2. Plan agent and subagents should not have access to bash (expect whitelisted commands for search) and file edit/delete
  4. dimaportenko commented on Sep 21, 2025

    @dimaportenko

    hi @rekram1-node, here is link to promt in plan mode https://opencode.ai/s/HX172WVg#msg_96d9ad80b001HTIN6cib3E5V17-0, it's ended up in code changes.

  5. juri-diener commented on Sep 23, 2025

    @juri-diener
    Author

    @juri-diener mind updating to latest?

    The plan agent can't made modifications to files, it does have bash commands but they require approvals so maybe the llm tried to run a bash command that had some side effects to edit a file?

    We should probably do better prompting but maybe you can share the session and/or your config?

    I encountered it again:

    this is what is executed on the Plan Mode:
    Shell Add setLocalLiked before calling likeRespItem

    $ cd /Users/juridiener/Projects/react-native/expo-apps/app-connects &&
    sed -i '' 's/ likeRespItem(respId, !liked);/
    setLocalLiked(!localLiked);\n likeRespItem(respId, !localLiked);/'
    src/components/RespItem/index.tsx

    Config:
    {
    "$schema": "https://opencode.ai/config.json",
    "theme": "system",
    "autoupdate": true,
    "permission": {
    "bash": {
    "install": "deny",
    "uninstall": "deny",
    "rm": "deny",
    "rmdir": "deny",
    "del": "deny",
    "amplify*": "deny",
    "git*": "ask",
    "grep": "allow",
    "glob": "allow",
    "*": "allow"
    }
    }
    }

  6. rekram1-node commented on Sep 24, 2025

    @rekram1-node
    Contributor

    @juri-diener you should remove that "*": "allow" and you will should stop having this issue

    right now you are overriding the plan agent permissions and giving it the ability to make edits without approval

  7. stefanstifter commented on Oct 2, 2025

    @stefanstifter

    can confirm it happened to me too the other day.
    i was in a longer interaction with opencode, switching back and forth between "plan" and "build" mode. at some point in "plan" mode opencode edited existing files and created new files.
    not exactly sure what was going on or how to reproduce.
    i don’t have any custom config, just running defaults.
    opencode version: 0.13.7
    might be related to having a second opencode process running in another tmux window (possibly in build mode at the same time)?
    i’ll try to debug further and report back if i can reproduce.
    thanks anyways for the hard work and great tool! ✌️

  8. rekram1-node commented on Oct 2, 2025

    @rekram1-node
    Contributor

    thx for sharing will take a look

  9. berenar commented on Oct 24, 2025

    @berenar
    Contributor

    Hi @juri-diener, please upgrade to the latest version v0.15.16, this should be fixed

  10. juri-diener commented on Oct 29, 2025

    @juri-diener
    Author

    Hi @juri-diener, please upgrade to the latest version v0.15.16, this should be fixed

    Okay thanks i will try it. Do I need to change my config? Because of the "*" or is it now handled correctly that everything is allowed except that where i have ask or deny permission set.

    "bash": {
    "install": "deny",
    "uninstall": "deny",
    "rm": "deny",
    "rmdir": "deny",
    "del": "deny",
    "amplify*": "deny",
    "git*": "ask",
    "grep": "allow",
    "glob": "allow",
    "*": "allow"
    }

  11. rekram1-node commented on Oct 29, 2025

    @rekram1-node
    Contributor

    @juri-diener u need to wildcard them I recommend doing it:

    "install*": "deny"

    etc

  12. stefanstifter commented on Dec 9, 2025

    @stefanstifter

    can confirm it happened to me too the other day. i was in a longer interaction with opencode, switching back and forth between "plan" and "build" mode. at some point in "plan" mode opencode edited existing files and created new files. not exactly sure what was going on or how to reproduce. i don’t have any custom config, just running defaults. opencode version: 0.13.7 might be related to having a second opencode process running in another tmux window (possibly in build mode at the same time)? i’ll try to debug further and report back if i can reproduce. thanks anyways for the hard work and great tool! ✌️

    quick follow up from my side: after some updates, especially since versions above 1.0.0, this behavior never showed up again. i could not reproduce it anymore. seems to be fixed on my setup. thanks again for the great work ✌️

  13. Straffern commented on Dec 11, 2025

    @Straffern

    I had this config:

      "agent": {
        // Build agent - full capability with slight creativity
        "build": {
          "temperature": 0.3
        },
        // Plan agent - read-only analysis, no file writes
        "plan": {
          "temperature": 0.1,
          "tools": {
            "write": false,
            "edit": false,
            "patch": false
          },
          "permission": {
            "bash": {
              "jj status": "allow",
              "jj st": "allow",
              "jj diff*": "allow",
              "jj log*": "allow",
              "jj show*": "allow",
              "bd *": "allow",
              "rg *": "allow",
              "tree *": "allow",
              "wc *": "allow",
              "head *": "allow",
              "tail *": "allow",
              "mix format*": "allow",
              "mix compile*": "allow",
              "mix test*": "allow",
              "pnpm exec tsc*": "allow",
              "pnpm run lint*": "allow",
              "pnpm test*": "allow",
              "*": "deny"
            }
          }
        },
      },
    

    The plan agent then spawned General agent, that then had permission to edit files and proceeded to implement.
    Is there a way to deny access to agents that have edit/write capabilities?
    eg. research-agent: allow
    general: deny

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions