You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two related problems with infinite sessions compaction and Anthropic models:
BYOK providers: Compaction never triggers — the CLI can't resolve max_context_window_tokens for BYOK providers, so compaction is silently skipped.
Catalog models: Token budget is hardcoded to 128K for all models (test/harness/replayingCapiProxy.ts:1088), incorrect for Anthropic Claude models which have 200K context windows.
Repro (confirmed 2026-04-13)
SDK v0.2.2, model: claude-sonnet-4-20250514 via BYOK (CAPI relay)
Summary
Two related problems with infinite sessions compaction and Anthropic models:
max_context_window_tokensfor BYOK providers, so compaction is silently skipped.test/harness/replayingCapiProxy.ts:1088), incorrect for Anthropic Claude models which have 200K context windows.Repro (confirmed 2026-04-13)
SDK
v0.2.2, model:claude-sonnet-4-20250514via BYOK (CAPI relay)No
session.compaction_startorsession.compaction_completeevents received, even at 12K+ input tokens per call (far exceeding any 5% threshold).SDK code references
Where the budget is hardcoded (CLI layer)
test/harness/replayingCapiProxy.tsmax_context_window_tokens: 128000for ALL modelsSDK type flow (passes through, no provider logic)
python/copilot/generated/rpc.pymax_context_window_tokens: floatpython/copilot/client.pygo/types.goMaxContextWindowTokens intnodejs/src/types.tsmax_context_window_tokens: numberCompaction threshold config
go/types.goBackgroundCompactionThreshold *float64python/copilot/session.pybackground_compaction_thresholdfieldImpact on Dracarys
Suggested fix
max_context_window_tokensonProviderConfig. Use provider-type defaults:anthropic→ 200,000openai→ 128,000mackinnonbuck/byok-provider-token-limitspartially addresses this)