Skip to content

Fix Re-run All: queued items stuck in loading state forever#44

Open
Copilot wants to merge 2 commits intomainfrom
copilot/fix-issue-42
Open

Fix Re-run All: queued items stuck in loading state forever#44
Copilot wants to merge 2 commits intomainfrom
copilot/fix-issue-42

Conversation

Copy link
Contributor

Copilot AI commented Feb 26, 2026

When "Re-run All" is clicked, items that don't complete within the server's 10s timeout receive a 202 and are silently discarded — leaving those panel rows in loading state indefinitely. Additionally, when a forceRefresh re-run is issued against an already in-flight item, the chained promise is not stored, causing any coalescing poll to receive the stale result.

Changes

lib/eval-queue.ts — store the forceRefresh chain promise

When forceRefresh=true chains after an existing in-flight promise, the resulting chain was not written back to state.promises. A subsequent coalescing call would therefore resolve to the old stale promise instead of waiting for the fresh re-run:

// Before
const chained = existing.catch(() => {}).then(() => queuePerItem(...));
return chained; // state.promises[key] still points to the old promise

// After
state.promises.set(key, chained); // coalescing callers now wait for the fresh result
return chained;

app/actions/queue-session-eval.ts & queue-session-enrichment.ts — poll after 202

Instead of immediately surfacing __queued__ to the panel (which treated it as a no-op), these helpers now poll /api/queue-item with forceRefresh: false — coalescing onto the in-flight queue promise — until the result is available or a ~10-minute ceiling is hit:

if (res.status === 202) {
  for (let attempt = 0; attempt < MAX_POLL_ATTEMPTS; attempt++) {
    await new Promise<void>(r => setTimeout(r, POLL_INTERVAL_MS));
    const pollRes = await fetch("/api/queue-item", { ..., forceRefresh: false });
    if (pollRes.status === 202) continue;
    return pollRes.json(); // result is ready
  }
  return { ok: false, error: "__queued__" }; // final fallback after max retries
}

The panel components require no changes — they already handle results correctly once they arrive.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation

Checklist

  • npm run lint passes
  • npx tsc --noEmit passes
  • npm run test:run passes
  • npm run build succeeds

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh gh issue view 42 (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…n promise

Co-authored-by: NiveditJain <40313233+NiveditJain@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue #42 Fix Re-run All: queued items stuck in loading state forever Feb 26, 2026
@NiveditJain NiveditJain marked this pull request as ready for review February 26, 2026 12:43
@NiveditJain
Copy link
Member

@claude review

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.

2 participants