Skip to content

feat: skip LLM for /review:auto using noReply#6

Open
Svtter wants to merge 3 commits into
mainfrom
feat/noReply-review-auto
Open

feat: skip LLM for /review:auto using noReply#6
Svtter wants to merge 3 commits into
mainfrom
feat/noReply-review-auto

Conversation

@Svtter
Copy link
Copy Markdown
Contributor

@Svtter Svtter commented May 22, 2026

Summary

  • Add noReply: true to review:auto command config
  • Add command.execute.before hook to handle toggle logic directly
  • Remove dependency on LLM to parse args and call toggle_auto_review tool

Before

/review:auto off
  → LLM parses "off"
  → LLM calls toggle_auto_review(enabled: false)
  → State changed
  (~1-2s, wastes tokens)

After

/review:auto off
  → hook parses args
  → State changed directly
  → Result shown instantly
  (0 tokens, instant)

Dependencies

Closes #5

Test plan

  • opencode run --command review:auto -- "off" exits instantly, no LLM call
  • opencode run --command review:auto -- "on" exits instantly, no LLM call
  • Verified with local opencode build containing noReply support

🤖 Generated with Claude Code

Replace the LLM-dependent toggle flow with a direct command.execute.before
hook that parses arguments, toggles state, and returns the result instantly.

Before: user types /review:auto off → LLM parses args → LLM calls tool → state changed
After:  user types /review:auto off → hook parses args → state changed → result shown

Requires opencode noReply support (anomalyco/opencode#28792).

Closes #5

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

以下是对 PR 的审查结论。

有条件合并

该 PR 通过添加 noReply: truecommand.execute.before 钩子绕过了 LLM,直接处理 /review:auto on/off 切换逻辑,方向合理,能显著减少延迟和 token 消耗。

阻塞项

  1. args.includes("on") / args.includes("off") 字符串匹配过于宽泛includes 是子串匹配,输入 "none" 会误触发 on 分支("none".includes("on") === true),同样 "office" 会误触发 off 分支。建议改为精确匹配 args === "on" / args === "off",或在 else 分支里对无参做更严格的区分。

  2. buildTogglePrompt 引入后未被使用src/index.ts:3 仍 import 了 buildTogglePrompt,但不再引用。在严格 lint 环境下会导致编译报警或报错,应移除。

建议项

  1. toggle_auto_review tool 已不再被 review:auto 命令流程触发,但在 src/index.ts:91-94 仍注册在 tool 对象中。虽然是"存在但不冲突"的状态,但如果确定不作为其他入口使用,建议一并清理,避免后续维护混淆。

  2. 依赖未发布的核心功能noReplycommand.execute.before 依赖于 opencode 核心 PR #28763。合入前需确认该 PR 已合并发布,否则运行时行为不可预期。

New%20session%20-%202026-05-22T04%3A14%3A54.344Z
opencode session  |  github run

`args.includes("on")` would match "song", "done", etc.
Changed to exact match (`===`) or prefix with space (`startsWith("on ")`).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

不可合并

PR 方向合理(跳过 LLM 直接处理 review:auto),但当前 HEAD (56bbc26) 存在一个阻塞问题。

阻塞项

  1. buildTogglePrompt 死导入未清理src/index.ts:3import { buildTogglePrompt },但文件中已无任何调用(模板已改为裸字符串 "Toggle auto-review")。严格 linter/TypeScript 环境下 noUnusedLocals 会报错,应移除该导入。

建议项

  1. toggle_auto_review tool 注册可考虑移除src/index.ts:91-94 仍注册了 toggle_auto_review tool,但 review:auto 已不再经过 LLM,该 tool 已无触发入口。建议同步清理 src/index.ts:5createToggleAutoReviewTool 导入及 tool 注册,减少维护负担。
  2. agent.ts 中的 buildTogglePrompt 函数 — 该函数内容(第 325–343 行)专为旧版 LLM 路由 review:auto 设计,现已死代码。建议评估是否一并清理。
  3. 依赖未发布的核心功能noReplycommand.execute.before hook 依赖 opencode 核心 PR #28763,合入前需确认该 PR 已合并发布,否则运行时行为不可预期。

New%20session%20-%202026-05-22T12%3A46%3A34.227Z
opencode session  |  github run

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

所有之前的阻塞问题已在后续提交中修复。当前 HEAD 审查结论如下:

可合并

变更摘要:review:auto 命令通过 noReply: true + command.execute.before hook 直接处理切换逻辑,无需调用 LLM。两个早期阻塞问题已在 56bbc26(精确匹配 on/off 参数)和 a877138(移除未使用的 buildTogglePrompt 导入)中修复。

阻塞项:无

建议项:

  1. agent.ts:323buildTogglePrompt 函数已成死代码 — 不再被任何模块导入或调用,建议清理
  2. toggle_auto_review tool 注册可考虑移除src/index.ts:91-94 注册的 tool 及其导入(第 5 行 createToggleAutoReviewTool)已不再被 review:auto 流程触发,建议评估是否一并清理
  3. 依赖未发布的核心功能noReplycommand.execute.before 依赖 opencode 核心 PR #28763,合入前需确认该 PR 已合并发布,否则运行时行为不可预期

New%20session%20-%202026-05-22T15%3A15%3A17.379Z
opencode session  |  github run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: support LLM-free command execution (follow upstream #28292)

1 participant