Skip to content

feat: configurable history limits (improved)#18787

Open
roman0yurin wants to merge 4 commits intoanomalyco:devfrom
roman0yurin:c60/pr1-history-limits
Open

feat: configurable history limits (improved)#18787
roman0yurin wants to merge 4 commits intoanomalyco:devfrom
roman0yurin:c60/pr1-history-limits

Conversation

@roman0yurin
Copy link

Issue for this PR

No linked issue for this revised PR.

Type of change

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

What does this PR do?

This PR is a revised version of the history limits feature work. It makes the history/compaction limits configurable at runtime instead of relying only on hardcoded defaults.

Changes included:

  • Extend the server config schema with compaction limit settings and validation bounds.
  • Apply the configured compaction limits in runtime compaction logic.
  • Update the configuration documentation to describe the new fields and defaults.
  • Update generated SDK types so clients can use the new config fields.

Why this works:

The new limits are now read from the validated server config and used by compaction at runtime, with safe fallbacks to the existing defaults when the config is not set.

Files touched:

  • packages/opencode/src/config/config.ts
  • packages/opencode/src/session/compaction.ts
  • packages/opencode/src/session/prompt.ts
  • packages/opencode/src/session/processor.ts
  • packages/web/src/content/docs/config.mdx
  • packages/sdk/js/src/v2/gen/types.gen.ts

How did you verify your code works?

  • bun turbo typecheck
  • bun test --cwd packages/opencode test/session/compaction.test.ts

Screenshots / recordings

N/A (no UI changes)

Checklist

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

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