Skip to content

feat: declare input window for 1M models so auto-compaction fires before the edge - #18

Open
mradwankhalil wants to merge 1 commit into
openchamber:mainfrom
mradwankhalil:feat/model-input-window
Open

mradwankhalil wants to merge 1 commit into
openchamber:mainfrom
mradwankhalil:feat/model-input-window

Conversation

@mradwankhalil

Copy link
Copy Markdown

What

Declares an input window (limit.input = 900_000) for the 1M-context models (aliases fable / opus / sonnet, plus the pinned 1M ids) and surfaces it through both the provider models and the static config entries. 200K models are unchanged.

Why

OpenCode schedules automatic compaction at limit.input - compaction.reserved when a model declares an input cap, and falls back to limit.context - maxOutputTokens otherwise. The 1M models declared { context, output } only, so scheduled compaction crawled to the very edge of the window (~98% observed in long sessions) - effectively never in practice. A declared input window moves the scheduled trigger to ~88-90% of the window (depending on compaction.reserved), matching Claude Code's own auto-compact timing.

Behavior

  • 1M models: auto-compaction now scheduled at 900k - reserved input tokens.
  • 200K models: unchanged (no input declared).

Verification

  • bun run build passes.
  • New input-window assertions added to test/smoke.ts and verified directly.
  • Note: the pre-existing CLI-resolution block in test/smoke.ts is POSIX-only and fails on Windows hosts; confirmed failing on unmodified main as well (unrelated to this change).

OpenCode schedules automatic compaction at (limit.input - reserved)
when a model declares an input cap, falling back to (context - maxOutput)
otherwise. The 1M Claude Code models declared only context/output, so
scheduled compaction landed at the very edge of the window (~98%
observed in long sessions). Declaring a 900k input window moves the
trigger to ~88-90% and leaves 200K models unchanged.
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