[WRONG BRANCH] fix(usage): recompute totals when capping adapter-estimated inputTokens - #286
[WRONG BRANCH] fix(usage): recompute totals when capping adapter-estimated inputTokens#286luvs01 wants to merge 1 commit into
Conversation
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe request log now recalculates ChangesUsage total recalculation
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to The PR keeps usage totals consistent when capped input tokens are normalized and adds focused regression coverage; no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
⏳ DRAFT
What to do
Its title has been prefixed with |
Motivation
inputTokenswhile an explicittotalTokensfield remained unchanged, violating theOcxUsageinvariant thattotalTokens = inputTokens + outputTokensand leaving persisted usage summaries inconsistent.Description
inputTokensvalue is reduced to the routed model'scontextWindow, the code now recomputestotalTokenstoinputTokens + outputTokensso the usage object remains internally consistent. The change is implemented insrc/server/request-log.tswithinfinalizedUsagewhere the adapter-estimated branch is normalized.usageobject and the persistedattempt.totalTokensare updated; the test lives intests/request-log-estimate-cap.test.ts.Testing
./node_modules/.bin/bun test tests/request-log-estimate-cap.test.ts --timeout 10000and it passed (all cases including the new regression)../node_modules/.bin/bun x tsc --noEmitsucceeded andbun run privacy:scanreturned "Privacy scan passed"../node_modules/.bin/bun run testrun progressed through the suite and exercised the affected subsystems, but encountered unrelated environment-sensitive timeouts in some long-running integration tests; the focused coverage for this fix passed.Codex Task
Summary by CodeRabbit