Skip to content

Bound and scope the run checks of the cache - #4144

Closed
yohamta0 wants to merge 1 commit into
mainfrom
fix/reuse-run-checks
Closed

yohamta0 wants to merge 1 commit into
mainfrom
fix/reuse-run-checks

Conversation

@yohamta0

@yohamta0 yohamta0 commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Summary

The step dialog asks the server whether the runs that cached outputs name still exist. Three bugs: each pass could send five more requests while earlier ones waited; an answer that arrived after a switch to another workflow or remote node was read in the new one; and a 200 answer with no run left the check waiting forever, so the dialog never offered Step only.

Split out of #4136 (whose first version carried these fixes), carved from #3829 and #3833 (SCcagg5), part of #4002.

Changes

  • At most five run checks wait for an answer at one time (before: five new requests per pass, with no cap on those in flight).
  • Answers belong to one workflow on one remote node; a late answer of another is dropped (before: it was read in the new scope).
  • A 200 answer with no dagRunDetails counts as unknown and leaves the decision to the server (before: the check stayed pending and was never asked again).

Core change

The record of requested runs carries its scope, and the effect counts the requests still waiting before sending more. An answer is written only while its scope is current.

// ui/src/features/workflow-workspace/step/useReuseSource.ts:285
useEffect(() => {
  if (requested.current.scopeKey !== scopeKey) {
    requested.current = { scopeKey, ids: new Set() };
  }
  if (history.isLoading) return;
  const sent = requested.current.ids;
  // At most `MAX_RUN_CHECKS` requests wait for an answer at one time.
  const inFlight = [...sent].filter((id) => asked[id] === undefined).length;
  const toSend = runIds
    .filter((id) => !sent.has(id) && runOfId(id) === undefined)
    .slice(0, Math.max(0, MAX_RUN_CHECKS - inFlight));
  const answer = (id: string, value: RunAnswer) => {
    if (requested.current.scopeKey !== scopeKey) return;
    setAnswers((held) => ({ scopeKey, runs: { ...(held.scopeKey === scopeKey ? held.runs : NO_ANSWERS), [id]: value } }));
  };
  ...
        answer(id, data?.dagRunDetails ? data.dagRunDetails : response.status === 404 ? 'gone' : 'unknown');

Testing

Performance

No new request, poll or timer. Run checks stay one per distinct run that the cache entries name, per dialog, now capped at five in flight instead of five per pass, so a burst of answers no longer fans out more requests. A scope switch drops the old record.


Summary by cubic

Fixes three bugs in the step dialog's run checks for cached outputs: requests could pile up without a cap, late answers from a previous workflow or remote node were read in the new scope, and a 200 answer with no run left the check waiting forever.

  • Caps run checks at five requests in flight; before, each pass could send five more while earlier ones waited.
  • Drops answers that arrive after the dialog moves to another workflow or remote node.
  • Treats a 200 answer with no run as unknown, leaving the decision to the server.

Written for commit 94612e5. Summary will update on new commits.

View guided diff Turn on auto-fix

The step dialog asks the server whether the runs that cached outputs
name still exist. Each pass could send five more requests while the
earlier ones still waited, an answer that came after a switch to
another workflow or remote node was read in the new one, and a 200
answer with no run left the check waiting forever. Now at most five
requests wait at one time, answers of another workflow or node are
dropped, and a 200 answer with no run counts as unknown, which leaves
the decision to the server.

Co-authored-by: SCcagg5 <sccagg5@gmail.com>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@yohamta0

Copy link
Copy Markdown
Member Author

Folded back into #4136.

@yohamta0 yohamta0 closed this Nov 24, 2026
@yohamta0
yohamta0 deleted the fix/reuse-run-checks branch November 24, 2026 15:44
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