# Related Evidence Keyword Expansion

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "related-evidence-keyword-expansion-2026-07-23",
  "problems": [
    {
      "problemId": "related-evidence-keyword-recall-too-narrow",
      "summary": "Related evidence retrieval is gated by explicit prior-ticket wording, ranks Jira candidates from titles alone, and misses relevant public tikv/tikv Issues when the extracted error signature is too generic.",
      "status": "optimized_verified",
      "issueKeys": ["APID-29188", "ST-2824", "APID-29203"],
      "sourceRefs": ["https://github.com/tikv/tikv/issues/19196#problem:related-repo-not-searched", "https://tidb.atlassian.net/browse/APID-29203#problem:tikv-issue-not-retrieved"],
      "signalTextIncludesAny": ["不建议加之前的这种限制", "不要只用标题内的关键词", "github issue 还要加上 tikv/tikv"],
      "observedThrough": "2026-07-23",
      "effectiveAt": "2026-07-23T04:04:46Z",
      "verifiedAt": "2026-07-23T04:13:32Z",
      "attemptedAction": "Always recall cutoff-safe same-reporter Jira candidates, keyword-rank Jira summary and description without labels, components, comments, or attachments, search both pingcap/tidb and tikv/tikv public Issues, prioritize the specific S3 SlowDown request-rate signature over generic backup summaries, and select a shared top three after both branches return.",
      "evidenceUrl": "https://tidb.atlassian.net/rest/api/3/issue/7907341/comment/23247770"
    }
  ]
}
-->

- Optimization ID: `related-evidence-keyword-expansion-2026-07-23`
- Owner: Codex implementation requested on 2026-07-23
- Source reference: user review of the related-evidence retrieval contract and
  public `tikv/tikv#19196`
- Implementation status: the keyword expansion and signature-specific follow-up
  are deployed to staging
- Effective status: `optimized_verified`

## Bounded problem

The previous backend searched same-reporter Jira history only when visible text
explicitly refers to an earlier ticket, and it ranks those candidates from the
summary alone. Public product Issue retrieval is restricted to
`pingcap/tidb`. A first staging replay also showed that a generic backup summary
can outrank the specific S3 `SlowDown` error and omit the matching
`tikv/tikv#19196`.

## Intended change

Always perform the cutoff-safe same-reporter Jira recall. Request only summary,
description, status, created, and updated fields, then keyword-rank summary and
description. Search both approved public GitHub repositories and perform one
combined top-three selection after Jira and GitHub recall. Do not retrieve Jira
labels, components, comments, or attachments.

## Verification

On 2026-07-23, the complete repository test suite passed: 404 tests across 49
suites. Focused coverage verifies unconditional same-reporter Jira recall,
description-only keyword matches, the exact Jira field boundary, independent
Jira/GitHub recall before the shared top-three selection, both approved GitHub
repositories, URL validation, cutoff filtering, and the shared prompt contract.
The follow-up S3 signature test raised the complete suite to 405 tests and
verifies that `SlowDown`, `Please reduce your request rate`, and HTTP 503 recall
`tikv/tikv#19196`.

The first staging deployment used service commit
`b8c8be75c922cb6b4671bb99d2427107e07bd156`. Replays refreshed APID-29188
(run `4d37549c-0869-4b91-902a-b2728051f8c7`, Jira comment `23251582`) and
ST-2824 (run `5cc9662a-f356-4d60-8d6a-569c4b4623a5`, Jira comment
`23210686`). A read-only APID-29203 replay
(`5175ac8d-4a95-46bf-adc2-fb2168d8c38e`) exposed the remaining generic
signature gap without changing Jira.

The follow-up was merged in service PR
[`tidbcloud/aisupport#463`](https://github.com/tidbcloud/aisupport/pull/463),
deployed as image commit
`3a8296085f3299ae04656cd887fe03d34203d2b9`, and rolled through
[`tidbcloud/app-delivery#75232`](https://github.com/tidbcloud/app-delivery/pull/75232).
The post-deployment APID-29203 read replay
`6fdae665-b7c4-4fa4-8e73-e754fcc1268f` ranked `tikv/tikv#19196` first and
adopted it in the analysis. Write replay
`33b48748-0ad1-4fa5-8592-6a8e7d355487` persisted DB run `60099` and updated
the existing Jira internal comment `23247770` in place. A direct Jira Service
Management API read returned the same comment ID with `public=false`.

## Unresolved gaps

None for this bounded related-evidence recall problem.

## Next validation action

Monitor later related-evidence runs for regressions where a generic summary
again displaces a more specific stable product-error signature.
