# Provider query identity and attempt recording

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "provider-query-identity-recording-2026-09-07",
  "problems": [
    {
      "problemId": "wetech-query-id-missing-attempts",
      "summary": "Dashboard success results omitted queryId and the execution ledger dropped calls with missing or underscore IDs, retaining only one of 22 actual calls.",
      "status": "candidate",
      "applicability": "Wetech Managed Tool result identity and Agent9 Provider attempt recording; this does not establish diagnosis quality or eliminate session bootstrap failures.",
      "issueKeys": ["APID-29464"],
      "sourceRefs": ["https://tidb.atlassian.net/browse/APID-29464#problem:wetech-query-id-missing-attempts"],
      "signalTextIncludesAny": ["wetech-query-id-missing-attempts"],
      "observedThrough": "2026-09-07",
      "effectiveAt": null,
      "verifiedAt": null,
      "attemptedAction": "Require objective-specific IDs in Evidence planning, return them from every Wetech operation, generate stable request-based defaults when absent, and retain legacy calls using execution references.",
      "evidenceUrl": "https://tidb.atlassian.net/browse/APID-29464"
    }
  ]
}
-->

Owner: Wetech Provider Executor for result identity; the Evidence Agent prompt
for supplying semantic IDs; runner execution materialization for the attempt
ledger. Implementation is prepared locally and not yet effective in the live
service. Base after synchronization: `d0e692fc907abcc5e4c90b3dbde8f1a427c0ea56`.

The source is APID-29464 read run `aea15dd8-c525-4bf9-9891-5470d8359302`.
All 22 calls succeeded, but 15 Dashboard calls omitted queryId and six metrics
calls used underscores rejected by the ledger. The diagnosis handoffs already
contained the evidence; the defect was incomplete execution recording.

Every Wetech call now returns its supplied ID. Missing or blank IDs receive
`default-<canonical request hash>` excluding queryId, so repeated identical
requests retain identity without grouping unrelated requests under a constant.
The prompt asks for objective-specific non-empty IDs, including supplemental
queries; semantic corrections still reuse the Agent-supplied ID. Legacy trace
recording accepts non-empty IDs and otherwise uses the call arguments,
Operation ID, or call ordinal. These references do not infer SQL identity.

The bounded criterion is complete attempt recording with stable supplied IDs,
distinct defaults for distinct requests, preserved correction history, and no
failed classification for successful empty data. Database semantics stay
`outcome=succeeded` with `result_status=empty` for an actual zero-row/series
response. Missing IDs are not empty query data.

Offline verification on 2026-09-07 using the production execution derivation
and the unchanged frozen trace retained 22 attempts: 21 complete, one empty,
zero failed; overall acquisition remained complete. Deterministic tests cover
all four Wetech operations, missing/blank IDs, legacy Clinic/Manus traces,
failed calls, and correction attempt numbering. The full suite passed 1178
tests plus six isolated replay runner tests. Wetech v58 and its immutable
bundle pins passed local validation; no installation or rollout was performed.
Evidence is stored privately
under `~/.cache/auto-oncall-services/investigations/provider-query-attempt-recording-20260907/`.

Next validation: after release, verify the installed Wetech package returns IDs
for real metrics and Dashboard results and the live runner retains every call.
No fresh diagnosis replay or historical publication artifact was generated by
this offline validation. Cross-egress session reuse remains a separate issue.
