Skip to content

POR-22617: Retry client list pagination when Copilot cursor is invalid - #1406

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/por-22617-cursor-automated-triage-response-a4cb
Draft

POR-22617: Retry client list pagination when Copilot cursor is invalid#1406
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/por-22617-cursor-automated-triage-response-a4cb

Conversation

@cursor

@cursor cursor Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Changes

  • Retry CopilotAPI#getClients when the Assembly/Copilot API returns a DynamoDB ValidationException for an invalid pagination cursor (starting key is invalid).
  • For single-page requests, drop a stale caller-provided nextToken and retry once.
  • For batched requests (>5000 clients), restart pagination from the first page when a later-page cursor fails.
  • Add unit tests for both retry paths.

Testing Criteria

  • yarn test src/utils/copilotError.test.ts src/utils/CopilotAPI.getClients.test.ts — all 4 tests pass.
  • Verified retry behavior for stale caller nextToken and invalid mid-pagination cursor.

Notes

Impact & Surface Area of Change

  • CopilotAPI#getClients only — used by assignee loading (/api/users), activity logs, subtasks, notifications, and backfill scripts.
  • Expected effect: transient pagination cursor failures recover automatically instead of surfacing as Sentry errors / failed assignee loads.
Open in Web View Automation 

priosshrsth and others added 2 commits August 7, 2026 10:33
…1397)

deleteLabel passed `id: currentLabel?.id` straight into label.delete, so when
findFirst matched nothing Prisma got `{ id: undefined }` and threw
PrismaClientValidationError, failing the whole delete transaction. Return early
instead.
When fetching large client lists (>5000), CopilotAPI paginates via nextToken.
DynamoDB can reject a stale or invalidated cursor with ValidationException
(starting key is invalid), which surfaces in Tasks Sentry during assignee load.

Retry once without the stale token for single-page requests, and restart
batched pagination from the first page when a later-page cursor fails.

Co-authored-by: Neil Raina <makeitraina@users.noreply.github.com>
@linear-code

linear-code Bot commented Aug 21, 2026

Copy link
Copy Markdown

POR-22617

@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tasks-app Ready Ready Preview Aug 21, 2026 2:13pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants