[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
- 2h 58m
- Merged PRs (30d)
- 1
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
-
status/needs-triage type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
stepfun-ai/Step-Code#85 · 1 comment ·
-
status/needs-triage type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
stepfun-ai/Step-Code#83 ·
-
status/needs-triage type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
stepfun-ai/Step-Code#81 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
stepfun-ai/Step-Code#80 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
stepfun-ai/Step-Code#118 ·
All issues in stepfun-ai/Step-Code
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
0xMiden/bridge-portal#132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:tools bug good first issue help wanted priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
TaewoooPark/Motifcode#14 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
newrelic-experimental/preflight#793 · 1 comment ·