Skip to content

Compaction: make extractTailAfterSummary summary-aware #21

@riatzukiza

Description

@riatzukiza

Follow-up from PR #20 review (CodeRabbit comment on tail extraction): #20 (comment)

Current behavior in lib/compaction/codex-compaction.ts::extractTailAfterSummary returns a cloned slice starting at the last role:"user" message. That matches the existing compaction flow, but if we ever keep summaries as user messages in the client-side transcript, they could be mistaken for the tail start.

This issue tracks:

  • Adding an explicit way to mark summary items (e.g., metadata flag or dedicated field) so they are not treated as the conversation tail.
  • Updating extractTailAfterSummary (and any related helpers) to skip summary-marked items when finding the tail start.
  • Adjusting tests in test/codex-compaction.test.ts to clearly cover the summary-aware behavior.

We intentionally deferred this refinement from PR #20 to keep the change set focused.

Metadata

Metadata

Assignees

No one assigned

    Labels

    compactionIssues related to conversation compaction and summary handlingeffort-mediumMedium effort issues - 4-12 hours of workpriority-mediumMedium priority issues - important features or significant improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions