Repository navigation
feat(server): OpenCode Captains propose a Crew without a native prompt - #302
bryantderosier wants to merge 3 commits into
Conversation
OpenCode checked propose_crew and the other J5 verbs against its own permission rules, so an OpenCode thread asked for them in interactive modes and denied them under a read-only `never` policy. The permission rules now end with allow rules for the shared J5 pre-approval set, which matches Codex and Claude. The allows come last because OpenCode rules are last-match-wins. Child task sessions inherit them. Other t3-code tools keep OpenCode's verdict. The allows are installed only when T3 injected its own t3-code server into the session, which never happens on an external OpenCode server. OpenCode keys an MCP tool as `sanitize(server)_sanitize(tool)`, so a server named `t3-code_send` with a tool `message` would also answer to `t3-code_send_message`. When any other MCP server's sanitized name starts with `t3-code_`, or OpenCode cannot list its servers, no allows are installed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository: Jacksondr5/j5code/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: Comment |
FORK.md: this branch's OpenCode case is renumbered 44 → 46, since the sync took cases 40–45; the inventory count and the OpenCodeAdapterV2.ts table row follow (the row pointed at case 40 before). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Closing (Jackson, 2026-09-26). Per the ruling on #233, J5 pre-approves its tools only on Codex and Claude. Other harnesses may show their own MCP prompt once before the roster card, which is acceptable. OpenCode would be simple, but there aren't enough users to justify the extra fork surface in an upstream adapter. A general fix for T3's own MCP tools belongs upstream and is tracked in #276. Thanks for the careful work here: the review surfaced real upstream gaps, which are now recorded. |
|
Reopened: closing it was my overreach, not Jackson's call. The decision above stands (per #233, J5 won't pre-approve its tools on this harness), so it won't merge. @bryantderosier, closing it is yours to do whenever you like. |
|
@Jacksondr5 Closing this per your ruling on #233: J5 pre-approves its tools only on Codex and Claude, and a OpenCode Captain may show its own MCP prompt once before the roster card. The general fix for T3's own MCP tools is tracked upstream in #276. Thanks for the panel's review; the gaps it found are recorded there. I'm closing #265 as not planned for the same reason. |
…301) * refactor(server): share one J5 tool pre-approval list across harnesses Codex and Claude each kept their own copy of the J5 tools they pre-approve. Move the list, the interactive-mode coordination subset, and the approval-policy-never check into j5ToolPreapproval.ts so every adapter append spreads the same set. Codex and Claude produce the same config as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(crews): every shipped adapter can be a Captain Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(crews): Codex and Claude are where the roster card is the only human step Per Jackson's ruling on #233, J5 pre-approves its tools on Codex and Claude only. crews.md AC5, the "Any harness can captain" bullet, its History line, and the Crews section of the personas guide now say that other harnesses may ask once with their own MCP prompt before the roster card, and a read-only persona there can't propose. The never-pre-approved testkit list is scoped to J5's own appends and names Claude's upstream mcp__t3-code__* wildcard as the exception. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * docs(server): the shared pre-approval list is for Codex and Claude FORK.md, j5ToolPreapproval.ts, and the testkit still described every harness pre-approving the set, with later adapter appends to come. Under Jackson's ruling on #233 only Codex and Claude do, and #302–#304 are closed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Important
This PR is part of the Captains stack. Merge top to bottom, one at a time; each PR is based on the one above it. The stack has no migrations and no ordering against the other Crews PRs.
Problem
An OpenCode Captain couldn't propose a Crew without an extra step (#265). OpenCode checks each MCP tool as its own permission (
<server>_<tool>), and the adapter's policy seeds* denythen* ask. Sopropose_crewraised a native OpenCode prompt in interactive modes, and a read-only persona's policy hid it entirely.What I changed
apps/server/src/j5/a2a/mcp/openCodeToolApproval.ts(new):j5OpenCodeAllowsT3McpToolsdecides whether the allows are safe for this session;j5OpenCodePermissionRulesbuilds onet3-code_<tool>allow per name inj5PreapprovedTools(policy).OpenCodeAdapterV2.ts(upstream, FORK.md case 46):openCodePermissionRulespushes the J5 rules as its last statement.j5OpenCodeAllowsT3McpTools(client, hasT3Mcp)check runs aftermcp.add.session.update, bothsession.create), defaulting tofalse.docs/user/personas.md: OpenCode moves to the harnesses that never add a step; an external OpenCode server still can't propose.Why this shape
OpenCode's rules match last-wins, so appending allows at the end is the one place they take effect without rewriting upstream's policy. I rejected a wildcard
t3-code_*allow: that would also wave through worktree handoff, preview, and scheduling.Invariants
t3-codeserver (never on an external OpenCode),mcp.statusreports itconnected, and no other server's sanitized name starts witht3-code_. A server namedt3-code_sendwith a toolmessagewould also producet3-code_send_message, and the check blocks that. A status error means no allows.return rules;, and full access still returns its early* allowwithout reaching it.Surfaces
packages/contracts)OpenCodeAdapterV2.ts, recorded as FORK.md case 46.docs/user/personas.md.Out of scope
j5/main.Upgrade and data
None.
Verification
openCodeToolApproval.test.ts: over the shared policy matrix, the effective last-matching rule is allow exactly for the shared set; handoff, preview, and scheduling keep OpenCode's verdict; child sessions match the parent; the collision check and the fail-closed status paths are covered.OpenCodeAdapterV2.test.tsunchanged and passing.Review focus
j5OpenCodeT3McpKeysAreOurs: is OpenCode's sanitizer ([^a-zA-Z0-9_-]→_) the only way two server names can produce the same key prefix?Closes #265
Claude Opus 5.5 via Claude Code
🤖 Generated with Claude Code