Repository navigation
fix: stateless decompress — pure retrieval, no deactivate, cache retained (#400) - #426
Merged
Merged
Conversation
Contributor
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-426Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr426.tgz
npm install -g packageThis comment is automatically updated on each push. |
Merged
This was referenced Nov 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #400.
[Design decision by maintainer — supersedes this issue's original acceptance criteria] decompress is stateless copy-paste: it changes no state. The old "state transition" semantics (deactivate the block → originals re-enter the view → re-compress cycle) is rejected as a design error.
What changed
src/decompress-shared.tsresolveDecompress:deactivateBlock(...)— the block staysactive, the forwarded view keeps folding, the summary stays in placesession.blockContents.delete(...)— the cache is retained forever, so decompress is infinitely repeatable and always returns originals (the old one-shot semantics deleted the cache, degrading the second decompress to the summary)ctx.compressMessages ?? ctx.messages) — fixes the loop path handing the foldedprocessedMessagesview tocollectBlockContent, which found zero originals (third root cause in decompress 被下一轮静默撤销:syncBlocks 无条件复活已失活块 + bili 同时删除内容缓存 + loop 路径把折叠视图喂给回退检索(还原原文再被重折,二次解压永久退化) #400)[Block b5 content — N item(s)]Why this kills the whole #400 bug family
All three root causes were state writes: syncBlocks re-activation clobbering the deactivation, cache deletion breaking repeat decompress, folded-view fallback divergence. With zero state writes there is nothing to clobber — no
expandedflag needed, no kernel change needed (kernelcore.decompressis a pure lookup;collectBlockContentis already documented as the stateless primitive). Matches the semantics acp-kernel documents for the pi host ("The compressed block stays folded").Related
expandedfield) is superseded by this approach — recommend closing it (commented there)active === false+ summary removed from view)Tests
resolveDecompress: stateless — cache kept, block stays active, repeat is idempotent(flipped from the old "deletes the cache" assertion)resolveDecompress: cache miss falls back to originals via compressMessages(new — covers the loop-path folded-view bug)