[bug] 负 token 预算强制产生无效输出
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- backend-api-design
Research direction
Locate the Agent loop's computeStepMaxTokens function and trace how remainingBudget is clamped when the prompt exceeds maxContextTokens. Verify that a non-positive remaining budget avoids the model call or triggers compaction, and add or update coverage for this case if the surrounding tests provide an entry point.
Written by the indexing model from the issue text.
Description
step-realtime-cli 版本
1.0.0
Node 版本 & OS
Node 24.16.0 / Linux (Fedora 44)
复现步骤
- 构造一个远超出 context window 的对话(
promptTokens > maxContextTokens) - Agent loop 在
computeStepMaxTokens中计算remainingBudget为负数 clamp返回minOutputTokens(默认 256)- API 返回 context length exceeded 错误(或抛出异常)
期望行为
remainingBudget 小于等于 0 时应返回 0,跳过该次模型调用或触发 compact 流程
实际行为
模型被强制要求生成 256 token 的输出,但 context 窗口已无空间,API 调用失败
日志 / 堆栈
截图(可选)
No response
自检
- 我已搜索 existing issues,确认这不是重复问题
- 我已阅读 CONTRIBUTING.md
- Dominant language
- TypeScript
- Stars
- 54
- Forks
- 20
- Avg merge
- 23m
- Merged PRs (30d)
- 7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stepfun-ai/Step-Code
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
stepfun-ai/Step-Code#153 · 2 comments ·
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
stepfun-ai/Step-Code#151 · 1 comment ·
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
stepfun-ai/Step-Code#149 · 1 comment ·
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
stepfun-ai/Step-Code#148 · 1 comment ·
-
untriaged
Difficulty 1/5 Under an hour Newbie friendliness 90/100
stepfun-ai/Step-Code#144 · 1 comment ·
All issues in stepfun-ai/Step-Code
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug v2
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
modelcontextprotocol/inspector#2458 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
carbon-design-system/ibm-products#9907 ·