refactor: centralize model input token limit resolution - #2071
refactor: centralize model input token limit resolution#2071NarwhalChen wants to merge 5 commits into
Conversation
|
…obe/user-shell-command-command-git-p-emz4q4
…obe/user-shell-command-command-git-p-emz4q4
…nd-command-git-p-emz4q4 # Conflicts: # packages/agent-core-v2/test/kosong/provider/composition.test.ts
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Related Issue
Follow-up to #2036. @RealKai42 identified the duplicated input-limit fallback as a deliberate out-of-scope cleanup.
Problem
Compaction, context validation, session status, and SDK/server projections independently repeated the rule that a model's prompt ceiling prefers
max_input_tokens, falls back tomax_context_tokens, and uses zero when capability data is unavailable. Keeping that semantic decision at each consumer risks the engine and its status surfaces drifting apart.This PR is independent of #2150: it only centralizes input-limit consumption and does not change capability sourcing or catalog fallback behavior.
What changed
getModelInputTokenLimitat the model-capability boundary in legacy kosong and in the self-contained v2 contract.Completion-budget code intentionally continues to use the total context window because it answers a different question: how much output can fit after the prompt.
Verification
agent-coresuite: 3,999 passed; existing 3 expected failures, 30 skips, and 1 todo unchanged.agent-core-v2suite: 4,084 passed.kap-serversuite: 797 passed.kosongand SDK suites: 1,567 passed, 1 existing todo.kosong,agent-core,agent-core-v2, the SDK, andkap-server.agent-core-v2domain-layer lint passed for 938 files.mainlines.git diff origin/main --checkpassed.Checklist
gen-changesets; no changeset is needed because this is not user-perceivable and does not change behavior.