Conversation
…el context window The coding-agent CLIs replay the whole conversation each turn as a single projected user message over stream-json stdin, and the projection had a flat 200k-character history ceiling: about 50k tokens of English or code, a fraction of what even a 128k-token model holds, and far below the newer 1M-token families. Derive the ceiling from the declared model context window on the routed provider row (modelContextWindows by model, then the provider-wide contextWindow): window times 3 chars per token, floored at the legacy 200k cap so small windows and missing metadata keep today behavior exactly, and capped by a 4M hard ceiling so runaway metadata cannot unbound stdin. The ceiling stays a runaway-memory bound; caller-side compaction remains the token authority.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. This PR stays in draft until every box above is ticked. |
리뷰 · 우선순위 64 / 80CodeBuddy와 Qoder는 한 턴마다 지금까지의 대화를 통째로 다시 넣습니다. 그 글은 사용자 메시지 하나로 합쳐져 CLI 입력으로 들어갑니다. 합친 기록의 상한이 20만 자로 고정되어 있었습니다. 모델 창이 커도 앞부분이 잘렸습니다. 글 종류에 따라 5만에서 13만 토큰 정도입니다. 이 PR은 상한을 모델 창에서 구합니다. 창의 토큰 수에 3을 곱한 값이 새 상한입니다. 그 값이 20만보다 작으면 20만으로 두고, 400만을 넘으면 400만에서 자릅니다. 창 숫자가 없거나 0이거나 무한대면 20만입니다. 계산은 베이스는
메인테이너의 판단이 필요한 지점 20만 바닥을 유지할지는 제품 선택입니다. 6만 4천 토큰 창도 20만 자를 그대로 받습니다. 테스트가 그 경우를 고정합니다. 오늘과 같습니다. 작은 창을 창 크기에 맞게 줄이는 일은 이 PR이 일부러 하지 않습니다. 글자 3 대 토큰 1도 선택입니다. 한국어는 토큰이 더 잘게 나뉘어, 같은 글자 수가 창을 넘을 수 있습니다. 본문은 이 상한을 메모리 울타리로 두고, 토큰 계산은 호출 쪽 압축이 맡는다고 합니다. tip의 #5171은 모델 정책을 너의 추천 초안을 유지하세요. 머지 추천은 아닙니다. 방향은 맞습니다. 20만 고정 칼이 큰 창의 앞 대화를 버리던 것을, 창이 클 때만 늘립니다. dev tip에 다시 맞추고 체크리스트를 채운 뒤에 초안을 풀면 됩니다. 이 댓글은 grok-bot이 작성했습니다 |
|
Superseded by #5265, merged to Your projected-history ceiling derived from the declared context window landed unchanged in substance, carried with Closing as superseded rather than stale. |
Summary
modelContextWindowsresolved per model through the establishedmodelRecordValuelookup, then the provider-widecontextWindow): window × 3 chars per token, floored at the legacy 200k flat cap so small windows and missing metadata keep today behavior exactly, capped by a 4M hard ceiling so runaway metadata cannot unbound stdin. The ceiling remains a runaway-memory bound; caller-side compaction stays the token authority.runCodingAgentTurndriver, so both CodeBuddy and Qoder turns get it and the family adapters are unchanged.buildConversationInputtakes an optionalmaxHistoryChars, defaulting to the legacy cap — the pure protocol module stays process-free and the wire behavior for callers without window metadata is byte-identical.Verification
bun test tests/providers/codebuddy-protocol.test.ts tests/providers/codebuddy-adapter.test.ts tests/providers/qoder-adapter.test.ts— 72 pass, including four new protocol unit tests (invalid or missing metadata keeps the flat cap; a small window never lowers it; a large window scales until the hard ceiling;buildConversationInputkeeps 250k characters of history under a 1M-window derived cap and still truncates under the default) and one end-to-end adapter regression that runs a real injected turn withmodelContextWindowsand asserts the spawned CLI stdin kept the history the derived cap admits while the no-metadata path still truncates.bun run typecheck— clean.bun run structure:check— clean.bun run privacy:scan— clean.bun run test:changed— 21,880 tests: 21,839 pass, 38 skip, 3 fail. The three failures are the same macOS-host environment failures already verified on the base commit without this change (bubblewrap executable-permission semantics and a shim-probe timeout; see the verification note on fix(transport): fill a default User-Agent on proxy-originated provider outbound #5186). None touch the coding-agent adapter path.Checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Related: #5146 (CodeBuddy integration design), #5147 (account-roster discovery — where the model metadata starts), #5186, #5188.