# OP Non-Wetech Auto-Oncall Gate

> Partially superseded on 2026-07-15 by `2026-07-15-manus-op-grafana-staging-rollout.md`: exact `Account Alias = Manus` read-only runtime/performance diagnostics now use the dedicated `manus` evidence provider. The hard stop remains active for OP accounts other than exact Wetech or Manus.

## Current Design

- The worker runs the L1 Oncaller Gate, then asks the read-only LLM scenario classifier for semantic fields, then applies deterministic Auto Coverage policy.
- Jira `Account Alias` (`customfield_10095`) is parsed into `SupportCase.accountAlias`; `Wetech` is the only OP account with an automatic evidence provider.
- The superseded deterministic policy marked only APID non-Wetech evidence-required diagnostics. The active boundary is broader and independent of project/scenario classification.
- The LLM classifier receives `clusterId` and `accountAlias` for semantic context, but deterministic post-classifier policy remains authoritative before coverage evaluation.
- The per-ticket Feishu notification classifies from the worker's in-memory `skippedDetails`. Daily reporting reads the persisted `auto_coverage_gate.details_json` through `getJobsForReportWindow`; both ultimately depend on the gate classification.

## Risks

- An OP non-Wetech case can be enabled if the gate depends on APID project membership, diagnostic classification, or an LLM-supplied risk flag.
- Reimplementing account/diagnostic classification separately in Feishu ticket and daily rendering would create multiple sources of truth and could disagree with the gate.
- Trusting an LLM-supplied risk flag for a deterministic account boundary makes the hard stop non-deterministic.
- Treating project key, labels, ticket wording, or evidence mode as the OP signal creates inconsistent environment detection.

## Target Contract

- `SupportCase.clusterId` is the canonical TiDB Cloud environment signal. A missing/empty TiDB Cloud cluster ID means OP; the gate does not infer Cloud from project, labels, aliases, tenant IDs, org IDs, text, or comments.
- Jira `SupportCase.accountAlias` is the canonical account source. Only exact, case-insensitive `Wetech` is Wetech; missing or any other value is non-Wetech.
- Every OP non-Wetech case is deterministically normalized to `human_required`, `evidenceProvider=none`, and risk flag `op_non_wetech`, regardless of project, scenario, resolution, evidence mode, or whether it is Q&A.
- This normalization runs after any classifier implementation and before `evaluateAutoCoverage`, so issue allowlists cannot bypass it.
- Wetech cases and cases with an explicit TiDB Cloud cluster ID retain their existing classifier/coverage paths.
- The auto-coverage gate details row is the canonical classification record for downstream reporting. Feishu ticket-case and daily classification consume that same record/shape and do not reclassify Jira text or account fields.

## Non-Goals

- Do not change the L1 gate, poller, enabled scenario lists, Jira write behavior, or production automation settings.
- Do not add Investibook or another fallback for OP non-Wetech cases.
- Do not infer Wetech from cluster names, ticket text, labels, or comments.
- Do not deploy or modify app-delivery until local contracts pass and a rollout is explicitly requested.

## Implementation Steps

1. Apply deterministic `op_non_wetech` normalization at the Auto Coverage Gate boundary.
2. Include `accountAlias` in the LLM classifier input for semantic context, while keeping the deterministic policy authoritative.
3. Add contract tests for APID-29174-like Manus diagnostics, non-APID OP cases, OP pure Q&A, Wetech preservation, Cloud cluster-ID preservation, issue-allowlist non-bypass, and LLM output normalization.
4. Add Feishu per-ticket and daily tests proving both classify from gate details and produce the same non-Wetech category.
5. Search legacy/fallback paths and run focused plus full local verification.

## Verification Checklist

- An APID-29174-like `Account Alias = Manus` case without Cloud cluster ID is skipped before workspace creation, runner invocation, or Jira writes.
- Gate details contain `human_required`, `evidenceProvider=none`, and `op_non_wetech`.
- A non-APID OP non-Wetech case and an OP non-Wetech pure Q&A case are also hard-stopped.
- A Wetech case or a case with an explicit TiDB Cloud cluster ID retains its configured path.
- Per-ticket Feishu text and daily blocker counts both label the same gate details as `非 Wetech OP（不进入 auto-oncall）`.
- `npm run typecheck`, focused tests, and `npm test` pass.
