Skip to content

Agent bypassed Plan mode restrictions and posting a GitHub issue comment via gh #34190

Description

@dsy122

Description

I was in plan mode working, and my agent ran gh issue comment and posted a reply directly on the issue which I'm working on — without being asked to, without switching to build mode, and without triggering any permission prompt.

Root cause

The plan mode system prompt explicitly says:

Do NOT use sed, tee, echo, cat, or ANY other bash command to manipulate files — commands may ONLY read/inspect.

The bash tool is not restricted in plan mode at the permission level. Plan mode only denies edit/write/apply_patch. bash inherits the default allow and has no code-level enforcement — all restrictions are prompt-only. There is no command allowlist or blocklist.

gh issue comment and some other commands do not modify local files, so it falls into a grey area that the prompt does not explicitly cover. The model interpreted "only read/inspect" narrowly (local filesystem only) and considered a remote state change via GH CLI as acceptable.

Suggested fix

Add a bash command allowlist for plan mode. Only commands on the allowlist can execute when the plan agent is active.

Related issues

Existing plan mode issues (#25263, #19094, #28467) focus on local filesystem writes.

Plugins

N/A

OpenCode version

1.17.11

Steps to reproduce

  1. Work in plan mode
  2. The agent runs read-only gh commands to inspect issues or PRs — no issues, nothing is blocked
  3. At some point the agent autonomously runs gh issue comment, posting a reply directly on the issue
  4. Throughout the entire process: no mode switch, no permission prompt, no interception

Screenshot and/or share link

No response

Operating System

Windows 10

Terminal

Windows Terminal

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions