Skip to content

fix(panel): correct session-accounting label, mark tokensCompressed cumulative - #182

Merged
ranxianglei merged 3 commits into
masterfrom
2026-09-01_panel-copy-fixes
Sep 7, 2026
Merged

ranxianglei merged 3 commits into
masterfrom
2026-09-01_panel-copy-fixes

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Fixes the panel copy items from ranxianglei/billion-context-pi#267.

Session-accounting label: "never shrinks" was false

The Context (session accounting, host footer scale) line claimed the number "never shrinks; includes compressed originals". Measured in a real session, the host-reported value really does drop after a compress (summaries replace the pruned originals in the window) — e.g. a T2 distillation took it from 55.5k to 48.4k.

Relabeled to includes compressed originals; shrinks slower than the sent view: it still carries the compressed originals, so it lags the sent view, but it is not append-only. Doc comments on StatusPanelInput.tokenCount and buildStatusPanel updated to match.

Blocks figure marked cumulative

Blocks: N active / M total (X tokens compressed)state.stats.tokensCompressed is the cumulative historical total, which read as a contradiction next to the current Session-only number. Now labeled tokens compressed, cumulative.

Tests

tests/panel.test.ts assertions updated for both labels. Full suite: 568 pass.

Note for the bcp side: after this lands and is published to npm, billion-context-pi should bump its pinned acp-kernel to the new version (see ranxianglei/billion-context-pi#268).

ework-agent added 2 commits August 31, 2026 23:57
A block the host explicitly decompressed (expanded) was unconditionally
re-activated by syncBlocks on the next turn (client re-sends full history
-> summary/raw ids present -> active=true), silently re-folding the
already-restored messages. Record the expand intent on the block
(expanded?: boolean, host-set) and skip re-activation for it in syncBlocks.
Blocks deactivated by other means (orphan GC, tier distillation,
consumed-by-parent) keep the legacy resurrection behavior.
…d cumulative

The 'never shrinks' claim on the session-accounting line was false: the
host-reported value really does drop after a compress (summaries replace
the pruned originals in the window). Relabel it as 'shrinks slower than
the sent view' (it still includes the compressed originals, so it lags
the sent view). Mark the Blocks 'tokens compressed' figure as cumulative
so it no longer reads as a contradiction next to the current Session-only
number. Fixes ranxianglei/billion-context-pi#267 (panel copy items).
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

📦 Built Package Artifact

Branch: 2026-09-01_panel-copy-fixes (2bbb1a4)

Option A — Install from npm PR tag (recommended)

In your adapter project:

npm install acp-kernel@pr-182

Each push to this PR publishes a new version under the pr-182 npm tag.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf acp-kernel-pr182.tgz
npm install ./package

This comment is automatically updated on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 ework agent · qwen3.8-27b

[bot] 🏷 Reviewed PR #182 (branch 2026-09-01_panel-copy-fixes, 2 commits).

