Meta: quota exhaustion reports need per-request usage in wire logs to be actionable
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 15/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
调研方向
Start in loopService.ts around dynamicTools (about line 638 for normal turns, 861 for operation requests) and operationTools() (about line 658), and compare how the compaction request resolves its tools block with a normal turn. The open question is which tool-resolution approach to use, and the issue is still awaiting maintainer approval. Done means the compaction request keeps the same tools block as a normal turn, so the cached prefix is reused, and the wire log records the per-request fields the issue describes.
由索引模型根据 Issue 内容生成。
描述
Several reports describe quota being consumed faster than expected. Grouping them here because they need the same kind of evidence to become actionable, and because at least one of them has a measured cause we can fix.
Primary: #679, #3948, #3781, #3926. All are still open.
One measured case
#4935 records a compaction with 941,639 input tokens and only 26,368 cached (2.8%). The reporter's controlled follow-up found the cause: with a tool allowlist active, a normal request sends about 40 tool definitions but the compaction request sends 30, and cache hits drop from 98.1% to 2.6%. Tool definitions sit at the front of a request, so a change there invalidates the cached prefix for the system prompt and everything after it — extra billable input on every compaction.
The other reports lack the data to say what happened. #679 reports 26 interactions in 90 seconds with two log lines and no reproduction steps. #3948 is a screenshot plus "does not follow instructions, wastes tokens". #3781 names 0.7.5 as a regression and asks whether context is being re-sent; #3926 reports a stuck turn followed by a 403. None of these can currently show whether the quota went to repeated requests, one uncached request, a changed tools block, or a request that never completed — and a maintainer cannot tell from the metadata either.
Proposed direction
We are preparing two changes and will share the full patch in a PR once this issue is approved:
- Keep the tools block stable across compaction. Normal turns resolve tools dynamically (
dynamicTools: true, loopService.ts:638), but operation requests default todynamicTools: false(loopService.ts:861) andoperationTools()(loopService.ts:658) filters a startup snapshot of tools — it can only remove, never add. That is why the compaction request ends up with a different tools block and breaks the cached prefix. The direction is to make the compaction request use the same tool resolution as a normal turn. We are still weighing a one-linedynamicTools: trueagainst having operation inherit the previous turn's exact tools snapshot; the trade-off is whether deferred-tool schemas leak into the operation, and will be resolved in the PR. - Make future reports self-evident. Add per-request fields to the wire log — turn and step ids, a hash of the tools block, cache hit count, and the step-end reason — so a report can show whether quota went to repeated requests, one uncached request, a changed tools block, or a request that never completed.
Full diffs, edge cases (deferred tools, allowlist changes, profile switches), and tests will come with the PR. We are deliberately not treating all four reports as one root cause: #4935 is proven, #3926 is plausibly the stuck-turn problem tracked separately, #679 and #3948 need logs before any conclusion, and #3781 needs a version-by-version comparison. A session-level spending cap is a product decision and is out of scope.
Request
Would a maintainer /approve this issue so we can open an external bug-fix PR linking it? We would scope the PR to the measured #4935 cache fix and the logging change, and leave the symptom-only reports for follow-up. Happy to wait for triage or narrow further if needed.
This is based on code audit and the reports linked above; I do not have a runnable checkout, so the test suite and a live A/B measurement will be part of the PR.
- 主要语言
- TypeScript
- 星标
- 8.3k
- 派生
- 1.4k
- 平均合并
- 12 小时 6 分钟
- 30 天内合并 PR
- 596
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
MoonshotAI/kimi-code 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
MoonshotAI/kimi-code#5539 ·
维护者通常 1 天内回复
-
[Bug] Kimi RC workspace folder picker does not display symbolic link directories可能已有人在做 @markankamaransheogarat-sys 于 2 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 62/100
MoonshotAI/kimi-code#5296 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
MoonshotAI/kimi-code#5256 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
MoonshotAI/kimi-code#5062 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
MoonshotAI/kimi-code#5057 ·
维护者通常 1 天内回复
查看 MoonshotAI/kimi-code 的全部 Issue
相似的 Issue
-
Add Alice&Bot未关闭
难度 1/5 1 小时以内 新手友好度 72/100
slavakurilyak/awesome-ai-agents#1048 ·
-
bot:ai-assisted component:faucet github_actions security status:untriaged
难度 2/5 1-3 小时 新手友好度 86/100
midnightntwrk/midnight-faucet-api#215 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 82/100
NanmiCoder/cc-haha#2034 · 1 条评论 ·
维护者通常 1 天内回复
-
mobile prio:low
难度 2/5 1-3 小时 新手友好度 70/100
digitalfabrik/entitlementcard#3324 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复