[BUG]: plugin-recorded compaction result renders an unlabeled compaction row in the TUI

未关闭
#65,251 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

Start by locating the TUI transcript renderer for the compaction divider and tracing where it subscribes to session.compaction.delta. Compare that path with the plugin-result path, where session.compaction.ended carries text and the durable compaction message carries summary; the row must read from one of those when no deltas arrive. Reproduce with the minimal plugin plus /compact, then confirm the row shows a label and the recorded summary while omitting tokens/cost when absent.

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

描述

area/tui platform/linux type/bug version/v2
Description

Description

When a compaction hook returns result — the documented way for a plugin to supply the
compaction itself and skip the summarizer call — the compaction divider is drawn in the TUI
transcript, but the row is empty: no label, no summary content, no usage. A standard
(summarizer-run) compaction renders a labeled row with the streamed summary.

The text that belongs in the row is not lost: it is recorded in the durable compaction
message (summary) and delivered on session.compaction.ended (text). It simply never
renders. The row appears to source its content only from the session.compaction.delta
stream — the result path emits no deltas at all, and ended.text is ignored, so the row
stays bare.

Captured live on v2.2.7 by recording /api/event on a second server around the same
/compact:

plugin returns result standard compaction
session.compaction.started emitted emitted
session.compaction.delta none ~84 (the streamed summary)
session.compaction.ended reason, model, text = recorded summary; no tokens/cost reason, model, text, tokens, cost
durable compaction message summary, reason, model, status; no cost/tokens same, plus cost/tokens

Expected: the row renders like a standard one — label plus the recorded summary (from
ended.text / the durable summary) — and simply omits usage stats when tokens/cost
are absent. Core already holds everything needed; only the presentation is missing.

Related

  • #62360 — TUI plugin slot for the compaction row (complementary: a slot would let plugins
    fill the row, but core should label plugin-recorded compactions by default).
  • #50862 — compaction hook can only return a summary string; #63365 — auto/manual reason
    for plugin-triggered compaction. Adjacent; neither covers the unlabeled row.
Plugins

The minimal local plugin below (first noticed with my own compaction plugin; the minimal plugin reproduces on its own).

OpenCode version

v2.2.7

Steps to reproduce
  1. A local plugin that records the compaction result instead of letting the summarizer run:

    // minimal-compaction-result/index.ts  (package.json exports "." to this file)
    import { Plugin } from "@opencode/plugin";
    
    export default Plugin.define({
      id: "minimal-compaction-result",
      async setup(ctx) {
        await ctx.session.hook("compaction", async (event) => {
          event.result = {
            summary: "# Recorded compaction summary\n\nThis summary was recorded by a plugin.",
          };
        });
      },
    });
    
    // opencode.jsonc
    { "plugins": [{ "package": "./minimal-compaction-result" }] }
    
  2. Open a TUI session in that project, send a short prompt, run /compact.

  3. The compaction divider renders with no label and no content.

  4. Remove the plugin, /compact again: the row is labeled and shows the summary content.

Screenshot

No response

Operating System

Linux Mint 22.3 (Cinnamon)

Terminal

GNOME Terminal

主要语言
TypeScript
星标
227k
派生
30.7k
平均合并
3 小时 57 分钟
30 天内合并 PR
484

环境准备

从这里开始

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

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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