# Explicit Related-Ticket Context

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "explicit-related-ticket-context-2026-08-13",
  "problems": [
    {
      "problemId": "explicit-related-ticket-context-dropped-before-analysis",
      "summary": "Jira inline-card ticket references are removed during ADF text conversion, and same-reporter metadata recall cannot answer cross-reporter same-customer questions about related-ticket status, recovery, or intervention.",
      "status": "ineffective",
      "applicability": "Support tickets where the bounded customer input explicitly references another ST, TCID, APID, NAID, or EMID ticket and asks about its status, combined investigation, progress, recovery, or intervention history.",
      "issueKeys": ["TCID-13031", "TCID-13006", "TCID-13019"],
      "sourceRefs": [
        "https://tidb.atlassian.net/browse/TCID-13031#problem:explicit-related-ticket-context-dropped-before-analysis"
      ],
      "signalTextIncludesAny": [
        "linked ticket was not mentioned",
        "related ticket status was not consolidated",
        "asked customer for evidence already present in referenced tickets",
        "whether recovery was natural or caused by our operation"
      ],
      "observedThrough": "2026-08-13",
      "effectiveAt": null,
      "verifiedAt": null,
      "attemptedAction": "Preserved allowlisted Jira support keys from ADF inline cards and link marks, resolved exact references outside same-reporter ranking after a same-JSM-organization check, and materialized cutoff-bounded status, link, and comment history. The initial implementation only added workspace prompt instructions and did not transfer related-evidence.json into the tool-free Scenario Router context.",
      "evidenceUrl": "https://github.com/tidbcloud/aisupport/pull/878"
    },
    {
      "problemId": "explicit-related-ticket-context-not-transferred-to-router",
      "summary": "The diagnostic multi-turn Scenario Router does not receive materialized related-ticket evidence in its frozen context, so it cannot answer the customer's explicit linked-ticket question even though related-evidence.json is complete.",
      "status": "optimized_verified",
      "applicability": "Diagnostic multi-turn support tickets with matched explicitJiraReferences and a customer question about related-ticket status, combined investigation, progress, recovery, or intervention history.",
      "issueKeys": ["TCID-13031", "TCID-13006", "TCID-13019"],
      "sourceRefs": [
        "https://tidb.atlassian.net/browse/TCID-13031#problem:explicit-related-ticket-context-not-transferred-to-router"
      ],
      "signalTextIncludesAny": [
        "explicitJiraReferences matched but final answer omitted linked tickets",
        "related-evidence.json was not in DiagnosticFrozenContext",
        "Scenario Router answered unrelated diagnostics before linked-ticket status"
      ],
      "observedThrough": "2026-08-13",
      "effectiveAt": "2026-08-13T17:13:20+08:00",
      "verifiedAt": "2026-08-13T17:34:49+08:00",
      "attemptedAction": "Load related-evidence.json into DiagnosticFrozenContext for both Scenario Router phases and add reconciliation rules that prioritize exact related-ticket status, shared investigation, recovery, and intervention questions without exposing private Jira details.",
      "evidenceUrl": "https://tidb.atlassian.net/browse/TCID-13031?focusedCommentId=23511258"
    }
  ]
}
-->

- Optimization ID: `explicit-related-ticket-context-2026-08-13`
- Owner: auto-oncall Jira context materialization and Scenario Router input
- Source reference: TCID-13031 first-answer review
- Implementation status: follow-up repair deployed to staging
- Effective status: extraction action `ineffective`; Router handoff repair `optimized_verified`

## Bounded problem

TCID-13031 supplied TCID-13006 and TCID-13019 as Jira inline cards before the
first Auto-oncall answer and asked for their consolidated status and whether
the earlier recovery was natural or followed a PingCAP operation. ADF text
conversion removed both card URLs. The remaining fuzzy Jira lookup used the
current reporter and metadata only, so it could neither find the two
cross-reporter tickets nor read their progress timelines.

## Intended change

Preserve exact customer support-ticket keys from bounded ADF, authorize an
exact lookup only when the current and referenced tickets share a JSM
organization, and materialize status, link events, and comments through the
run cutoff. Keep fuzzy same-reporter recall separate. The Scenario Router must
answer the explicit related-ticket question from those facts before requesting
unrelated diagnostic detail and must distinguish no documented intervention
from proof of natural recovery.

## Verification status

The first implementation passed local typecheck and all 796 repository tests. Focused coverage verifies
ADF inline-card and link-mark extraction, same-organization cross-reporter
lookup, cross-organization rejection before timeline reads, exclusion of
support/internal references from customer-supplied exact keys, cutoff-time
status and link reconstruction, and rejection of future or post-cutoff-edited
comments.

PR `tidbcloud/aisupport#878` and app-delivery PR `#77234` deployed the first
implementation to staging. A TCID-13031 replay at cutoff
`2026-08-10T23:16:01+08:00` materialized both exact references correctly:
TCID-13006 and TCID-13019 were both `ESCALATE`, and the latter timeline stated
that the two incidents were linked and investigated together. The final answer
still omitted both tickets because `related-evidence.json` was not part of the
tool-free Scenario Router's frozen context. That attempt is `ineffective`; the
bounded follow-up is the Router handoff repair above.

PR `tidbcloud/aisupport#880` was deployed through app-delivery PR `#77236` at
`2026-08-13T17:13:20+08:00`. The live Pod used image
`d106ac187be9357a07c4e1deae737345e084dadb`, passed health/readiness, and had no
restart. A read-only TCID-13031 replay (`51e1c7e7-979d-4bb6-ac66-cb9f2d1b4442`)
then answered both referenced tickets, their combined investigation, their
separate escalation tracks, and the bounded intervention history. Jira refresh
and readback are still pending, so the Router handoff repair remains
`optimized_unverified` at this checkpoint.

The authorized `mode=write` replay
`afbf4b97-7bf8-4234-b07e-daa4d2319e6e` then persisted DB run `150029`, updated
the existing stable Jira internal comment `23511258`, wrote its evaluation, and
updated the Feishu dashboard with no publication errors. Independent Jira
readback verified that the same comment is `public=false`, contains both paired
message sections, names TCID-13006 and TCID-13019, preserves the combined
investigation, and does not turn the absent intervention record into proof of
natural recovery. The Router handoff repair is therefore `optimized_verified`.

## Unresolved gaps

- The first extraction-only action remains `ineffective` history and must not be repeated without the Router handoff.

## Next validation action

Preserve the exact-reference handoff and audience boundary in future Router
changes; treat any later matching failure as a regression.
