MoonshotAI / MoonshotAI/kimi-code

fix(cli): share one deadline across telemetry shutdown pipelines

Open
#2,248 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

Context

kimi web can own more than one telemetry pipeline: host-level telemetry and kap-server engine telemetry. PR #2230 intentionally did not change the CLI-wide shutdown contract.

Problem

Independent sequential timeouts allow total shutdown latency to grow with the number of telemetry pipelines. Print/web entrypoints can also drift if each implements its own timer and cleanup ordering.

Scope

  • Establish one absolute telemetry shutdown deadline per CLI process exit.
  • Pass the remaining budget to each owned telemetry pipeline instead of giving each a fresh full timeout.
  • Keep telemetry cleanup best-effort and preserve the existing process exit result.
  • Share policy without coupling CLI entrypoints to appender internals.

Acceptance criteria

  • Total telemetry shutdown time stays within one configured budget across all pipelines.
  • A slow or failed pipeline does not prevent later cleanup or change the command's exit result.
  • Web and print lifecycle tests cover multiple pipelines, expired budgets, and rejection paths.

Follow-up to #2230.

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 the kimi web and print entrypoints and their lifecycle tests, then read PR #2230 for the existing shutdown contract. Confirm the tests cover multiple pipelines, expired budgets, rejection paths, later cleanup, and preservation of the command's exit result within one configured budget.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, observability-sre, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.