Skip to content

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

Description

@7Sageer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions