MoonshotAI / MoonshotAI/kimi-code

feat: show total duration per turn (like Codex's "Worked for 41s") in both TUI and Web UI

Open
#3,782 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.5k
Forks
1.2k
Avg merge
11h 53m
Merged PRs (30d)
350

Description

What feature would you like to see?

After the agent finishes each turn, show the total wall-clock duration of that turn — from the user's message until the final response of the turn completes, including thinking, tool calls, and waiting on background tasks — similar to Codex's Worked for 41s. This should be available in both the CLI TUI and the Web UI (kimi web), with consistent behavior.

Motivation

Right now only per-step timings are shown (thinking time, individual tool/subagent execution time), so there is no easy way to see how long a whole turn took. A per-turn total would help users:

  • Gauge the real wall-clock cost of a task, not just token usage
  • Compare speed across models and task types
  • Match the mental model built from Codex, Claude Code, and similar tools that already show a turn-level summary
Additional information

Some technical notes that may be useful (as of v0.43.0):

  • The engine already emits durationMs in the turn.ended event payload (packages/agent-core-v2/src/agent/loop/turnOps.ts), and both delivery paths appear to forward it — the WebSocket event schema (packages/kap-server/src/protocol/events-zod.ts) and the transcript projection (packages/kap-server/src/services/projection/agentProjector.ts) both include durationMs — so this may be mostly a rendering-layer change with no backend work needed.
  • Edge cases to consider:
    • turn.ended fires for subagents as well; the total should only be shown for user-visible main-agent turns.
    • When resuming older sessions, durationMs may be missing from replayed records and should be handled gracefully (hide instead of showing a wrong value).
  • Relation to #2705: that issue proposes message timestamps plus response duration in the TUI (CLI-only). This request overlaps with it on the TUI side, but emphasizes a consistent turn-total summary across both TUI and Web UI (without needing per-message timestamps). Happy to have these merged/considered together.

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.

Research direction

Start with turn.ended and durationMs in packages/agent-core-v2/src/agent/loop/turnOps.ts, then trace the existing delivery paths through packages/kap-server/src/protocol/events-zod.ts and packages/kap-server/src/services/projection/agentProjector.ts. Identify the TUI and Web UI renderers, show totals only for user-visible main-agent turns, hide missing replayed durations, and verify consistent output in both interfaces.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, frontend, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.