# Classifier Critical Missing-Key Contract

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "classifier-critical-missing-keys-2026-08-11",
  "problems": [
    {
      "problemId": "classifier-invented-noncritical-missing-keys",
      "summary": "The Scenario Classifier treated optional diagnostic refinements as missing inputs, emitted unstable free-form key names, and contradicted its own evidence_assisted handling mode.",
      "status": "optimized_unverified",
      "issueKeys": ["TCID-12986"],
      "sourceRefs": [
        "https://tidb.atlassian.net/browse/TCID-12986#problem:classifier-invented-noncritical-missing-keys"
      ],
      "signalTextIncludesAny": [
        "sql_digest_or_sql_text",
        "sql_identifier_or_digest",
        "incident_window_end",
        "evidence_assisted requires a Provider route and no missingKeys"
      ],
      "observedThrough": "2026-08-11",
      "effectiveAt": "2026-08-11T11:34:04Z",
      "verifiedAt": null,
      "attemptedAction": "Constrain classifier missingKeys to a canonical enum and instruct the classifier to emit only demonstrably absent critical inputs that block safe handling or the selected Provider from starting; keep the parser as a strict validator without semantic repair.",
      "evidenceUrl": "https://github.com/tidbcloud/aisupport/actions/runs/31486871861"
    }
  ]
}
-->

- Optimization ID: `classifier-critical-missing-keys-2026-08-11`
- Owner: auto-oncall-services
- Source: local repeated classification of TCID-12986
- Implementation status: deployed to staging as `fc4bea6bcff111dad44b7b653c68bd6e17b7f86d`
- Applicability: newly generated Scenario Classifier payloads

## Bounded problem

`missingKeys` accepted arbitrary strings and the prompt did not distinguish an
input that blocks handling from information that would merely improve a later
diagnosis. The same ticket therefore produced several invented key names and
an illegal `evidence_assisted` combination.

## Intended change

Keep semantic ownership in the Scenario Classifier. Supply the Agent with a
canonical missing-key vocabulary, explicit criticality rules, and the complete
legal handling matrix. Enforce that vocabulary and matrix in the structured
output schema and parser; do not infer, drop, or rewrite keys in the parser.

## Verification status

Parser and schema contract tests reject unknown and duplicate missing keys,
reject Investibook as a new classifier Provider, and preserve strict rejection
of illegal handling combinations. The complete rebased repository suite passes
with 742 tests. Five local TCID-12986 classifier attempts all returned
`missingKeys=[]` with the same SQL performance, evidence-assisted Clinic route.

The staging image became effective at `2026-08-11T11:34:04Z`. Completed
post-deployment TCID-12986 run `0f1508cd-45df-464c-8345-cc3ccb3ddba2`
persisted `sql_performance_tuning`, `evidence_assisted`, Provider `clinic`, and
`missingKeys=[]`, then executed two Clinic evidence rounds and final synthesis.
No free-form missing key, parser calibration, classifier failure, or
Investibook route occurred.

After staging advanced to descendant image
`d5b86d91700f9eaa523985ae830c427f106a2645`, current-runtime TCID-12986 run
`740eed71-f525-433c-a402-5ce8628ee074` reproduced the same classification and
`missingKeys=[]`. The subsequent split into `query-latency` and
`workload-hotspot` did not reintroduce a missing-key or Provider-routing
regression.

## Unresolved gaps

The bounded classifier criterion passes in staging, but the existing Jira
internal comment has not been refreshed. The problem therefore remains
`optimized_unverified` rather than `optimized_verified`. The final diagnosis
was `human_required` because record-level plan, scan, and workload-identity
evidence remained insufficient; that downstream evidence gap is not a
missing-key regression.

## Next validation action

After human review of the replay draft, refresh the applicable existing Jira
internal comment through the authorized write path, verify the same comment ID
and `public=false`, then promote only this bounded missing-key problem to
`optimized_verified`.
