feat: add thinking_effort to turn telemetry events#1916
Merged
Conversation
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.
|
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_toggleonly fires when the user actively switches effort — users who never touch it produce no data.compaction_finished/compaction_failedcarrythinking_effort, but only on (rare) compactions.turn_started/turn_ended/turn_interruptedcarryprovider_type/protocolbut 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 theKIMI_MODEL_THINKING_EFFORToperational override) to the three turn lifecycle events, in both engines: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.trackcalls in the turn flow includeconfig.thinkingEffortdirectly.The property name follows the existing
thinking_effortprecedent fromcompaction_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
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.