Skip to content

FIX: bound scenario progress paging when the cursor does not advance - #3223

Merged
Roman Lutz (romanlutz) merged 5 commits into
microsoft:mainfrom
ManoharPaturi:fix/progress-cursor-loop
Oct 16, 2026
Merged

Roman Lutz (romanlutz) merged 5 commits into
microsoft:mainfrom
ManoharPaturi:fix/progress-cursor-loop

Conversation

@ManoharPaturi

Copy link
Copy Markdown
Contributor

Description

Fixes #3222

useScenarioRunProgress paged results with a recursive fetch that had no guard against a cursor that does not advance. When the backend answered has_more while next_cursor was missing or equal to the cursor just sent, the hook refetched the identical page forever, a tight request loop that never let the UI recover.

The hook now tracks the cursors already seen within a fetch cycle, caps the page count, and when the cursor does not advance it stops paging and falls through to the regular poll re arm, so a stuck cursor costs one request per interval. This mirrors the guard fetchAllPages already documents and uses for the same failure mode. An advancing cursor still pages through normally.

Tests and Documentation

Added useScenarioRunProgress.test.tsx with two tests: a stuck cursor yields exactly one request per poll interval (on main the same scenario crashes the jest process with a JavaScript heap out of memory, which is the loop demonstrating itself), and an advancing cursor is followed across pages. ScenarioRunPage and scenarioRunProgress suites still pass (70 tests) and tsc --noEmit is clean.

No documentation change needed, so I did not run JupyText.

The progress hook refetched the same page forever when the backend
answered has_more without an advancing next_cursor. Track the cursors
seen in a cycle, cap the page count, and fall through to the regular
poll re arm so a stuck cursor costs one request per interval instead of
an endless loop, mirroring the guard fetchAllPages already uses.

Fixes microsoft#3222

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
Comment thread frontend/src/hooks/useScenarioRunProgress.test.tsx
Comment thread frontend/src/hooks/useScenarioRunProgress.tsx Outdated
…dget

Restore the original useScenarioRunProgress tests that the new file had
replaced, keeping the new cursor cases alongside them. When the page
budget runs out while pages remain, schedule another bounded cycle from
the saved cursor instead of falling through to the terminal check, so
the tail of a long finished run still loads. Each cycle gets a fresh
seen cursor set so continuation is not blocked by the previous cycle.

Follow-up to the review on microsoft#3223.

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
Comment thread frontend/src/hooks/useScenarioRunProgress.tsx
The missing or repeated cursor branch fell through to the terminal
check, which stopped polling a finished run forever even though more
pages remained. Schedule the next bounded poll from that branch too, so
a finished run only stops after a page without has_more, and a cursor
that recovers on a later response resumes draining in the same cycle.

Follow-up to the review on microsoft#3223.

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 340b434f-94b7-4ea0-ac05-d57af330160d
@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Oct 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 16, 2026
@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Oct 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 16, 2026
@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Oct 16, 2026
Merged via the queue into microsoft:main with commit 529b738 Oct 16, 2026
94 of 95 checks passed
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.

Scenario run progress hook loops forever on a cursor that does not advance

2 participants