Skip to content

feat: make compaction reserve configurable - #353

Open
injectiver wants to merge 1 commit into
leookun:mainfrom
injectiver:feat/configurable-compaction-reserve
Open

feat: make compaction reserve configurable#353
injectiver wants to merge 1 commit into
leookun:mainfrom
injectiver:feat/configurable-compaction-reserve

Conversation

@injectiver

Copy link
Copy Markdown

Summary

  • add a persisted compaction reserve setting with a 100,000-token default and a validated 50,000–150,000 range
  • expose the setting through the control API and bilingual desktop settings UI
  • apply the configured reserve to the automatic compaction threshold for each new run
  • serialize setting updates through the store write coordinator

Motivation

The current hard-coded 10,000-token reserve can be too small for large context windows and long Cursor Agent turns, allowing requests to reach the provider context limit before compaction. This change makes the safety headroom configurable while providing a more conservative default.

Testing

  • cargo test -p cursor-server compaction --no-fail-fast
  • tsc --noEmit
  • tsc --noEmit -p tsconfig.node.json
  • vite build
  • manually verified that 50,000 and 150,000 are accepted, 49,999 is rejected, and the setting persists

Notes

On this Windows checkout, the full server suite retains four line-ending-sensitive runtime-template failures (prefix_stability, runtime_modes, selected_images, and text_turn). The same failures reproduce on an unmodified v0.1.2 worktree and are unrelated to this change.

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