Skip to content

Commit c131053

Browse files
committed
fix(runs): mid-resume progress polling was missing on the canonical inspector
Convergence audit against PR opensearch-project#414 (checkpoint-resume): EvalRunDetailPage has always polled every 3s while status === 'running' so pass/fail counts and per-test-case statuses update live during/after a resume without a manual reload. RunInspectorPage had no equivalent — clicking Resume there updated nothing until resumeEvaluationRun()'s whole SSE stream settled, since the client call passes a no-op progress callback (true on both pages; opensearch-project#414 never wired up onStarted/onProgress). Adds the same running-poll to RunInspectorPage (evalRun mode only), but improves on the source pattern instead of copying its flaw: loadData() now takes a { silent } option that skips the full-page loading-skeleton flip, so a background refresh doesn't blow away the user's open test-case selection every 3s (EvalRunDetailPage's loadRun() does flip loading on every poll tick — harmless there since it has no left/right selection state to lose, but would have been disruptive on the two-pane inspector). The post-resume-click refreshes are silent too. Signed-off-by: Megha Goyal <goyamegh@amazon.com>
1 parent ce35115 commit c131053

1 file changed

Lines changed: 23 additions & 6 deletions

File tree

components/evals3/RunInspectorPage.tsx

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,13 @@ export const RunInspectorPage: React.FC = () => {
117117
const [promoting, setPromoting] = useState(false);
118118
const [actionError, setActionError] = useState<string | null>(null);
119119

120-
// Load data — fetch reports to get real pass/fail status
121-
const loadData = useCallback(async () => {
120+
// Load data — fetch reports to get real pass/fail status. `silent: true`
121+
// (used by the running-poll below) skips the loading-skeleton flip so a
122+
// background refresh doesn't blow away the user's open test-case selection
123+
// every 3s — only the very first load (and manual Retry) shows the skeleton.
124+
const loadData = useCallback(async (opts: { silent?: boolean } = {}) => {
122125
if (!runId) return;
123-
setLoading(true);
126+
if (!opts.silent) setLoading(true);
124127
setLoadError(false);
125128
try {
126129
let runData: BenchmarkRun | EvaluationRun;
@@ -251,6 +254,19 @@ export const RunInspectorPage: React.FC = () => {
251254

252255
useEffect(() => { loadData(); }, [loadData]);
253256

257+
// Mid-resume (and any other in-place 'running') progress: EvalRunDetailPage
258+
// has always polled every 3s while status === 'running' so pass/fail counts
259+
// and per-test-case statuses update live without a manual reload — the
260+
// inspector lacked this entirely (gap found auditing #414's checkpoint-
261+
// resume UI against the canonical page: clicking Resume here updated
262+
// nothing until the whole SSE stream finished, since resumeEvaluationRun()
263+
// is called with a no-op progress callback and there was no fallback poll).
264+
useEffect(() => {
265+
if (mode !== 'evalRun' || run?.status !== 'running') return;
266+
const interval = setInterval(() => loadData({ silent: true }), 3000);
267+
return () => clearInterval(interval);
268+
}, [mode, run?.status, loadData]);
269+
254270
// Resolve the source run name for the rerunOf provenance chip (EvaluationRun only).
255271
useEffect(() => {
256272
if (mode !== 'evalRun' || !(run as EvaluationRun)?.rerunOf) {
@@ -311,9 +327,10 @@ export const RunInspectorPage: React.FC = () => {
311327
setActionError(null);
312328
resumeEvaluationRun(runId, () => {})
313329
.catch((err: any) => setActionError(err.message))
314-
.finally(() => loadData());
315-
// Give the server a moment to flip status to running, then refresh.
316-
setTimeout(() => { loadData(); setResuming(false); }, 1000);
330+
.finally(() => loadData({ silent: true }));
331+
// Give the server a moment to flip status to running, then refresh
332+
// silently — the running-poll effect above takes over from here.
333+
setTimeout(() => { loadData({ silent: true }); setResuming(false); }, 1000);
317334
};
318335

319336
const handlePromote = async () => {

0 commit comments

Comments
 (0)