# Current Configuration Agent9 Retry Latency

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "current-config-agent9-retry-latency-2026-08-27",
  "problems": [
    {
      "problemId": "current-config-agent9-validation-retry-latency",
      "summary": "A bounded four-parameter configuration lookup still needed three Agent9 Managed Tool calls because the first two configuration selector attempts failed local validation, leaving the complete replay at 249.5 seconds.",
      "status": "optimized_verified",
      "applicability": "Provider-backed current configuration lookups whose Evidence Agent retries configuration_key_invalid before producing a valid multi-key selector batch.",
      "issueKeys": ["TCID-13091"],
      "sourceRefs": [
        "https://tidb.atlassian.net/browse/TCID-13091#problem:current-config-agent9-validation-retry-latency"
      ],
      "signalTextIncludesAny": [
        "configuration_key_invalid",
        "current configuration lookup",
        "TCID-13091"
      ],
      "observedThrough": "2026-08-27",
      "effectiveAt": "2026-08-27T13:27:36Z",
      "verifiedAt": "2026-08-27T13:31:35Z",
      "attemptedAction": "Deployed Managed Clinic v19 with a batch-only Agent-visible schema, an exact configuration selector shape, one configuration entry for all requested keys, helper-owned Clinic-to-CloudConfig fallback, and at most one changed selector-validation correction. The post-deploy TCID-13091 read replay used one valid Managed Tool call for all four keys with no validation repair; the Evidence Agent Provider turn fell from 110.8 seconds to 70.2 seconds.",
      "evidenceUrl": "https://github.com/tidbcloud/aisupport/pull/1130"
    }
  ]
}
-->

- Optimization ID: `current-config-agent9-retry-latency-2026-08-27`
- Owner: Evidence Agent configuration-plan translation and same-turn repair
- Source: TCID-13091 read replay
  `6e4c6f2e-aa70-479e-8b36-26947ba6eeaf`
- Implementation status: deployed in Auto-oncall SHA
  `2725d5270ae239bf2db016ae67aaa84678962f53` and Managed Clinic v19
- Effective status: `optimized_verified`

## Bounded problem

The deployed replay correctly reduced evidence acquisition to one logical
configuration query with four selectors and returned 64, 64, 32, and 32. The
Evidence Agent nevertheless invoked `managed_auto_oncall_clinic` three times.
The first two single-query calls failed with `configuration_key_invalid`; only
the third reached Provider transport and completed through Clinic 403 followed
by CloudConfig fallback. The scenario stage took 165.1 seconds and the complete
read replay took 249.5 seconds.

Clinic batch execution was not serial across four parameters. All four
selectors were returned by one successful configuration operation. The
remaining latency is the cost of two avoidable Agent9 Tool turns plus the
fixed Router, Scenario Diagnostic Agent, reconciliation, and Final Response
turns.

## Implemented repair

- Managed Clinic v19 exposes only `issueKey`, `orgId`, and `queries` to the
  Evidence Agent. The single-operation path remains implementation-only for
  existing deterministic callers.
- One configuration objective carries all requested selector objects in one
  `configKeys` array. The Tool schema and Evidence Agent prompt include the
  exact `{component, key}` shape and prohibit string selectors or per-key Tool
  calls.
- Clinic-to-CloudConfig fallback and both credentials remain inside the Managed
  Tool. The Evidence Agent cannot select CloudConfig as another operation.
- A configuration selector validation error permits at most one changed
  correction rather than the generic four-attempt query repair budget.

Local verification passed the complete 1,001-test suite. The configuration
contract test executes one batch entry with all four TCID-13091 selectors,
observes Clinic 403, and receives the complete CloudConfig fallback result.

The post-deploy read replay `86c7bfc5-8959-422b-affa-c120ddcc8a16` verified the
same path against the live services. The Evidence Agent made one Skill read and
one `managed_auto_oncall_clinic` call. That call contained one configuration
query with four selectors; no `configuration_key_invalid` result or correction
call occurred. Managed Clinic v19 recorded Clinic HTTP 403 followed by a
complete helper-owned CloudConfig fallback and returned 64, 64, 32, and 32.

The Provider-facing Evidence Agent turn fell from 110.8 seconds to 70.2 seconds
(-40.6 seconds, -36.6%). The complete scenario stage fell from 165.0 seconds to
147.8 seconds (-17.2 seconds). This verifies the bounded validation-retry
optimization.

## Unresolved gaps

- The full diagnostic pipeline remains too slow for a simple factual lookup.
  Its Agent-runtime span improved only from 241.9 seconds to 238.1 seconds, and
  observed HTTP wall time varied from 249.5 seconds to 256.7 seconds. The
  Scenario Diagnostic Agent and Router reconciliation were 23.4 and 11.2
  seconds slower in the verification replay, respectively, offsetting most of
  the query-turn gain.
- The raw invalid selector values from the pre-change replay remain redacted in
  durable Agent9 operation history. Operation count and the stable validation
  error code are observable and sufficient for this bounded criterion.

## Next validation action

Treat total diagnostic-pipeline latency as a separate problem with its own
earliest-owner evidence. Do not repeat the configuration batching repair: the
live replay already proves one valid helper call and substantially lower
Provider-facing Evidence Agent latency.
