tui: permission prompt does not display message set by permission.evaluate hook

未关闭 适合新手
#67,437 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@ningsiyuan1024 已经在做这个了。

开始于 2026年12月1日。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
74/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript

调研方向

跟踪显示 Permission required 的 TUI 权限提示,并检查它如何接收 Permission.Request。首先在 TUI 代码中搜索该提示和 request.message;issue 指出携带消息的是 permission.asked 事件。对于已升级的请求,提示显示提供的消息后即完成。

由索引模型根据 Issue 内容生成。

描述

area/tui platform/macos status/repro-simulated type/bug version/v2

Summary

When a server plugin sets event.message in a permission.evaluate hook and escalates to effect = "ask", OpenCode's server attaches message to Permission.Request and sends it in permission.asked, but the TUI permission prompt never renders it.

Environment

  • opencode version: 2.4.3
  • Client: TUI
  • Model and provider: Not relevant
  • OS: Darwin 25.6.0 (darwin arm64)
  • Terminal: TERM_PROGRAM=ghostty, TERM=xterm-256color, COLORTERM=truecolor
  • Shell: /bin/zsh
  • Install/channel: latest
  • Active plugins: @mattietk/opencode-clef-guard@latest (opencode.json); @mattietk/opencode-queue-steer@latest, @mattietk/opencode-session-diff@latest, @mattietk/opencode-session-tree@latest (cli.json)

Reproduction

  1. Register a server plugin with a permission.evaluate hook that escalates an action to ask with a message:
    await ctx.permission.hook("evaluate", (event) => {
      if (event.action === "shell") {
        event.effect = "ask"
        event.message = "Flagged by policy (score 0.68 >= 0.40)"
      }
    })
    
  2. Trigger a shell tool call in a TUI session.
  3. Observe the permission prompt displayed in the TUI.

Expected Behavior

Per the Server plugins documentation ("message appears in an escalated permission request or becomes the denial reason"), the TUI permission prompt should display request.message so the user can see why the plugin escalated the action.

Actual Behavior

The TUI permission prompt only shows Permission required, the action/command details, and the approval options (Allow once, Allow always, Reject). request.message is never displayed, even though Permission.Request.message is present in the permission.asked event and in context.data.session.permission.list(sessionID).

Additional Context

  • Reproducible consistently for every permission action (shell, edit, webfetch, external_directory).
  • Workaround: shipping a companion ./tui plugin that reads context.data.session.permission.list(sessionID) and renders request.message in the session.composer.top slot above the prompt.
主要语言
TypeScript
星标
230k
派生
31.3k
平均合并
5 小时 59 分钟
30 天内合并 PR
473

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。