Panel copy fix (81f61ed) — the change this issue describes: ✅ verified

  • src/panel/panel.ts:89 session-accounting line → includes compressed originals; shrinks slower than the sent view (consistent with the measured T2 drop, 55.5k→48.4k).
  • src/panel/panel.ts:150 and :159 Blocks line → tokens compressed, cumulative (both the >0-active and 0-active branches).
  • Doc comments on StatusPanelInput.tokenCount (panel.ts:14-16) and buildStatusPanel (panel.ts:51-55) updated to match.
  • tests/panel.test.ts:36 and :58 assertions updated.
  • No leftover "never shrinks" in panel.ts. (The "append-only" mentions in src/search/* are a different concept — the host's raw session log — and are correctly left alone.)
  • Pre-flight all green: typecheck clean, npm test 568 pass, build clean, check-pr.sh OK (branch name + no version bump).

Sync fix (0240d90) — not described in this issue: ⚠️ needs a decision
This commit is separate from the panel work and isn't mentioned in the issue body. What it does:

  • Adds CompressionBlock.expanded?: boolean (src/types.ts:39) — marked "host-set".
  • syncBlocks (src/sync.ts:72) now keeps an expanded block deactivated (and omits it from the deactivated report) instead of re-activating it.
  • 2 tests in tests/sync-config.test.ts cover it.

Logic is sound and backward-compatible (non-expanded blocks keep the legacy resurrection), and expanded round-trips through persist. Two things to confirm before this lands:

  1. Scope — the issue is titled fix(panel) and only describes the copy fix. Should the sync fix be described here, or split into its own PR?
  2. It's inert without host cooperation — no kernel code path sets expanded (deactivateBlock sets active:false only; decompress/collectBlockContent don't touch it), and it isn't documented in README/DESIGN. So it only takes effect if a host manually sets block.expanded = true after a user decompresses. Is billion-context-pi doing that? If yes, a one-line note in the API docs would help; otherwise consider an expanded option on deactivateBlock.

Formattingnpm run format:check flags ~92 files, but that's pre-existing/repo-wide (master already fails on panel.ts + panel.test.ts) and CI does not run format:check. Non-blocking.

I won't merge (human-only). Once the sync-fix scope is confirmed and the description covers it, this is ready for you to merge.

@ranxianglei

Copy link
Copy Markdown
Owner Author

Review 结论:✅ 通过,可合并

发布顺序(bcp #268 依赖):本 PR 合并 → npm 发版(npm view acp-kernel version 确认,注意 registry 元数据可能延迟几分钟)→ bcp #268(已 rebase 到 v0.1.58,详见其 PR 评论)升级内核引用后合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 ework agent · qwen3.8-27b

[bot] 🏷 收到,谢谢审核。我的独立复核与你的结论一致:

  • 面板文案修正准确、完整:src/panel/panel.ts:89(会话账本行)、:150/:159(Blocks 行)+ doc 注释 + tests/panel.test.ts:36/:58 断言;typecheck / test(568 pass)/ build 均绿。
  • sync 的 expanded 改动向后兼容(非 expanded 块保留原复活行为),你确认并入本 PR,无异议。

一点提醒(不阻塞):expanded 目前没有任何内核代码路径会置位(deactivateBlock 只设 active:false,decompress/collectBlockContent 不改写),需 bcp 侧在用户解压后手动置 block.expanded = true 才真正生效。若 bcp #268 顺带补了这步会更完整——需要的话我可以去 bcp 核对一下。

按规则我不能执行 merge(仅人工操作)。请自行合并本 PR(branch 2026-09-01_panel-copy-fixes,对应 issue #182)。

发布顺序我这边理解一致:合并本 PR → CI 自动打 tag 并发 npm → npm view acp-kernel version 确认新版上线(registry 元数据可能延迟几分钟)→ bcp #268(已 rebase 到 v0.1.58)升级内核引用后合并。

合并后若要我帮忙核对发布版本、或去 bcp 确认 expanded 的设置,说一声即可。

@ranxianglei

Copy link
Copy Markdown
Owner Author

冲突了

Resolve buildStatusPanel doc-comment conflict in src/panel/panel.ts:
keep our corrected session-accounting wording (bullet 1: shrinks slower
than the sent view) alongside master's countTokens-scale labels
(bullets 2-3). typecheck/test(582 pass)/build all green.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 ework agent · qwen3.8-27b

[bot] 🏷 冲突已解决并推送,分支 2026-09-01_panel-copy-fixes 已更新到 2bbb1a4(fast-forward,无 force-push)。

冲突根因:master 已从 v0.0.48 前进到 v0.0.55(其间合了 #183#206),与本 PR 在 panel.ts/sync.ts/types.ts/sync-config.test.ts 四处有交集。实际只有 src/panel/panel.ts 一处真冲突,其余三处自动合并。

冲突点:buildStatusPanel 的 doc 注释块——本 PR 改了第 1 条("never shrinks" → "shrinks slower than the sent view"),而 master 的 countTokens 重构(#203/#205)独立把第 2、3 条的标尺从 "chars/4 est." 改成了 "countTokens scale"。两边改在同一块里就撞了。

解法:两者合并保留——第 1 条用本 PR 的修正措辞,第 2、3 条用 master 的 countTokens 标尺。语义一致,无信息丢失。

验证(合并后整树重跑):typecheck 干净、npm test 582/582 pass、build 干净;相对 master 的净 diff 恰好只有本 PR 的 5 个文件(panel.ts/sync.ts/types.ts/panel.test.ts/sync-config.test.ts),无合并杂音;version 继承 master 的 0.0.55(本分支未动过 version)。

现在该分支与 master 无冲突、可合并。请你自行 merge(我按规则不代合)。合并后 CI 自动发 npm,再走 bcp #268 升级引用即可。

@ranxianglei
ranxianglei merged commit 6e7c077 into master Sep 7, 2026
4 checks passed
@ranxianglei ranxianglei mentioned this pull request Sep 7, 2026
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.

1 participant