Skip to content

fix(sdk): return the result from pollUntilHasData and pollUntilOk retries - #1150

Open
pucedoteth wants to merge 1 commit into
relayprotocol:mainfrom
pucedoteth:fix-poll-api-return-result
Open

pucedoteth wants to merge 1 commit into
relayprotocol:mainfrom
pucedoteth:fix-poll-api-return-result

Conversation

@pucedoteth

Copy link
Copy Markdown

Motivation

pollUntilHasData and pollUntilOk are exported from @relayprotocol/relay-sdk, but they only return their result when it arrives on the first attempt. When a later attempt succeeds, the caller gets undefined:

// The first poll has no data and the second does
const json = await pollUntilHasData(request, (json) => json.requests.length > 0)
// json is undefined, not the response

const ok = await pollUntilOk(request) // the first response is 202, the second 200
// ok is undefined, not true

Each function awaits its recursive call but never returns it, so the value from the attempt that succeeded is dropped.

Modifications

  • packages/sdk/src/utils/pollApi.ts: return the recursive call in both functions, so the data (or true) from the successful attempt reaches the caller.
  • packages/sdk/src/utils/pollApi.test.ts: new tests where the first response fails the check and the second passes. On main they get undefined, and with this change they get the data and true.
  • Changeset: @relayprotocol/relay-sdk patch.

Checklist

  • Format your code according to the Contributor Guide.
  • Add unit tests as outlined in the Contributor Guide.
  • Update documentation as needed, including docstrings or example tutorials.

Validation: in packages/sdk, vitest run passes 99 tests in 12 files, and tsc --noEmit and Prettier are clean.

🤖 Generated with Claude Code

…ries

Both helpers awaited their recursive call without returning it, so a result
that arrived after the first attempt resolved to undefined.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@pucedoteth is attempting to deploy a commit to the Uneven Labs Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Fixes return values in polling retry logic.

The PR appears safe to merge; no actionable issue was identified in the changed code.

Summary

The PR returns successful results through recursive retries in both exported SDK polling helpers and adds regression tests for success on a later attempt.

  • Adds a patch changeset for the SDK.

Reviews (1) · Last reviewed commit: "fix(sdk): return the result from pollUnt..."

This branch has not been deployed

No deployments
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.

1 participant