Skip to content

feat(session): add suffix compaction - #44264

Open
hugojosefson wants to merge 2 commits into
anomalyco:devfrom
hugojosefson:suffix-compaction
Open

feat(session): add suffix compaction#44264
hugojosefson wants to merge 2 commits into
anomalyco:devfrom
hugojosefson:suffix-compaction

Conversation

@hugojosefson

@hugojosefson hugojosefson commented Aug 22, 2026

Copy link
Copy Markdown

Issue for this PR

N/A

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds experimental compaction.mode: "suffix" support to both session runtimes while keeping prepend as the default. Suffix compaction reuses the provider-bound request prefix, appends a bounded summary instruction, disables tool execution, and falls back once to prepend when the request is unsafe or the summary is invalid.

It also persists requested/used mode, fallback reason, duration, and token diagnostics, then shows them on the TUI compaction divider. Replacement plugin prompts retain their existing prepend semantics.

How did you verify your code works?

  • bun run typecheck
  • Core compaction tests: 14 passed
  • OpenCode compaction tests: 62 passed, 1 skipped
  • TUI tests: 196 passed, 1 skipped
  • Schema tests: 17 passed
  • Client generated check and typecheck
  • JavaScript SDK regeneration and test
  • Web build
  • Linux x64 binary build and smoke test
  • Human: Even though I used gpt5.6-sol-high to implement this, I have run it with a local Qwen3.8-27B-UD-Q3_K_XL.gguf via llama.cpp with different context sizes configured, and the suffix-based compaction works great :) I no longer have to wait for 90+ seconds on every compaction event.

Broader suites are not clean in this checkout: Core has two unrelated MoveSession git-apply failures; OpenCode has unrelated file-mode and response-timeout failures and exceeded the five-minute run limit.

Screenshots / recordings

Not included; the UI change is a text-only TUI diagnostic line.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one potentially related PR:

Related PR:

This PR is related because it also deals with session compaction configuration and behavior, though it focuses on thresholds and continuous compaction prevention rather than the suffix compaction mode itself.

The current PR #44264 (feat(session): add suffix compaction) appears to be the primary implementation of this feature, as it's the only one matching the specific "suffix compaction" functionality.

No duplicate PRs found for the exact suffix compaction feature being implemented in PR #44264.

@Enough1122

Copy link
Copy Markdown

AI code review — automated review for reference, author can ignore or act on any point.

This diff is very large (36 files, +2594/−282), so automated line-by-line review is skipped here — recommending human review for this one.

@hugojosefson
hugojosefson marked this pull request as ready for review August 23, 2026 12:48
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.

2 participants