Skip to content

fix(api-turns): claim idle local empty wakes - #1614

Open
sentry-junior[bot] wants to merge 3 commits into
mainfrom
fix/api-turn-stale-empty-wake
Open

fix(api-turns): claim idle local empty wakes#1614
sentry-junior[bot] wants to merge 3 commits into
mainfrom
fix/api-turn-stale-empty-wake

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

What failed

Empty queue wakes for local web conversations threw Slack paused-turn recovery requires a Slack destination and exhausted retries.

Evidence

Root cause

PR #1559 taught the API router to claim empty wakes only when an active paused/running API Turn exists. That fixed yield resume, but terminal or stale local wakes still fell through to the Slack empty path. That path assumed every empty wake was Slack paused-turn recovery.

Fix

  1. The API router claims idle local web empty wakes as { kind: "idle" } and completes them without running the agent.
  2. The Slack worker completes empty wakes whose Destination is not Slack. This prevents a routing mistake from throwing.

A local Destination can be reused on another conversation id for agent-invocation work. The idle claim applies only when destination.conversationId matches the leased conversation id. Other wakes stay on the invocation router.

Verification

  • pnpm --filter @sentry/junior exec vitest run tests/integration/api-turn-work.test.ts (8 passed)
  • pnpm --filter @sentry/junior exec tsc -p tsconfig.json --noEmit

Risk

Medium. This changes empty-wake ownership for local web conversations and adds a defensive Slack no-op. Dispatch and agent-invocation empty resumes are unchanged.

Requested by David Cramer.

--

View Junior Session [Sentry]

Empty queue wakes for local web conversations fell through to Slack
paused-turn recovery when no active API Turn remained. Claim those
idle wakes in the API router and no-op non-Slack empty wakes in the
Slack worker.

Evidence: https://sentry.sentry.io/issues/7681223963/events/8131a138340e4c869f40013c43df0bd1/
Co-Authored-By: David Cramer <david@sentry.io>
@vercel

vercel Bot commented Aug 19, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview Aug 19, 2026 9:56pm

Request Review

Rewrite the regression as a production createConversationWork path:
finish a local web turn, request an empty wake, and process it through
the full router. Drop the lower-fidelity component duplicate.

Co-Authored-By: David Cramer <david@sentry.io>
@dcramer
dcramer marked this pull request as ready for review August 19, 2026 21:06
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Aug 19, 2026
*
* Empty resume wakes after yield carry no mailbox rows. Use durable active
* Turn state so these wakes do not fall through to Slack.
* Agent-invocation children may inherit a parent local Destination while using

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hell does this mean

Children?

Rewrite the isIdleLocalApiTurnWake JSDoc without parent/child jargon.
sentry-junior Bot added a commit that referenced this pull request Aug 19, 2026
Review-thread resolve compared GraphQL author.login to the noreply
bot login. GitHub GraphQL Bot.login omits [bot], so every Junior-
authored PR failed the ownership gate.

Use the bot user id already encoded in GITHUB_APP_BOT_EMAIL and
compare it to author.databaseId from the GraphQL payload.

Evidence: #jr-cramer on #1614; JUNIOR-89
Co-Authored-By: David Cramer <david@sentry.io>
sentry-junior Bot added a commit that referenced this pull request Aug 19, 2026
Review-thread resolve compared GraphQL author.login to the noreply
bot login. GitHub GraphQL Bot.login omits [bot], so every Junior-
authored PR failed the ownership gate.

Use the bot user id already encoded in GITHUB_APP_BOT_EMAIL and
compare it to author.databaseId from the GraphQL payload.

Evidence: #jr-cramer on #1614; JUNIOR-89
Co-Authored-By: David Cramer <david@sentry.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant