Skip to content

Commit f8f984e

Browse files
bydradevclaude
andauthored
fix: cite the open opencode issue and add the shell permission key (#149)
## What changes - The OpenCode reviewer agent, `.opencode/agents/fresh-eyes-reviewer.md` in every generated repository, now denies `shell` beside `bash`. OpenCode v1.19.3, the current npm release, keeps `bash` as the shell tool's permission key and says it will be renamed (`packages/opencode/src/tool/shell/id.ts` at `v1.19.3`), and accepts and ignores a `shell` key. The [permissions page](https://opencode.ai/docs/permissions/) for this agent format names only `shell`, and OpenCode V2 reads this format and maps its `bash` to V2's `shell` action ([Migrate from V1](https://dev.opencode.ai/v2/docs/migrate-v1/)). Under either key name the reviewer has no shell. All checked 2026-10-22. - The `fresh-eyes-review` skill and the README cite [OpenCode issue 49723](anomalyco/opencode#49723), which is open, instead of 50627, which was closed on 2026-10-20 as its duplicate (read 2026-10-22). The advice is unchanged: run the OpenCode reviewer with another model than OpenCode's free tier. - The README says that OpenCode also scans `.claude/skills`, so it logs a `duplicate skill name` warning for each mirrored skill, and that the path it lists in its system prompt can differ between sessions and cost a prompt cache miss (`skill/index.ts` and `session/system.ts` at `v1.19.3`). - `validate_templates.py` pins the new frontmatter line and requires `permission.shell: deny`, with two new self-test fixtures. - The reviewer also sets `external_directory: ask`. OpenCode V2 allows reads outside the project by default where V1 asks ([Migrate from V1](https://dev.opencode.ai/v2/docs/migrate-v1/), checked 2026-10-22), so on V2 its read tools would read outside the project unasked, against what its instructions and the README say. On V1 the agent's rule comes after OpenCode's defaults and the user's configuration, so the reviewer now also asks for directories those allow, such as OpenCode's temporary directory (except its tool output directory); the README and the upgrade note say so (`agent/agent.ts` and `permission/index.ts` at `v1.19.3`). The validator requires the value, with two more fixtures: 228 in all. Found while answering the Codex threads (finding A-38); added at the maintainer's decision. - README: a new `### Upgrading to 0.17.1` section says both files are template-owned, so `--check` reports them `stale` and `--adopt` updates them. This repository's own copies were regenerated with `./bootstrap.py --adopt . --type simple --non-interactive`, committing only those two agent files. ## User-visible User-visible: yes ## Why Findings A-30 and A-32 of the 2026-10-21 assessment, row 3.2 of its plan. Without the `shell` key, the reviewer would get a shell on an OpenCode release that has made the rename, whose shell rules cannot reliably stop a redirect. ## How it was checked On Linux with Python 3.13.16, Node 22.22.0 and a full clone, so tag-dependent tests ran: - `uv run --with pyyaml python3 validate_templates.py`: OK, 19 configurations, 228 fixtures. - `uv run --with pytest --with pyyaml python3 -m pytest -q -p no:cacheprovider`: 352 passed, 18 skipped, all of them root skips of the permission tests and one case-insensitive filesystem test. - `node --test templates/*.test.mjs`: 73 pass. `templates/*.mjs` is unchanged, so Prettier and ESLint were not needed. - Rendered Markdown lint on 316 files and repository Markdown lint on 17 files with `[email protected]`: 0 issues. - A `nextjs` repository rendered from `main` at `761f2f7`: this branch's `--check` reports both files `stale`, and `--adopt` updates them; the reviewer then has `shell: deny`. - No em or en dash on any added line. - Not run: OpenCode itself, on 1.19.3 or V2. Reviews: a fresh-eyes review by a separate Claude agent found no blocking findings; its P3 (the `check_reviewer_agents` docstring) and its note on the 2.0 wording are fixed in `b32d581`. Two Codex threads are answered and resolved: the duplicate-skill cost holds and is fixed in `6960681`; the permissions-page claim does not reproduce, and its V2 point is cited in `6960681`. The `external_directory` commit, `37af2e0`, passed the same checks (pytest 352 passed, 18 skipped; both Markdown lints 0 issues). A follow-up review (R2) found no blocking findings; its P2 on the V1 wording is fixed in `6b051e6`. ## Checklist - [x] The title is a Conventional Commit subject, and the pull request makes one change - [x] Every commit is signed off (`git commit -s`; see CONTRIBUTING.md) - [x] Tests and docs are updated for the changed behaviour fix: make the opencode reviewer ask before reading outside the project --- *Prepared with the assistance of Claude Code (Claude Opus 5.5).* --------- Signed-off-by: Claude <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent 761f2f7 commit f8f984e

6 files changed

Lines changed: 75 additions & 17 deletions

File tree

‎.agents/skills/fresh-eyes-review/SKILL.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: fresh-eyes-review
33
description: >-
44
Use before declaring substantial work complete or a branch or pull request ready for review, after review fixes cause material changes, or when handling the findings of any review. Covers who reviews, what to hand the reviewer, how to verify, fix or dispute findings, when to review and re-review, and a cross-family recipe using a read-only reviewer from another model family. The reviewer follows `review-guidelines`.
55
---
6-
<!-- gh-repo-bootstrapper: template-owned; sha256=59eaf9bfd32ba3c06789cc27c5edc80e1f059f9a39a214d9bf088baeb3a2c7b2 -->
6+
<!-- gh-repo-bootstrapper: template-owned; sha256=1c0fc2c70eead72ba511e275330344d7fbeb4e24ae0ea4153e3133ecc161ebee -->
77

88
# Independent fresh-eyes review
99

@@ -62,7 +62,7 @@ what each round changed, and your recommendation.
6262

6363
OpenCode's free-tier models on its own provider currently refuse an agent whose
6464
shell is denied, as this repository's OpenCode reviewer's is, with "can only be
65-
used from within OpenCode" (OpenCode issue 50627, open on 2026-10-16). Run that
65+
used from within OpenCode" (OpenCode issue 49723, open on 2026-10-22). Run that
6666
reviewer with another model or use another reviewer; don't loosen its
6767
permissions.
6868

‎.opencode/agents/fresh-eyes-reviewer.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ permission:
55
edit: deny
66
task: deny
77
bash: deny
8+
shell: deny
9+
external_directory: ask
810
---
9-
<!-- gh-repo-bootstrapper: template-owned; sha256=a7376259be1bc7acd5f1c9522d8a98354b3eed80c46a98cf32ab7b03bfff7d7f -->
11+
<!-- gh-repo-bootstrapper: template-owned; sha256=8d30cedefc57050c4650137e5f2f51787bd45833aaeadbbb88990fe1b62b0fd4 -->
1012

1113
Load the `review-guidelines` skill (`.agents/skills/review-guidelines/SKILL.md`) and follow it; if the change under review edits that file, ask for the base branch's copy and follow that, or the head copy when the base branch has none. You have no shell: review the diff, its base and head commits, and the validation results the implementer or person gives you or saved for you, and for a follow-up review the last report and the commits since; if you were not given the diff, ask for it before reviewing. Read files with the read tools, which ask the user before reading most paths outside the project, such as a scratch directory. Do not modify files. Report in the skill's format, with file:line evidence.

‎README.md‎

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,14 @@ screenshot-review process when it has one.
273273
Each skill is mirrored as a relative symlink,
274274
`.claude/skills/<name>` to `../../.agents/skills/<name>`, because Claude Code
275275
doesn't scan `.agents/` but does follow symlinked skill folders. Codex,
276-
OpenCode and Antigravity read `.agents/skills` directly. The generated
276+
OpenCode and Antigravity read `.agents/skills` directly. OpenCode also scans
277+
`.claude/skills`, so it finds each skill twice and logs a `duplicate skill
278+
name` warning for each one. Both copies are the same file, so the skill's text
279+
is the same, but OpenCode loads them concurrently and lists the copy it kept,
280+
by path, in its system prompt, so that path can differ between sessions and
281+
cost a prompt cache miss (`skill/index.ts` and `session/system.ts` in
282+
[OpenCode v1.19.3](https://github.com/anomalyco/opencode/tree/v1.19.3),
283+
checked 2026-10-22). The generated
277284
`.gitignore` ignores `.agents/*` and `.opencode/*` but re-includes
278285
`!.agents/skills/` and `!.opencode/agents/`, so these files are committed.
279286

@@ -332,17 +339,32 @@ default allows them, so a connected server's write tools stay available to it.
332339
It reviews the diff and validation results the implementer or person hands
333340
it, asks for the diff when it has none, and reads files with OpenCode's read
334341
tools, which ask before reading most paths outside
335-
the project, such as a diff saved to a scratch directory. It gets no shell
342+
the project, such as a diff saved to a scratch directory. It sets
343+
`external_directory: ask` for that, since OpenCode V2 allows those reads
344+
without asking by default, where V1 asks
345+
([Migrate from V1](https://dev.opencode.ai/v2/docs/migrate-v1/), checked
346+
2026-10-22). On V1 the agent's rule comes after OpenCode's defaults and the
347+
user's own configuration, so the reviewer also asks for the directories those
348+
allow, such as OpenCode's temporary directory, except its tool output
349+
directory (`agent/agent.ts` and `permission/index.ts` in v1.19.3, checked
350+
2026-10-22). It gets no shell
336351
because OpenCode's shell rules see each command in a line separately and keep
337352
a redirect only when it sits directly on one command, so an allowed `git log`
338353
still writes in `git diff && git log > notes` (`tool/shell.ts`,
339354
`session/tools.ts` and `agent/agent.ts` in
340355
[OpenCode v1.19.3](https://github.com/anomalyco/opencode/tree/v1.19.3), the
341-
current npm release, checked 2026-10-16).
356+
current npm release, checked 2026-10-16). It denies both `bash` and `shell`.
357+
OpenCode v1.19.3 keeps `bash` as the shell tool's permission key, says it will
358+
be renamed (`tool/shell/id.ts`), and accepts and ignores a `shell` key. The
359+
[permissions page](https://opencode.ai/docs/permissions/) for this agent
360+
format names only `shell`. OpenCode V2 reads this format and maps its `bash`
361+
to V2's `shell` action
362+
([Migrate from V1](https://dev.opencode.ai/v2/docs/migrate-v1/)). All three
363+
were checked 2026-10-22; under either key name, the reviewer has no shell.
342364
OpenCode's free-tier models on its own provider currently refuse an agent
343365
whose shell is denied, with "OpenCode's free tier can only be used from within
344-
OpenCode" ([OpenCode issue 50627](https://github.com/anomalyco/opencode/issues/50627),
345-
open on 2026-10-16), so run this reviewer with another model. `bash: ask` or a
366+
OpenCode" ([OpenCode issue 49723](https://github.com/anomalyco/opencode/issues/49723),
367+
open on 2026-10-22), so run this reviewer with another model. `bash: ask` or a
346368
narrow allow rule avoids that error, but a command that yields no pattern,
347369
such as a bare `> file`, skips the shell check, so either would let the
348370
reviewer write.
@@ -680,6 +702,19 @@ of `PATH` mid-run), so do not run it while an editor, agent, or build is
680702
writing to the same checkout. A failure on one file is reported as `refused`
681703
without stopping the others, and `--adopt` exits 1 when it refused anything.
682704

705+
### Upgrading to 0.17.1
706+
707+
The OpenCode reviewer, `.opencode/agents/fresh-eyes-reviewer.md`, now denies
708+
`shell` beside `bash`, so it still has no shell once OpenCode renames the
709+
permission key, and sets `external_directory: ask`, so it asks before reading
710+
outside the project on OpenCode V2, which allows that by default. On V1 it now
711+
also asks for directories that OpenCode's defaults or your own `opencode.json`
712+
allow, such as OpenCode's temporary directory. The `fresh-eyes-review`
713+
skill cites
714+
[OpenCode issue 49723](https://github.com/anomalyco/opencode/issues/49723)
715+
instead of 50627, which was closed on 2026-10-20 as its duplicate. Both files
716+
are template-owned: `--check` reports them `stale` and `--adopt` updates them.
717+
683718
### Upgrading to 0.17.0
684719

685720
`nextjs`: the generated `.prettierignore` now lists

‎templates/agents/opencode-fresh-eyes-reviewer.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ permission:
55
edit: deny
66
task: deny
77
bash: deny
8+
shell: deny
9+
external_directory: ask
810
---
911

1012
Load the `review-guidelines` skill (`.agents/skills/review-guidelines/SKILL.md`) and follow it; if the change under review edits that file, ask for the base branch's copy and follow that, or the head copy when the base branch has none. You have no shell: review the diff, its base and head commits, and the validation results the implementer or person gives you or saved for you, and for a follow-up review the last report and the commits since; if you were not given the diff, ask for it before reviewing. Read files with the read tools, which ask the user before reading most paths outside the project, such as a scratch directory. Do not modify files. Report in the skill's format, with file:line evidence.

‎templates/skills/fresh-eyes-review/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ what each round changed, and your recommendation.
6161

6262
OpenCode's free-tier models on its own provider currently refuse an agent whose
6363
shell is denied, as this repository's OpenCode reviewer's is, with "can only be
64-
used from within OpenCode" (OpenCode issue 50627, open on 2026-10-16). Run that
64+
used from within OpenCode" (OpenCode issue 49723, open on 2026-10-22). Run that
6565
reviewer with another model or use another reviewer; don't loosen its
6666
permissions.
6767

‎validate_templates.py‎

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -468,10 +468,19 @@ def _skill_path(name: str) -> str:
468468
# permission keys placed before `permission`'s own (ConfigAgentV1.normalize in
469469
# packages/core/src/v1/config/agent.ts), so `tools: {bash: false, "*": true}`
470470
# would end with `"*": allow` and reopen the shell.
471+
# The shell's key is `bash` in OpenCode v1.19.3, which says it will be renamed
472+
# (packages/opencode/src/tool/shell/id.ts) and accepts any key, and `shell` in
473+
# opencode.ai/docs/permissions; OpenCode V2 maps this format's `bash` to its
474+
# `shell` action (dev.opencode.ai/v2/docs/migrate-v1, all checked 2026-10-22).
475+
# So the reviewer denies both. OpenCode V2 allows external_directory by
476+
# default where V1 asks (same guide), so the reviewer asks, keeping its read
477+
# tools from reading outside the project unasked.
471478
OPENCODE_REVIEWER_PERMISSIONS = {
472-
"edit": "",
473-
"task": " so it cannot launch a writer",
474-
"bash": " so it has no shell, whose rules cannot reliably stop a redirect",
479+
"edit": ("deny", ""),
480+
"task": ("deny", " so it cannot launch a writer"),
481+
"bash": ("deny", " so it has no shell, whose rules cannot reliably stop a redirect"),
482+
"shell": ("deny", " so it has no shell once OpenCode renames the bash key"),
483+
"external_directory": ("ask", ", since OpenCode V2 otherwise reads outside the project without asking"),
475484
}
476485
OPENCODE_REVIEWER_KEYS = ("description", "mode", "permission")
477486
# OpenCode reads frontmatter with gray-matter and js-yaml 3, which differ from
@@ -482,7 +491,10 @@ def _skill_path(name: str) -> str:
482491
# then exactly these lines. The description starts with a letter, so neither
483492
# parser reads it as a number, and must read back as its own text, so no tag,
484493
# quote, anchor, flow mapping or comment changes it.
485-
OPENCODE_REVIEWER_FRONTMATTER = ("mode: subagent", "permission:", " edit: deny", " task: deny", " bash: deny")
494+
OPENCODE_REVIEWER_FRONTMATTER = (
495+
"mode: subagent", "permission:", " edit: deny", " task: deny", " bash: deny", " shell: deny",
496+
" external_directory: ask",
497+
)
486498
OPENCODE_REVIEWER_DESCRIPTION_RE = re.compile(r"description: [A-Za-z][ -9;-~]*")
487499
SCREENSHOT_SKILL = _skill_path("screenshot-review")
488500
SCREENSHOT_POINTER = "`docs/screenshot-review.md` (repository root)"
@@ -1021,7 +1033,8 @@ def _tool_names(tools) -> set:
10211033
def check_reviewer_agents(label: str, files: dict) -> list:
10221034
"""Both fresh-eyes reviewer agents leave the model unset and get no edit
10231035
tool. OpenCode's frontmatter holds only OPENCODE_REVIEWER_KEYS and sets
1024-
only the edit, task and bash permissions, each to deny; Claude Code's
1036+
only the edit, task, bash and shell permissions, each to deny, and
1037+
external_directory to ask; Claude Code's
10251038
keeps Bash and says to use it only for read-only commands."""
10261039
errors = []
10271040
for path in (CLAUDE_REVIEWER, OPENCODE_REVIEWER):
@@ -1068,9 +1081,9 @@ def check_reviewer_agents(label: str, files: dict) -> list:
10681081
)
10691082
permission = data.get("permission")
10701083
permission = permission if isinstance(permission, dict) else {}
1071-
for key, why in OPENCODE_REVIEWER_PERMISSIONS.items():
1072-
if permission.get(key) != "deny":
1073-
errors.append(f"[{label}] {path} must set 'permission.{key}: deny'{why}")
1084+
for key, (action, why) in OPENCODE_REVIEWER_PERMISSIONS.items():
1085+
if permission.get(key) != action:
1086+
errors.append(f"[{label}] {path} must set 'permission.{key}: {action}'{why}")
10741087
others = sorted(str(key) for key in permission if key not in OPENCODE_REVIEWER_PERMISSIONS)
10751088
if others:
10761089
errors.append(
@@ -4423,6 +4436,12 @@ def skill(path_name: str, front: str) -> dict:
44234436
"must say"),
44244437
("opencode task allowed", OPENCODE_REVIEWER, "task: deny", "task: allow", "permission.task: deny"),
44254438
("opencode shell open", OPENCODE_REVIEWER, "bash: deny", "bash: allow", "permission.bash: deny"),
4439+
("opencode renamed shell open", OPENCODE_REVIEWER, "shell: deny", "shell: allow", "permission.shell: deny"),
4440+
("opencode renamed shell missing", OPENCODE_REVIEWER, "\n shell: deny", "", "permission.shell: deny"),
4441+
("opencode outside reads allowed", OPENCODE_REVIEWER, "external_directory: ask", "external_directory: allow",
4442+
"permission.external_directory: ask"),
4443+
("opencode outside reads unset", OPENCODE_REVIEWER, "\n external_directory: ask", "",
4444+
"permission.external_directory: ask"),
44264445
("opencode shell allow rule", OPENCODE_REVIEWER, "bash: deny",
44274446
'bash:\n "*": deny\n "git diff *": allow', "permission.bash: deny"),
44284447
("opencode later wildcard allow", OPENCODE_REVIEWER, "bash: deny", 'bash: deny\n "*": allow',

0 commit comments

Comments
 (0)