Skip to content

feat(kimi-code): add a tps slot to the status line - #3668

Open
zhi1ong wants to merge 3 commits into
MoonshotAI:mainfrom
zhi1ong:feat/status-line-tps-slot
Open

feat(kimi-code): add a tps slot to the status line#3668
zhi1ong wants to merge 3 commits into
MoonshotAI:mainfrom
zhi1ong:feat/status-line-tps-slot

Conversation

@zhi1ong

@zhi1ong zhi1ong commented Sep 9, 2026

Copy link
Copy Markdown

Related Issue

Resolve #3666

Problem

There is no way to see how fast the model is generating while working. The status line already carries the persistent, at-a-glance session state — mode, goal, model, tasks, cwd, git, tips — but nothing reports throughput, so generation speed can only be judged by feel.

Custom status lines have a narrower version of the same gap: [status_line].command takes over the first footer line outright, and the stdin snapshot carries no rate, so a script cannot render one even if it wanted to.

What changed

  • New tps built-in slot. Renders the decode rate of the most recent measurable step, e.g. 42.3 tok/s, placed after cwd in the default layout. Like every other slot it can be reordered or dropped through [status_line].items in tui.toml.
  • decodeTps added to the status line command payload. A custom command now receives the same number on stdin (number | null, null until a step has been measured), keeping it at parity with the built-in slot instead of losing the readout.
  • The rate calculation is now a shared helper. stepDecodeTps() is extracted from the existing debug timing line and used by both, so both always report the same number over the same decode window — including the existing 50 ms floor, below which the duration is dominated by Date.now() quantization and the ratio would be meaningless. The extraction is behavior-preserving: the existing timing tests are unchanged and still pass.

Two behavior notes:

  • Steps that finish too fast to measure leave the previous reading in place rather than clearing the slot, so a run of quick tool calls does not make the number blink in and out. The slot is simply absent until the first measurable step completes.
  • Subagent steps do not feed the slot — child-agent events are routed away before the main dispatch, so background agents cannot move the main status line.

The rate is output tokens over the client-observed stream duration, so it reflects the speed actually perceived, including when the TUI itself is the bottleneck. #3666 discusses using the server-side decode window as an alternative.

Docs updated in both locales: the slot list and the commented example in config-files.md now include tps.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: the issue must have a maintainer's /approve).
  • 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.

Show the decode rate of the most recent measurable step in the footer,
placed after cwd in the default layout and reorderable through
`[status_line].items`. Custom status line commands receive the same
number as `decodeTps` in their stdin payload.

Steps too short to time leave the previous reading in place instead of
clearing the slot, and the rate is computed by a helper shared with the
debug timing line so both report the same number.
@changeset-bot

changeset-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8c85284

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-09T04:41:53.194574Z c68892b New commits
🔒 Security Review Completed 2026-09-09T04:41:46.642963Z c68892b New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 289c498d35

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/kimi-code/src/tui/controllers/session-event-handler.ts
`/new` and session switching go through resetSessionRuntime, which cleared
every other per-session readout but left decodeTps in place. The rate is not
persisted, so a resumed session could not overwrite it either, and the footer
and the status line command payload kept reporting the previous session's
number until the next measurable step.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c68892b0c7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/kimi-code/src/tui/components/chrome/footer.ts
The stdin snapshot field list in the configuration guide did not mention
decodeTps or that it stays null until a step has been measured, so a script
author could neither discover the field nor guard against the null.
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.

feat(tui): show the output token rate (tok/s) in the status line

1 participant