feat: Replace sync normalized-data with async flow (API-432)#49
Conversation
Showcase the recommended integration pattern for generate-normalized-data-async with a shared pollUntilSucceeded helper. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7d43ecc. Configure here.
| throw new Error(`Did not get results within ${timeoutMs}ms. Aborting polling.`); | ||
| } | ||
|
|
||
| const job = await fetchJob(); |
There was a problem hiding this comment.
Timeout check before fetch discards completed results
Medium Severity
The deadline check on line 23 runs after sleep but before fetchJob, so when the timeout expires, the function throws without making one final status check. If the async job completed during the last sleep interval, pollUntilSucceeded reports a spurious timeout instead of returning the successful result. Moving the deadline check after the fetchJob call (or after the status checks) would avoid discarding a ready result.
Reviewed by Cursor Bugbot for commit 7d43ecc. Configure here.


Showcase the recommended integration pattern for generate-normalized-data-async with a shared pollUntilSucceeded helper: poll after 10 seconds, stop after 5 minutes