Skip to content

fix: acp_status hides consumed compress calls from PROTECTED list - #244

Merged
ranxianglei merged 2 commits into
masterfrom
2026-07-30_acp-status-consumed-fix
Jul 30, 2026
Merged

fix: acp_status hides consumed compress calls from PROTECTED list#244
ranxianglei merged 2 commits into
masterfrom
2026-07-30_acp-status-consumed-fix

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Problem

acp_status fetched messages directly from the DB via fetchSessionMessages, bypassing the transform pipeline. hideConsumedCompressCalls only runs in hooks.ts transform hook (modifying output.messages), so the DB retains original compress parts.

Result: consumed (inactive) compress calls showed as [PROTECTED: compress — not compressible] in acp_status output, 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) in createAcpStatusTool's execute handler, after fetchSessionMessages but before buildStatusReport. This ensures acp_status reflects the same message view the model sees.

Files

  • lib/compress/status.ts — import + call hideConsumedCompressCalls (2 lines)
  • tests/acp-status-consumed-fix.test.ts — 2 tests (consumed hidden, active visible)

Verification

  • typecheck: 0 errors
  • full test suite: 936/936 pass

ranxianglei and others added 2 commits July 30, 2026 09:30
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>
@ranxianglei
ranxianglei merged commit de1d99f into master Jul 30, 2026
5 checks passed
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