# Global Duration Classification

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "global-duration-classification-2026-08-13",
  "problems": [
    {
      "problemId": "global-duration-symptom-classified-as-query-tuning",
      "summary": "An overall Duration/P999 incident is classified as SQL performance tuning when slow queries are only a suspected explanation and no Query is the entry subject.",
      "status": "optimized_verified",
      "applicability": "Symptom-led service or cluster Duration, P99, or P999 incidents without a supplied target SQL, Digest, plan, or slow-query record.",
      "issueKeys": ["APID-29274"],
      "sourceRefs": [
        "https://tidb.atlassian.net/browse/APID-29274#problem:global-duration-symptom-classified-as-query-tuning"
      ],
      "signalTextIncludesAny": [
        "overall duration classified as sql performance tuning",
        "suspected slow query changes entry classification",
        "global p999 symptom treated as a specific query"
      ],
      "observedThrough": "2026-08-13",
      "effectiveAt": "2026-08-13T14:53:00Z",
      "verifiedAt": "2026-08-13T15:16:00Z",
      "attemptedAction": "Keep overall Duration percentile symptoms in cluster_runtime_issue until a specific SQL, Digest, plan, or slow-query record is the entry subject; leave workload discovery to downstream diagnosis.",
      "evidenceUrl": "https://tidb.atlassian.net/browse/APID-29274?focusedCommentId=23351216"
    }
  ]
}
-->

- Optimization ID: `global-duration-classification-2026-08-13`
- Owner: Scenario Classifier semantic prompt
- Source reference: `APID-29274` frozen historical replay
- Implementation status: deployed to staging in image `917145b45f408a2a89a1c4c5ac301eb9e0d785df`
- Effective status: `optimized_verified`

## Bounded problem

With the post-cutoff policy contaminant removed from the supplied snapshot,
current staging classified APID-29274 as
`sql_performance_tuning / evidence_assisted / wetech`. The entry problem is an
overall production Duration/P999 increase. Slow queries are only the
customer's suspected explanation, and no SQL, Digest, plan, or slow-query row
identifies a query at entry.

## Candidate change

- State explicitly in the classifier contract that an overall
  Duration/P99/P999 symptom remains `cluster_runtime_issue` when query identity
  is not the entry subject.
- Keep supported workload discovery downstream. A later Query candidate does
  not rewrite the historical entry classification.

## Verification evidence

Staging replay runs `f903335a-315b-40c6-b043-37200fe8dcd0` (`mode=read`) and
`5b552e11-7ad7-4ce7-949e-8e6b5f4d6431` (`mode=write`) both classified the
frozen ticket as `cluster_runtime_issue / evidence_assisted / wetech`. The
write replay completed as DB run `150033`, was judged `ai_better`, and updated
the mapped internal Jira comment `23351216` with `public=false`.

## Unresolved gaps

- The historical provider window does not establish a 07/24 pre-release
  baseline, so the refreshed diagnosis does not claim release causality.

## Next validation action

Monitor later global Duration cases for regression without suppressing a
specific SQL-led case that should still enter query tuning.
