-
Notifications
You must be signed in to change notification settings - Fork 4
fix: inactive block decompress + acp_status visibility #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ranxianglei
wants to merge
5
commits into
master
Choose a base branch
from
2026-07-25_inactive-block-fixes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4054b08
fix: allow decompress of inactive standalone blocks
ranxianglei aa3b866
fix: show inactive/consumed blocks in acp_status compressed scope
ranxianglei 44ed720
fix: exclude inactive blocks from overview (regression from acp_statu…
ranxianglei e9033b2
fix: toFile fallback + slash command consistency for inactive blocks
ranxianglei ae3ff5f
test: E2E tests for inactive block decompress + toFile fix
ranxianglei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # REQ: Inactive Block Fixes | ||
|
|
||
| ## Problem | ||
|
|
||
| Two issues with inactive (consumed/GC'd/user-decompressed) compression blocks: | ||
|
|
||
| 1. **decompress rejects inactive blocks**: `resolveBlockTarget` in `lib/compress/decompress.ts` | ||
| rejects any block where `activeBlocks.length === 0` with "not active. It may have already been | ||
| decompressed." — even for standalone inactive blocks that are safe to decompress. The model sees | ||
| the block's compress call in context but cannot decompress it. | ||
|
|
||
| 2. **acp_status hides inactive blocks**: `scope:"compressed"` only iterates `activeBlockIds`, | ||
| completely hiding consumed/GC'd blocks. The model cannot discover blocks that were consumed by | ||
| secondary compression, making it impossible to reason about the full compression history. | ||
|
|
||
| ## Fix | ||
|
|
||
| 1. **decompress**: Remove the "not active" rejection in `resolveBlockTarget`. Keep the nested | ||
| redirect (consumed blocks inside an active parent still redirect to the parent). Standalone | ||
| inactive blocks (user-decompressed, GC'd, orphaned) can now be decompressed. | ||
|
|
||
| 2. **acp_status**: Show ALL blocks from `blocksById` (not just active ones). Add `[inactive]` | ||
| marker to the metadata line (not the topic line). Add "N active, M inactive/consumed" summary. | ||
|
|
||
| ## Files | ||
|
|
||
| - `lib/compress/decompress.ts` — remove "not active" rejection | ||
| - `lib/compress/status.ts` — show all blocks, add inactive marker | ||
| - `tests/acp-status.test.ts` — 3 new tests (inactive visibility, user-decompressed, no marker on active) | ||
| - `tests/decompress-logic.test.ts` — 2 new tests (standalone inactive, consumed with active ancestor) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # WORKLOG: Inactive Block Fixes | ||
|
|
||
| ## Changes | ||
|
|
||
| ### lib/compress/decompress.ts | ||
| - `resolveBlockTarget` (line ~120): Removed the `return { ok: false, error: "not active" }` branch. | ||
| Previously, when `activeBlocks.length === 0` and no active ancestor was found, decompress was | ||
| rejected. Now, standalone inactive blocks pass through to `{ ok: true, targets: [target] }`. | ||
| The nested-redirect (consumed blocks inside an active parent) is kept — decompressing a consumed | ||
| child directly would restore 0 messages since the parent still claims them. | ||
|
|
||
| ### lib/compress/status.ts | ||
| - `createAcpStatusTool` scope:"compressed" handler (line ~436): Changed block source from | ||
| `activeBlockIds` (active only) to `blocksById.values()` (all blocks). Inactive/consumed blocks | ||
| now appear in the compressed drilldown. | ||
| - `renderCompressedDrilldown` (line ~340): Added `[inactive]` marker to the metadata line for | ||
| blocks where `!b.active`. Added "N active, M inactive/consumed" summary line when inactive blocks | ||
| exist. Active blocks get no marker (default state). | ||
|
|
||
| ### tests/acp-status.test.ts | ||
| - 3 new tests: | ||
| - scope=compressed shows inactive/consumed blocks with marker and summary | ||
| - scope=compressed marks user-decompressed blocks as inactive | ||
| - scope=compressed does not add inactive marker to active blocks | ||
|
|
||
| ### tests/decompress-logic.test.ts | ||
| - 2 new tests: | ||
| - findActiveAncestorBlockId returns null for standalone inactive block (the condition that now | ||
| allows decompress to proceed) | ||
| - findActiveAncestorBlockId returns active ancestor for consumed inactive block (the condition | ||
| that still triggers the redirect) | ||
|
|
||
| ## Verification | ||
|
|
||
| - typecheck: pass | ||
| - tests: 859 pass (846 existing + 13 new across 4 commits), 0 fail | ||
| - build: pass | ||
|
|
||
| ## Round 2 dual-agent review findings (fixed in commit 4) | ||
|
|
||
| ### Fixed: toFile writes garbage for inactive blocks | ||
| `lib/compress/decompress.ts:325` — inactive blocks had empty `activeBlocks`, so fallback was | ||
| `activeBlocks[0]?.summary` (undefined) → wrote literal `"(no content available)"`. Changed to | ||
| `targets[0]?.blocks[0]?.summary` so the block's actual summary is written. | ||
|
|
||
| ### Fixed: /acp decompress slash command still rejected inactive blocks | ||
| `lib/commands/decompress.ts:153-161` — same "not active" rejection existed in the slash command | ||
| path. Applied the same fix: keep nested-redirect, drop "not active" rejection. | ||
|
|
||
| ### Added: E2E tests for actual decompress tool behavior | ||
| `tests/inactive-block-decompress.test.ts` — 7 tests exercising the real decompress tool: | ||
| - resolveCompressionTarget returns target for inactive block | ||
| - decompress tool succeeds for standalone inactive block (actual behavior change) | ||
| - decompress tool redirects for consumed block with active parent | ||
| - decompress tool works normally for active block (control) | ||
| - toFile on inactive block writes summary (not placeholder) | ||
| - decompress succeeds when all ancestor chain is inactive (multi-block scenario) |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里为什么要删除