Skip to content

feat: add thinking_effort to turn telemetry events#1916

Merged
7Sageer merged 3 commits into
mainfrom
feat/turn-thinking-effort-telemetry
Jul 19, 2026
Merged

feat: add thinking_effort to turn telemetry events#1916
7Sageer merged 3 commits into
mainfrom
feat/turn-thinking-effort-telemetry

Conversation

@7Sageer

@7Sageer 7Sageer commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue — the problem is explained in the next section.

Problem

There is currently no telemetry source that can answer "which thinking effort levels do users actually run their sessions at":

  • thinking_toggle only fires when the user actively switches effort — users who never touch it produce no data.
  • compaction_finished / compaction_failed carry thinking_effort, but only on (rare) compactions.
  • turn_started / turn_ended / turn_interrupted carry provider_type / protocol but no effort, and there is no successful-request event.

So effort usage distribution across sessions is unmeasurable today.

What changed

Adds thinking_effort (the resolved effective effort, including the KIMI_MODEL_THINKING_EFFORT operational override) to the three turn lifecycle events, in both engines:

  • agent-core-v2: llmRequester.prepareTurnConfig() snapshots the model, effective thinking effort, and system prompt at the turn boundary. The loop uses the returned effort for all three lifecycle events, while every request in the turn reuses the same cached request configuration. Model-less turns safely skip the early snapshot so their prompt still materializes before the existing request-time error.
  • agent-core: the three track calls in the turn flow include config.thinkingEffort directly.

The property name follows the existing thinking_effort precedent from compaction_finished / compaction_failed. Telemetry-only instrumentation; no user-facing behavior change, so no changeset and no doc update.

Tests cover the lifecycle event fields, effective-effort resolution, a pre-step effort change that previously made telemetry disagree with the actual request, and the model-less server prompt path. The full PR CI suite passes, including build, lint, typecheck, all test shards, and Nix build.

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.

turn_started / turn_ended / turn_interrupted now carry the resolved
effective thinking effort in both engines, so per-turn and per-session
effort usage distribution becomes measurable. In agent-core-v2 the
profile domain mirrors the effective effort (including the
KIMI_MODEL_THINKING_EFFORT override) into the ambient telemetry context
on model / thinking changes and after restore; the loop snapshots it at
turn start. In agent-core the turn flow reads config.thinkingEffort at
each emission point.
@changeset-bot

changeset-bot Bot commented Jul 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 0b58df8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@pkg-pr-new

pkg-pr-new Bot commented Jul 19, 2026

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

commit: 0b58df8

@7Sageer
7Sageer merged commit df68995 into main Jul 19, 2026
15 checks passed
@7Sageer
7Sageer deleted the feat/turn-thinking-effort-telemetry branch July 19, 2026 13:41
7723qqq added a commit to 7723qqq/kimi-code that referenced this pull request Jul 20, 2026
Upstream changes:
- feat(cli): replace kimi server command tree with kimi web (MoonshotAI#1826)
  - Removed daemon/server lifecycle (svc/ layer for launchd/systemd/schtasks)
  - Multi-server instance registry replaces single-writer lock
  - /web TUI command uses server picker instead of daemon logic
- feat(minidb): switch agent-core-v2 query-store to ClusterDb with 16 shards (MoonshotAI#1907)
  - Multiple kimi processes can share the read model concurrently
- feat: scope thinking effort to current session (MoonshotAI#1933)
- feat: add thinking_effort to turn telemetry events (MoonshotAI#1916)
- fix(agent-core-v2): host fs stat follows symlinks, add explicit lstat (MoonshotAI#1843)
- feat(web): add cache invalidation note to model switcher (MoonshotAI#1940)
- ci: release packages (MoonshotAI#1868)

Conflicts resolved:
- 9 modify/delete conflicts: accepted upstream deletion (server/*, svc/*)
- 6 content conflicts: merged while preserving fork's i18n t() calls
  and fork-specific test suites (config edge cases)
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