Skip to content

fix: avoid inflated debug TPS#848

Closed
7Sageer wants to merge 1 commit into
MoonshotAI:mainfrom
7Sageer:codex/fix-debug-tps
Closed

fix: avoid inflated debug TPS#848
7Sageer wants to merge 1 commit into
MoonshotAI:mainfrom
7Sageer:codex/fix-debug-tps

Conversation

@7Sageer

@7Sageer 7Sageer commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue. Fixes a reproducible debug-mode reporting issue where short tool-call streams can display unrealistically high TPS values.

Problem

Debug timing computed TPS from the stream window after the first chunk. For tool-call steps that stream their output in only a few milliseconds while still reporting total output tokens, debug mode could show rates like tens of thousands of tokens per second.

What changed

Compute debug TPS over the full model response window (TTFT + stream duration) while still showing the raw stream duration in the diagnostic text. Added a regression test for a 1ms stream window and included a patch changeset.

Validation

  • pnpm --filter @moonshot-ai/kimi-code exec vitest run test/utils/usage/debug-timing.test.ts
  • git diff --check
  • pnpm -w run build:packages
  • pnpm --filter @moonshot-ai/vis-server run build
  • pnpm --filter @moonshot-ai/kimi-code run typecheck fails with existing TS2307: Cannot find module '@moonshot-ai/vis-server/start' at src/cli/sub/vis.ts:134:49

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4a667de

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jun 17, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@4a667de
npx https://pkg.pr.new/@moonshot-ai/kimi-code@4a667de

commit: 4a667de

@7Sageer 7Sageer mentioned this pull request Jun 17, 2026
5 tasks
@7Sageer

7Sageer commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #849, which keeps decode-TPS semantics and only skips TPS when the stream window is too short to measure, instead of redefining TPS over the full response window.

@7Sageer 7Sageer closed this Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant