fix: acp_status hides consumed compress calls from PROTECTED list - #244
Merged
Conversation
hideConsumedCompressCalls was only running in the transform pipeline (hooks.ts), not in the acp_status tool handler. The tool fetched raw DB messages, so consumed (inactive) compress calls showed as PROTECTED even though they're invisible in the model's actual context. This misled the model into thinking there was much more protected content than actually existed. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Switched from blacklist (hide consumed blocks) to whitelist (keep active blocks) + keep-last-2-orphaned approach. This handles failed compress calls that never created a block (status=error) — they were previously untouched and accumulated in context. Logic: - Collect activeCallIds from active blocks (whitelist) - Collect allBlockCallIds from ALL blocks (to identify orphaned) - Find last 2 orphaned compress calls (callID not in any block) - keepCallIds = activeCallIds ∪ last2OrphanedCallIds - Hide compress parts not in keepCallIds Removed early return when blocksById.size === 0 — orphaned compress calls should still be processed even with no blocks in state. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This was referenced Jul 30, 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.
Problem
acp_statusfetched messages directly from the DB viafetchSessionMessages, bypassing the transform pipeline.hideConsumedCompressCallsonly runs inhooks.tstransform hook (modifyingoutput.messages), so the DB retains original compress parts.Result: consumed (inactive) compress calls showed as
[PROTECTED: compress — not compressible]inacp_statusoutput, even though they're invisible in the model's actual context. This misled the model into thinking there was much more protected content than actually existed — in the investigation session, ~100 consumed compress calls showed as PROTECTED, inflating the protected token count from ~24K to ~98K.Fix
Call
hideConsumedCompressCalls(state, rawMessages)increateAcpStatusTool's execute handler, afterfetchSessionMessagesbut beforebuildStatusReport. This ensuresacp_statusreflects the same message view the model sees.Files
lib/compress/status.ts— import + callhideConsumedCompressCalls(2 lines)tests/acp-status-consumed-fix.test.ts— 2 tests (consumed hidden, active visible)Verification