# Customer Language And Documentation Locale

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "customer-language-documentation-locale-2026-08-13",
  "problems": [
    {
      "problemId": "customer-reply-documentation-language-mismatch",
      "summary": "A Chinese TiDB Cloud how-to question received a Chinese answer that cited the English documentation path, while reply behavior for languages other than Chinese and English had no explicit English fallback.",
      "status": "optimized_verified",
      "applicability": "Customer-facing auto-oncall drafts and official documentation references for Chinese, English, or other-language questions.",
      "issueKeys": ["ST-2891"],
      "sourceRefs": [
        "https://tidb.atlassian.net/browse/ST-2891#problem:customer-reply-documentation-language-mismatch"
      ],
      "signalTextIncludesAny": [
        "chinese answer cites english documentation",
        "documentation language does not follow the user",
        "non-chinese non-english reply has no english fallback"
      ],
      "observedThrough": "2026-08-13",
      "effectiveAt": "2026-08-13T03:31:16Z",
      "verifiedAt": "2026-08-13T03:54:10Z",
      "attemptedAction": "Have the semantic answer Agent follow clearly Chinese and English customer questions in the same language, default every other or unrecognized language to English, and search for and select a verified current official documentation page in the response language without runner-owned locale mappings or invented URLs.",
      "evidenceUrl": "https://tidb.atlassian.net/browse/ST-2891"
    }
  ]
}
-->

- Optimization ID: `customer-language-documentation-locale-2026-08-13`
- Owner: support reply language and documentation selection
- Source reference: `ST-2891`, customer-visible comment `23547491`, internal replay comment `23549042`
- Implementation status: deployed to staging and write-replayed on image tag `e1a7ea63a2deed950485500ea4f022cd08686f2e`
- Effective status: `optimized_verified`

## Bounded problem

ST-2891 asked in Chinese how to configure TiDB Cloud resource groups. The
generated answer followed the customer language, but cited the English
`/tidbcloud/` page instead of the available Chinese `/zh/tidbcloud/` page.
The existing response rule also covered Chinese and English without explicitly
defining the fallback for other or unrecognized languages.

## Implemented change

- Follow the latest substantive Chinese or English customer question.
- Default every other or unrecognized language to English.
- Prefer a verified current official documentation page in the response
  language, while retaining an available official page when no localized
  equivalent exists and never fabricating a locale path.
- Keep direct-answer documentation search and selection in Primary Analysis.
- Let Scenario Router reconciliation search and select applicable official
  documentation for a diagnostic answer; Final Response preserves those links
  exactly, and deterministic result handling never maps documentation locales.
- Apply the same response-language fallback to the diagnostic Final Response
  wording turn without giving it documentation-selection ownership.

## Verification status

The Chinese and English selection, other-language fallback, documentation
locale preference, and no-fabricated-URL boundary have contract tests. Source
PR `tidbcloud/aisupport#857` passed CI and staging deployment workflow
`31663897116`; app-delivery PR `tidbcloud/app-delivery#77115` updated only the
staging image tag. The live Deployment then reported the target image, one
Ready Pod with zero restarts, and HTTP 200 from both `/healthz` and `/readyz`.

The post-change ST-2891 `mode=read` replay run
`18db11dd-a8b8-4351-9e8f-52134565ded9` used
`historical_reply_replay`, hid target comment `23547491` and every later
comment, selected `direct_answer` with provider `none`, and completed without
an evidence-acquisition failure. Its customer draft remained Chinese and cited
the exact verified page
`https://docs.pingcap.com/zh/tidbcloud/tidb-resource-control-ru-groups/`.

After image `e1a7ea63a2deed950485500ea4f022cd08686f2e` became Ready, write replay run
`c2e2b77c-c417-4d32-8b96-d11074b36871` reused bot-assignment owner job `150069`
and persisted run DB `150019`. Publication reported database, Jira, evaluation,
and Feishu Dashboard writes without errors; the evaluation verdict was
`ai_better`.

The original customer reply `23547491` remained `public=true` with its prior
English documentation link. Because the owner-scoped idempotency key had no
existing internal target, the write replay created exactly one independent
internal comment, `23549042`, with `public=false` and the verified Chinese
documentation link. Database readback mapped
`auto-live:v1-b-b4d4c474122f5dda:ST-2891:initial` to that comment. Jira comment
count moved from nine to ten, with `23549042` as the only internal comment, so
no public comment was overwritten and no duplicate internal comment was
created.

## Next validation action

Keep the language, documentation-locale, owner-job reuse, and internal-comment
idempotency tests as preservation checks. A repeated write replay must update
internal comment `23549042` through the same mapping rather than create another
comment; no repeated write is required for this verification.
