Repository navigation
fix: opencode 2.0.19+ support (team_spawn, worktrees, teammate edits, read-only agents) - #46
Conversation
Fixes hueyexe#40 against OpenCode 2.0.24: - session.create: only call permission.rules() when the host still has it (2.0.3-2.0.18). Since 2.0.19 the session ruleset merges after the agent's (core permission.ts merge(agent, session) with last-match evaluation), so create() permissions are enough and rules() no longer exists. - worktree create/list/remove/refresh: pass the location's projectID, which the 2.0.19+ worktree API requires; worktree creation silently failed without it and every teammate shared the base tree. - team_spawn: also allow `edit *` for worktree teammates. V2 checks files inside the session location as relative paths, so the absolute `<worktree>/**` rule never matched and edits fell back to an ask nobody could answer. Files outside the worktree stay behind external_directory. - team_spawn: detect read-only agents from the agent's own permission rules (agent.get) instead of only the names plan/explore, so custom reviewer agents are not given a worktree and `shell * allow`. - team_tasks_add: reject unknown depends_on IDs up front instead of creating a task that can never unblock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GUtz6gBn7rhXaufK97d8cm
OpenCode 2.0.32 creates worktrees with `git worktree add --detach`, so a teammate's commits landed on a detached HEAD and team_merge failed with "not something we can merge". When the new worktree has no branch, create the requested branch in it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GUtz6gBn7rhXaufK97d8cm
…ty, isolation warning - team_spawn: bind session to the worktree directory when workspace binding is unavailable, so the 'edit * allow' rule scopes to the worktree instead of the whole shared tree - v2-client: gitCreateBranch now returns the effective branch (or null); logs failures and falls back to 'git switch' for the existing-branch re-spawn race. worktree.create records the effective branch only — a failed create can no longer point team_merge at a stale same-named branch whose commits would silently shadow new work - v2-client: guard ctx.permission?.rules against a missing permission domain - team_spawn: spawn result now warns plainly when worktree isolation did not complete (cherry-picked from PR #41, issue #40 bug 2) - tests: branch-failure error path, cross-team depends_on rejection (from PR #41)
|
Merged — thank you for the comprehensive 2.x compat work. Post-merge review applied four follow-up fixes on top (commit 024967a): (1) |
fixes the
team_spawncrash + silent worktree failure from #40 on opencode 2.0.19+, plus the stuff that still stops teammates from working after that.vs #41 / #43
both guard
ctx.permission.rules, #41 also validatesdepends_on. this does both, plus:▸ worktree root cause: #41 adds a warning but couldn't find why
worktree.createmade nothing. 2.0.19+ worktree endpoints need aprojectID. ensemble never sent one → creation failed → everyone shared the base tree. now passesctx.location.project.idto create/list/remove/refresh▸ detached worktrees (2.0.32+): opencode now does
git worktree add --detach(packages/core/src/git.ts). teammate commits land on a detached HEAD →team_merge: "not something we can merge". if the new worktree has no branch, ensemble creates it▸ edits stuck on approval: v2 checks in-location files as relative paths, so
edit <worktree>/** allownever matched → ask nobody answers. worktree teammates also getedit * allow. outside-the-worktree stays behindexternal_directory▸ read-only detection: was name-only (
plan,explore). custom reviewers got a worktree +shell * allow. now reads the agent's own rules viaagent.get, names as fallbacknot touched: the 4th #40 thing (notifications redelivered after purge).
on
permission.rules: since 2.0.19 core merges session rules after agent rules (merge(agent, session), last match wins), so thesession.createpermissions already win. skippingrules()when it's gone loses nothing.verification
✓
bun run typecheckclean✓
bun test857 pass / 0 fail (new: projectID pass-through, detached naming, read-only from rules,edit *, unknowndepends_on)✓
bun run lintonly pre-existing warnings✓ live on 2.0.24 + 2.0.32:
✗ not verified: subagent-mode teammates (
exploreetc.) on opencode's freebig-pickle. they get "free tier can only be used from within OpenCode", built-ins too, so it looks like a host/provider thing, not ensemble.🤖 Generated with Claude Code
https://claude.ai/code/session_01GUtz6gBn7rhXaufK97d8cm