Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Compaction has no visual feedback — /compact and auto-compaction appear to hang

未关闭
#928 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

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

调研方向

Start by tracing the TUI handling for the harness's compaction_start and compaction_done events, then follow the manual /compact entry point and the automatic compaction path. Done means both paths show an in-progress indication, a completion result using the available token data, and a neutral finished or failure message when result data is absent.

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

描述

Summary

Compaction runs with no visual feedback. Every stage of it is already recorded on disk — the compaction_start / compaction_done events fire, the transcript gets a compaction entry, and the session meta.json gets cumulative stats — but the TUI renders nothing while it runs and nothing when it finishes.

Because compaction is a summarization model call over the whole context, it is not instant (this session compacted 446,626 tokens). With no indicator, the session looks hung for the duration, and after it returns there is no way to tell it happened, how much was reclaimed, or that /compact did anything at all.

This affects both paths: manual /compact and automatic compaction near the context limit.

Expected Behavior
  • While compacting: some visible indication that work is in progress — a status/spinner line, ideally with the token count being summarized, so the session doesn't read as frozen.
  • When finished: a feed line reporting the result, e.g. tokens before → after and tokens saved. /compact is an explicit user action, so it should always confirm what it did.
  • On failure/cancel: a visible message rather than a silent no-op.

The data needed for all of this is already produced by the harness (see evidence below) — this looks like a rendering gap rather than a missing-instrumentation problem.

Actual Behavior
  • No progress indicator during compaction. The TUI is unchanged while the summarization call is in flight.
  • No completion line. Nothing reports tokens saved, before/after counts, or event count.
  • /compact produces no visible result, so there is no way to distinguish "compacted successfully" from "ignored my command".
Steps to reproduce the issue
  1. Start a session and build up a large context (or let it approach the limit).
  2. Run /compact (or wait for automatic compaction to trigger).
  3. Observe: nothing renders while compaction runs.
  4. Observe: nothing renders when it completes — no token counts, no confirmation.
Command Code Version

1.65.2

Operating System

macOS

Terminal/IDE

Ghostty

Shell

zsh

Session file (optional)

Not attached — the affected session contains private data (personal bookmarks and account context) and the template notes it holds the whole session. Happy to provide a redacted extract, or a minimal reproduction session, on request.

Fix prompt (optional)

Compaction currently renders nothing. Surface it in the feed. The harness already emits compaction_start and compaction_done (the latter with tokensSaved, only when > 0), and the session meta.json already carries {count, tokensSaved, lastTokensSaved, lastCompactedAt} — so this is a rendering change, not new instrumentation. On compaction_start, render a status/spinner line indicating history is being summarized. On compaction_done, replace it with a completed line showing tokens saved and the running session total. Make sure the manual /compact path renders the same result so the command visibly confirms what it did. If tokensSaved is 0 or the event doesn't arrive, fall back to a neutral "compaction finished" line rather than leaving the spinner up.

Additional context

Compaction is frequent and does substantial work, all of it invisible. Aggregated across the 10 sessions on this machine that have compacted:

Metric Value
Sessions with compaction 10
Total compaction events 33
Total tokens reclaimed 16,665,573

Largest single session: 9 events, 5,423,527 tokens reclaimed.

Affected session (this one):

// ~/.commandcode/projects/<project>/6672a74d-….meta.json
"compaction": {
  "count": 1,
  "tokensSaved": 351429,
  "lastTokensSaved": 351429,
  "lastCompactedAt": "2026-09-25T02:38:11.873Z"
}

That compaction saved 351,429 tokens (446,626 before → ≈95,197 after). The user-visible result of that was nothing.

The transcript records it as a first-class entry:

// <session>.jsonl — entry type "compaction"
{
  "type": "compaction",
  "id": "002d875a",
  "parentId": "8e7d9c82",
  "timestamp": "2026-09-25T02:38:11.871Z",
  "firstKeptEntryId": "bbf7600d",
  "tokensBefore": 446626
}

Entry-type counts in that transcript: message 429, session 1, compaction 1.

The events the harness emits (from the mods API reference):

compaction_start / compaction_done | compaction mod | tokensSaved (done, only when > 0)

(subagent_start/subagent_stop are SubagentStart/Stop; compaction_start/compaction_done are Pre/PostCompact; notice is Notification.)

So compaction_start and compaction_done are both available and compaction_done already carries tokensSaved.

Related gap — script hooks cannot see compaction. The documented hook events are PreToolUse, PostToolUse, Stop, and SessionStart. There is no PreCompact/PostCompact for settings.json hooks (the mods API has them, script hooks do not). That means users who want their own compaction indicator or log currently have no hook-level way to do it, which makes the built-in rendering the only route. Worth considering as a follow-up.

Note on the docs: product-help.md cites the project as https://github.com/commandcode/command-code, which 404s (the commandcode org has 0 public repos). The live repo is CommandCodeAI/command-code. Minor, but it is where the in-product /feedback flow points users.

主要语言
没有语言数据
星标
4k
派生
357
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

CommandCodeAI/command-code 的其他 Issue

查看 CommandCodeAI/command-code 的全部 Issue

相似的 Issue

更多 CLI Issue

把新 issue 发到你的邮箱

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