[bug] 负 token 预算强制产生无效输出

Open Beginner friendly
#84 0 comments 0 reactions 0 assignees View on GitHub

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

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

status/needs-triage type/bug
step-realtime-cli 版本

1.0.0

Node 版本 & OS

Node 24.16.0 / Linux (Fedora 44)

复现步骤
  1. 构造一个远超出 context window 的对话(promptTokens > maxContextTokens
  2. Agent loop 在 computeStepMaxTokens 中计算 remainingBudget 为负数
  3. clamp 返回 minOutputTokens(默认 256)
  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stepfun-ai/Step-Code

All issues in stepfun-ai/Step-Code

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.