opencode.tools adds the execute / session_move hint even when Code Mode is denied
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 67/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
调研方向
内置的 opencode.tools 插件会向 context、compaction 和 generate 请求添加提示,而 Tool.snapshot 决定 execute 是否可用。阅读这些入口,并追踪会话代理的权限规则如何传递到插件;检查现有的工具快照或系统提示词部分相关测试。完成标准是:对于 execute 被完全禁止的会话,不添加该提示;其他情况下则仍可使用该提示。
由索引模型根据 Issue 内容生成。
描述
Description
When Code Mode is turned off with a permission rule ({ "action": "execute", "resource": "*", "effect": "deny" }), Tool.snapshot doesn't build the execute tool (codeModeEnabled = !whollyDisabled("execute", rules)), but the built-in opencode.tools plugin still adds this system part to every context, compaction and generate request:
When you create a worktree outside the current working directory and intend to use it as your primary working directory, consider using
executeto calltools.opencode.session_moveand make the worktree the session's working directory.
The model is told to use a tool it isn't offered (and tools.opencode.* are Code Mode only, so they aren't reachable either).
Expected: skip the hint when execute is wholly denied for the session's agent.
Related: #48749 (the hint now also reaches compaction and generate requests).
Plugins
Own plugins via the SDK (embedded host); the hint comes from the built-in opencode.tools.
OpenCode version
@opencode/core 2.0.32
Steps to reproduce
- Config with
"permissions": [{ "action": "*", "resource": "*", "effect": "allow" }, { "action": "execute", "resource": "*", "effect": "deny" }]. - Send a prompt.
- The request has no
executetool, but its system prompt still contains theexecute/tools.opencode.session_movehint.
- 主要语言
- TypeScript
- 星标
- 215k
- 派生
- 28.9k
- 平均合并
- 6 小时 8 分钟
- 30 天内合并 PR
- 411
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
anomalyco/opencode 的其他 Issue
-
pending close triaging
难度 2/5 1-3 小时 新手友好度 65/100
anomalyco/opencode#57939 · 1 条评论 ·
维护者通常 1 天内回复
-
reproduced
难度 2/5 1-3 小时 新手友好度 65/100
anomalyco/opencode#57911 · 2 条评论 ·
维护者通常 1 天内回复
-
pending close triaging
难度 2/5 1-3 小时 新手友好度 72/100
anomalyco/opencode#57907 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
anomalyco/opencode#57855 · 1 条评论 ·
维护者通常 1 天内回复
-
opencode api truncates large output when stdout is a pipe (un-awaited write before process.exit)未关闭pending close triaging
难度 2/5 1-3 小时 新手友好度 72/100
anomalyco/opencode#57816 · 1 条评论 ·
维护者通常 1 天内回复
查看 anomalyco/opencode 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
maniator/verticopolis#1303 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 73/100
components-web-app/docs#297 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
appwrite/mcp-for-docs#23 · 1 条评论 ·
-
`@vanilla-extract/turbopack-plugin`: "getImageSize is not a function" with Next.js 16.4.x when a `.css.ts` file imports an image可能已有人在做 @aevarOrigo 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
vanilla-extract-css/vanilla-extract#1799 · 1 条评论 ·
-
native
难度 2/5 1-3 小时 新手友好度 72/100
prime-radiant-inc/evener#4839 ·
维护者通常 1 天内回复