Repository navigation
Description
Summary
An OpenCode 2 thread created through bb's acp-opencode provider remains on the plan agent, but bb writes a session-level edit: allow rule. OpenCode evaluates session rules after agent rules, so this overrides Plan's edit: deny and makes a supposedly read-only session able to edit files.
This appears to be a regression from #7551, which added OpenCode 2 session-permission enforcement. The current main source still unconditionally generates the blanket edit allow.
Versions and environment
- bb 0.50.1, macOS desktop app (
/Applications/bb.app) - macOS 26.7.3 (25G342), arm64 (Apple Silicon)
- Provider:
acp-opencode, supplied by the bundledprovider-acpplugin - OpenCode CLI:
opencode v2.4.3(opencode --version) - Local machine; no bb Connect, remote host, custom data dir, or custom ACP launch command
- Reproduced in a bb personal-workspace environment
- bb offers
accept-editsandfullfor this provider; the affected sessions were observed in both
Steps to reproduce
-
In bb, create a thread with the
acp-opencodeprovider and choose Plan in the Mode menu. Leave bb's permission mode at Accept Edits (Full Access also produces the conflicting edit rule). -
Send a planning request so the ACP session is initialized.
-
Run
bb thread options <thread-id> --json. Themodeoption reportsvalue: "plan". -
Find the OpenCode session for the thread's environment directory and inspect it:
opencode api get '/api/session?directory=<url-encoded-environment-directory>'The session has
agent: "plan"and a permissions array beginning with:{ "action": "edit", "resource": "*", "effect": "allow" } -
Compare the selected agent:
opencode api get '/api/agent'The
planagent hasedit: denyon*, with only its plan-file path allowed. The session-level allow wins over that deny.
Observed on bb 0.50.1 with OpenCode 2.4.3. I did not run a separate source build of main; I inspected the current source at 7ec9cd1f7eb7151a5049492ec015faf959507dbe, where the same rule generation remains.
Expected vs actual
Expected: selecting OpenCode's Plan agent keeps its read-only permission policy. bb's Accept Edits or Full Access setting must not silently turn Plan into a writable session.
Actual: the selected agent remains plan, but bb adds edit: allow at session scope. OpenCode's permission resolver combines the selected agent's rules followed by the session's rules, with the last matching rule winning:
- OpenCode 2.4.3 permission resolution
- bb's unconditional edit allow on current main
- bb applies those rules to the OpenCode session
Thus the UI and ACP session both say Plan while the effective edit permission is Build-like.
Evidence
- Investigation thread: @thread:thr_hshw5unaky
- bb thread:
thr_hshw5unaky; project:proj_personal; environment:env_h6ci4knuf7 - OpenCode session:
ses_dcda54dc6ffesfO50xAK75v2TS bb thread options thr_hshw5unaky --jsonreportedmode.value: "plan"; the OpenCode session and its assistant messages also reportedagent: "plan". This is not a mode-label mismatch or a fallback to thebuildagent.- The live session's permissions contained
edit: allowon*, followed by the other bb-managed rules and the thread-storage directory allow. - In the latest 100 local OpenCode sessions, 47 were Plan sessions; 42 had the blanket
edit: allow. All five exceptions were older sessions. The first five unaffected Plan sessions were created before the regression commit; affected sessions began appearing immediately afterward. This is supporting history, not a clean-version bisect. - The regression was introduced by cb627c8574af3a5916ab027b2cc549517006ad3f / #7551, which moved OpenCode 2 enforcement from
OPENCODE_PERMISSIONtoPATCH /api/session/<id>. That change correctly addressed shell approvals, but its unconditional edit allow also overrides Plan.
What you ruled out
- Not an actual switch to OpenCode Build: the session and assistant messages stay on
plan; the permission override explains the Build-like behavior. - Not a stale local installation alone: the same unconditional rule is present on
mainat7ec9cd1f7eb7151a5049492ec015faf959507dbe; no source-build runtime repro was performed. - Related to ACP: map bb permission modes and Plan onto the agent's own session modes #7536's general ACP mode/permission mapping, but not a duplicate: this is a specific OpenCode 2 session-rule regression that defeats an already-selected Plan agent.
- Searched open and closed bb issues/PRs for OpenCode Plan,
edit: allow, and session permissions; no existing report of this exact conflict found.
Suggested priority and effort
High — every OpenCode 2 Plan session created through the affected bb integration can lose its read-only boundary; no reliable bb-side workaround while retaining Plan. Likely a contained fix in opencode-session-permissions.ts, with mode-change and session-resume regression tests.
AGENT GENERATED
Activity
bb-slop-cop commentedon Dec 1, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotClassification: Bug · High priority · Medium effort ·
providers,provider-acp,securityReport: PARTIALLY REPRODUCED · medium confidence ·
partial-repro. Two clean checkouts confirmed that bb's ACP bridge applies managed session permissions without accounting for the selected agent's policy. Live file-write behavior was not tested.No PR: The fix changes permission enforcement, which is outside the simple-fix rule.