Skip to content

fix: enforce context token budget - #2

Draft
Kokeip wants to merge 3 commits into
mainfrom
fix/context-compaction
Draft

fix: enforce context token budget#2
Kokeip wants to merge 3 commits into
mainfrom
fix/context-compaction

Conversation

@Kokeip

@Kokeip Kokeip commented Aug 19, 2026

Copy link
Copy Markdown

Summary

  • enforce a real prompt token budget from context-window and output-reserve settings
  • compact message history semantically, prune oversized tool results, and retry once after provider context overflow
  • anchor estimates to provider-reported prompt usage and expose estimate/compaction details in the Web UI
  • normalize context-window overflow errors across OpenAI-compatible, Anthropic, Bedrock, and Google adapters

Scope

This PR contains only context accounting and compaction. The world-topology feature remains separate and is not included.

Validation

  • pnpm --filter @cantilune/boot test — 51 files, 534 tests passed
  • pnpm --filter @cantilune/adapter test — 18 files, 152 tests passed
  • boot and adapter production TypeScript builds passed
  • website server typecheck and streaming smoke test passed
  • ESLint on context-touched files and git diff --check passed

Note: the full website client typecheck is currently blocked in the local mixed worktree by uncommitted topology work; those files are excluded from this branch and 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