Skip to content

fix(context): respect isolation scopes during compaction - #830

Open
mikemikimike wants to merge 1 commit into
google:mainfrom
mikemikimike:fix/compactor-isolation-824
Open

fix(context): respect isolation scopes during compaction#830
mikemikimike wants to merge 1 commit into
google:mainfrom
mikemikimike:fix/compactor-isolation-824

Conversation

@mikemikimike

Copy link
Copy Markdown

Closes #824

Problem

TokenBasedContextCompactor selected events from the entire session before applying workflow isolation. This allowed a peer node's event to reach the summarizer and then the current node's model after compaction.

Changes

  • Filter active events by the invocation's isolationScope before token counting and compaction.
  • Preserve the existing behavior for unscoped invocations.
  • Add a regression test that verifies peer-scope events are excluded from the summarizer input.

Tests

  • npx vitest run --project unit:core core/test/context/token_based_context_compactor_test.ts (8 passed)
  • npm run ts:check (passed)
  • npx eslint core/src/context/compaction_utils.ts core/src/context/token_based_context_compactor.ts core/test/context/token_based_context_compactor_test.ts (passed)
  • npx prettier core/src/context/compaction_utils.ts core/src/context/token_based_context_compactor.ts core/test/context/token_based_context_compactor_test.ts --check (passed)
  • git diff --check (passed)

Compatibility / Known limitations

Unscoped compaction remains unchanged. This PR does not add a live-model or end-to-end test; the regression is covered with deterministic unit-test fixtures and requires no credentials or external services.

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.

TokenBasedContextCompactor includes events from other isolation scopes

1 participant