Skip to content

team_spawn fails on OpenCode 2.0.29: ctx.permission.rules is not a function #45

Closed

Description

@nixaut-codelabs

Version: opencode-ensemble 0.18.0, OpenCode 2.0.29 (server), Linux

What happens:
team_spawn always fails with:

Failed to create session for teammate "scout": ctx.permission.rules is not a function. (In 'ctx.permission.rules({ sessionID: created.id, permissions })', 'ctx.permission.rules' is undefined)

Team creation, the task board (tasks_add/list), and team_cleanup all work — only spawn is broken.

Where: src/v2-client.ts line ~122:

const created = await ctx.session.create(input)
if (permissions) {
  await ctx.permission.rules({ sessionID: created.id, permissions })
}

ctx.permission.rules no longer exists on the V2 plugin context in 2.0.29 (the call throws is not a function, meaning the property is undefined).

Local workaround I tested: replacing the call with

await ctx.session.update({ sessionID: created.id, permissions })

makes team_spawn succeed and the teammate session starts (spawns fine afterwards).

Ask: port the permission re-assertion to the current V2 context API (or guard it if the API moved elsewhere), so ensemble works on current OpenCode 2.0.x servers. Happy to test a fixed release.

Activity

  1. hueyexe commented on Oct 19, 2026

    @hueyexe
    Owner

    Fixed. The unguarded ctx.permission.rules call in src/v2-client.ts is now feature-detected (typeof ctx.permission?.rules === "function"), so team_spawn works on OpenCode 2.0.19+ where the API no longer exists — session.create permissions are honored there because session rules merge last (see the merge-order comment at the call site). Landed via #46 plus post-merge review fixes (commit 024967a), shipping in v0.20.0. Heads-up: v0.19.0 never actually reached npm (an expired publish token broke the pipeline), so opencode upgrade/cache clears kept handing you 0.18.0 — v0.20.0 is the first release since 0.18.0 to land on npm.

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

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions