# Clinic Capacity Metrics Window

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "clinic-capacity-metrics-window-2026-08-24",
  "problems": [
    {
      "problemId": "clinic-capacity-trend-blocked-or-expanded-into-detail-queries",
      "summary": "Clinic capped metric trends at six hours and the capacity path did not explicitly keep TopSQL and Slow Query detail out of default capacity acquisition.",
      "status": "candidate",
      "applicability": "Clinic-backed capacity-resource-pressure cases that need an aligned resource trend longer than six hours without a separate workload-attribution question.",
      "issueKeys": [],
      "sourceRefs": ["https://github.com/tidbcloud/aisupport#problem:clinic-capacity-trend-blocked-or-expanded-into-detail-queries"],
      "signalTextIncludesAny": [
        "clinic metric trend exceeds six hours",
        "capacity trend defaulted to topsql or slow query",
        "clinic capacity evidence window rejected"
      ],
      "observedThrough": "2026-08-24",
      "effectiveAt": null,
      "verifiedAt": null,
      "attemptedAction": "Allow Clinic metrics_query_range and Activities across a Router-authorized 30-day window, retain 24-hour detail-operation limits, and make capacity evidence metrics-first with optional bounded change correlation unless a separate workload-attribution Scenario is selected.",
      "evidenceUrl": null
    }
  ]
}
-->

- Owner: Clinic Managed Tool, Clinic provider skill, and capacity Scenario contract
- Source: Agent9 migration regression review
- Implementation status: local candidate; not deployed
- Effective status: `candidate`

## Bounded problem

The Clinic Managed Tool applied the same six-hour ceiling to Prometheus range
metrics, Activities, and every detail operation. That prevented the Evidence
Agent from using multi-day capacity trends or change history. The capacity path
also lacked an explicit boundary keeping workload-detail surfaces out of
ordinary capacity acquisition.

## Candidate change

Allow `metrics_query_range` and Activities to span at most 30 days while
retaining a 24-hour maximum for TopSQL, Slow Query, exported SQL, and logs. In
both local-plan and Agent9 Managed Tool execution, direct the capacity Evidence
Agent to compare range metrics for usage, effective limits, queueing,
throttling, backlog, and demand, with bounded Activities only when change
correlation is load-bearing. Every maximum is a ceiling: initial planning uses
the narrowest incident and baseline window and expands beyond 24 hours only for
an explicit multi-day trend or change-history question. Workload detail remains
owned by a separately selected Scenario.

## Verification status

Not yet deployed. Focused source and contract tests are delegated to the PR
checks.

## Next validation action

After merge and Tool/Skill publication, run one Clinic-backed capacity case
whose authorized window exceeds 24 hours. Verify a multi-day metric or Activity
query is used only when load-bearing, no default TopSQL or Slow Query call is
made, and the resulting trend or change correlation is present in the compact
evidence handoff.
