# Jira Request Context Gate

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "jira-request-context-gate-2026-08-27",
  "problems": [
    {
      "problemId": "missing-jsm-request-context-reported-as-analysis-failure",
      "summary": "A Jira issue that is readable through the Platform API but unavailable through the required JSM request-comment API was reported as an Auto-oncall analysis execution failure instead of a bounded unsupported-input Gate skip.",
      "status": "optimized_unverified",
      "applicability": "Initial, bot-assignment, or continuation jobs whose JSM request-comment fetch returns HTTP 404 with the exact sd.customerview.error.vpOriginMissing i18n key.",
      "issueKeys": [
        "APID-29409"
      ],
      "sourceRefs": [
        "https://tidb.atlassian.net/browse/APID-29409#problem:missing-jsm-request-context-reported-as-analysis-failure"
      ],
      "signalTextIncludesAny": [
        "sd.customerview.error.vpOriginMissing",
        "jira_request_context_unsupported",
        "Jira internal comment fetch failed: HTTP 404"
      ],
      "observedThrough": "2026-08-27",
      "effectiveAt": "2026-08-27T10:11:47+08:00",
      "verifiedAt": null,
      "attemptedAction": "Type only the exact vpOriginMissing JSM response as an unsupported Jira request context, persist a Jira Context Gate skip before classification or analysis, and keep every other channel, Request Type shape, HTTP error, and transport failure on its existing path.",
      "evidenceUrl": "https://github.com/tidbcloud/aisupport/pull/1115"
    }
  ]
}
-->

- Optimization ID: `jira-request-context-gate-2026-08-27`
- Owner: Jira context materialization and worker Gate orchestration
- Source: APID-29409 Job 150756
- Implementation status: merged and deployed to staging
- Effective status: `optimized_unverified`

## Bounded problem

APID-29409 was readable through Jira Platform issue and comment APIs, but the
JSM request and request-comment APIs returned HTTP 404 with
`sd.customerview.error.vpOriginMissing`. The worker exhausted the job as an
analysis execution failure before Scenario classification or Codex execution.

This record owns only the classification of that exact JSM capability boundary.
It does not declare every non-Portal ticket unsupported and does not infer the
boundary from project, issue type, request channel, or an empty Request Type.

## Candidate change

- Type the exact `vpOriginMissing` response at the Jira request-comment client.
- Record `jira_context_gate=skipped` with
  `jira_request_context_unsupported` before Scenario classification.
- Render the result as an ordinary `不支持的 Jira Request` Gate skip, without an
  analysis-failure alert or model execution.
- Preserve existing handling for every other 4xx, 5xx, network, and unknown
  error.

## Verification evidence

Two read-only staging samples were taken with the live Auto-oncall Jira
identity. Among 50 recent APID tickets, all 15 Portal-channel tickets and all
34 API-channel tickets had readable JSM comments; only APID-29409 had an empty
Request Type and returned the exact `vpOriginMissing` response. A second
90-day cross-project sample found four empty-Request-Type tickets
(APID-29409, APID-29120, APID-29071, and TCID-12907); all four returned the
same exact response. These samples reject channel-based gating and support the
exact API-response boundary.

Local contract tests cover the exact typed error, a different JSM 404, the
worker skip before classification and analysis, an empty Request Type whose
JSM comments remain readable, and ordinary notification wording.

The source change was merged in
[tidbcloud/aisupport#1115](https://github.com/tidbcloud/aisupport/pull/1115).
The staging app-delivery updates were merged in
[tidbcloud/app-delivery#78494](https://github.com/tidbcloud/app-delivery/pull/78494)
and
[tidbcloud/app-delivery#78495](https://github.com/tidbcloud/app-delivery/pull/78495).
At `2026-08-27T10:11:47+08:00`, the active Agent9 Pod was Ready with zero
restarts on build SHA `8b2c5145c245b390942f3d19ad233b89b860e2f5` and both
`/healthz` and `/readyz` returned HTTP 200. A read-only call from that exact Pod
to APID-29409 returned HTTP 404 and the deployed Jira client classified it as
`jira_request_context_unsupported` with the exact-error predicate true.

## Unresolved gaps

- APID-29409 is already terminal under the historical Job 150756; deployment
  did not rewrite that Job, and no organically created post-deployment Job has
  yet exercised the persisted worker Gate and notification path.

## Next validation action

Observe the next organically created Job that receives the exact
`vpOriginMissing` response and confirm its persisted `jira_context_gate` skip,
worker log, and ordinary Feishu notification without a Jira comment or
classifier execution. Promote this problem to `optimized_verified` only after
that evidence exists.
