# Wetech Slow Query Handoff Priority

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "wetech-slow-query-handoff-priority-2026-08-18",
  "problems": [
    {
      "problemId": "selected-slow-query-fields-displaced-from-compact-preview",
      "summary": "Wetech returned Evidence Agent-selected Slow Query fields in the raw Dashboard payload, but generic core fields consumed the compact-row budget first and displaced the load-bearing transaction facts.",
      "status": "optimized_verified",
      "applicability": "Wetech Slow Query batches whose ordered handoffFields extend beyond the generic compact preview prefix.",
      "issueKeys": ["APID-29340"],
      "sourceRefs": ["https://tidb.atlassian.net/browse/APID-29340#problem:selected-slow-query-fields-displaced"],
      "signalTextIncludesAny": ["raw payload contained selected fields", "compact preview omitted handoffFields", "generic core fields displaced selected facts"],
      "observedThrough": "2026-08-18",
      "effectiveAt": "2026-08-18T10:25:34Z",
      "verifiedAt": "2026-08-18T10:42:17Z",
      "attemptedAction": "Reserve the compact Slow Query row budget for mandatory identity and execution-time facts, then preserve all ordered handoffFields before unselected generic core fields.",
      "evidenceUrl": "https://github.com/tidbcloud/aisupport/pull/983"
    }
  ]
}
-->

- Optimization ID: `wetech-slow-query-handoff-priority-2026-08-18`
- Owner: Provider Executor, Wetech Slow Query compact projection
- Source reference: `APID-29340`, deployed replay
  `5c3c5806-6a68-45f5-a6a8-7953d26e25b3`
- Implementation status: merged in PR `#983` and deployed on live image
  `5b2c2addc361b8528e1a2a4d4f324ce9c5f37226`
- Effective status: `optimized_verified`

## Bounded problem

The live Evidence Agent correctly made exact-Digest Slow Query the first
write-path operation and selected twelve transaction, wait, scan, and
coprocessor fields. Dashboard returned those fields in every raw row and marked
the projection supported. The provider's compact preview nevertheless retained
the generic core prefix first; its 24-field bound then omitted the selected
write facts before the Scenario Diagnostic Agent handoff.

## Change

- Keep API-required fields in the raw request, but do not let their ordering
  define compact semantic priority.
- Reserve compact rows for safe workload identity, derived execution interval
  and overlap, and plan availability.
- Preserve the Evidence Agent's ordered, validated `handoffFields` next.
- Leave unselected generic core fields available in the raw provider artifact
  without allowing them to displace the scenario-selected facts.

## Verification status

The regression fixture reproduces the live APID field set and requires all
twelve handoff fields plus mandatory identity/time facts to survive the same
24-field compact limit. The deployed read replay
`368bc618-2a66-4d42-be2b-737ad14c584f` then carried six 33.6-45.5 second
executions with roughly 7.26 million `write_keys` and 388 MB, plus the aligned
0.73 second / 239,200-key execution, into the Scenario Diagnostic Agent. The
write replay `dcd62c16-f47b-42db-bcb4-4d252d413a8e` reproduced those compact
facts, persisted run `150086`, and updated Jira comment `23548869` in place as
`public=false`; the Base row synced at `2026-08-18T10:42:17Z`.

## Unresolved gaps

This projection repair does not add provider fields or change their meaning.
It does not make `write_keys` an affected-row count, decode an encoded-only
plan, or decide the ticket diagnosis.

## Next validation

Monitor future Wetech Slow Query cases whose selected handoff fields approach
the compact-row limit. Any new omission should be evaluated against the
existing 24-field bound rather than expanding the budget by default.
