fix(latency-reporter): declare TokenizedPromptDataKey consumer for promptBuckets #4032
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.62) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.62 · 255 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.332
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.062
Real PR Conversation Timeline
1 comments
"Review active on #4032"
general
weight: 0.35
ahg-g
What type of PR is this?
/kind bug
What this PR does / why we need it:
latency-reporterfalls back torequest.Body.TokenizedRequest.TokenCount()inpromptTokens()whenresponse.Usage.PromptTokensis zero (such as cancelled, evicted, or failed streams, or streaming requests withoutstream_options.include_usage). Becauselatencyreporter.Plugindid not implementplugin.ConsumerPlugin,datalayer.CreateMissingDataProducersdid not automatically instantiate the defaulttoken-producerwhenlatency-reporterwas the only plugin needing tokenized prompts, leavingrequest.Body.TokenizedRequestnil and placing those requests into the lowest prompt bucket (le<first bound>).This change implements
Consumes()onlatencyreporter.Plugin:promptBucketsis empty (len(p.buckets) == 0),Consumes()returns an emptyplugin.DataDependencies{}because every request is labeled"all".promptBucketsis configured (len(p.buckets) > 0),Consumes()declarestokenizer.TokenizedPromptDataKey(fwkrequest.TokenizedRequest{}) as a required dependency so the framework instantiates the defaulttoken-producer.The review playbook (
docs/review/) caught this bug on PR #3715.Test plan:
latency-reporterwithoutpromptBucketsdeclares no data dependencies and does not trigger defaulttoken-producercreation.latency-reporterwithpromptBucketsdeclaresTokenizedPromptDataKey, triggersdatalayer.CreateMissingDataProducersto instantiatetoken-producer, passesdatalayer.ValidateAndOrderDataDependencies, and buckets a cancelled stream using the tokenized prompt count whenresponse.Usage.PromptTokensis zero.Which issue(s) this PR fixes:
N/A
Release note _(write
NONEif no user-facing change)_:``
release-notetoken-producerAutomatically enable the default
whenlatency-reporteris configured withpromptBucketsso responses without usage token counts are bucketed by estimated prompt length.
``