# Continuation Poll Backlog Starvation

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "continuation-poll-backlog-starvation-2026-07-23",
  "problems": [
    {
      "problemId": "recent-continuation-hidden-behind-stale-ascending-batch",
      "summary": "A valid recent internal ADF bot mention is not discovered when the ascending continuation cursor lane is saturated by older updated issues.",
      "status": "optimized_verified",
      "issueKeys": ["APID-29159"],
      "sourceRefs": ["https://tidb.atlassian.net/browse/APID-29159#problem:continuation:poll-backlog-starvation"],
      "signalTextIncludesAny": ["issueCount=20", "eligibleCommentCount=0", "continuation cursor did not advance"],
      "observedThrough": "2026-07-23",
      "effectiveAt": "2026-07-23T08:16:08Z",
      "verifiedAt": "2026-07-23T08:19:57Z",
      "attemptedAction": "Add a bounded newest-first continuation discovery lane with per-process update deduplication while preserving the existing oldest-first cursor lane for backlog catch-up.",
      "evidenceUrl": "https://tidb.atlassian.net/rest/servicedeskapi/request/7891926/comment/23273174"
    }
  ]
}
-->

- Optimization ID: `continuation-poll-backlog-starvation-2026-07-23`
- Owner: auto-oncall-services
- Source reference: `APID-29159`, internal mention comment `23263450`
- Bounded problem: the continuation cursor was stuck at
  `2026-07-20T14:48:51.983Z`. Its five-minute overlap contained more than the
  20-issue batch limit, so each oldest-first poll repeatedly scanned the same
  stale issues and never reached the recent explicit mention.
- Implementation status: merged and deployed to staging.
- Effective status: `optimized_verified`.

## Verification evidence

- Live staging repeatedly logged `issueCount=20`, `eligibleCommentCount=0`
  with the same `searchedFrom=2026-07-20T14:43:51.983Z`.
- The DB cursor remained at `2026-07-20T14:48:51.983Z`.
- A live newest-first Jira search found `APID-29159` among the 100 most
  recently updated continuation candidates.
- Contract coverage proves that the recent lane enqueues the exact mention even
  when the oldest-first lane returns only a stale issue; unchanged recent
  candidates are not fetched again on the next poll.
- Full repository regression passed on 2026-07-23: 414 tests, 0 failures.
- `tidbcloud/aisupport#478` merged as
  `c5daf000fece745405f059dc6e6bf1d638723e5c`; app-delivery PR `#75264`
  deployed the image, whose ReplicaSet was created at
  `2026-07-23T08:16:08Z` and reached 1/1 Ready.
- The first live continuation poll processed 88 distinct candidates and logged
  `eligibleCommentCount=1`, `enqueuedCount=1`. The canonical job was `60187`
  with source comment `23263450`.
- Run `60104` (`8f41e00c-f62a-4143-89a7-a15d7f63efb7`) succeeded without
  retry and wrote internal Jira comment `23273174`. Jira readback confirmed
  `public=false` and the current bot account as author.

## Unresolved gaps

- The historical ascending backlog remains a separate catch-up concern; this
  change keeps new explicit human invocations responsive without discarding it.

## Next validation action

Monitor the historical ascending cursor independently. A future backlog cleanup
must preserve the newest-first lane and exact source-comment idempotency.
