Skip to content

Commit a3c92ea

Browse files
fix(enrichments): don't re-run completed no-match enrichments on auto cascade
A completed enrichment with empty outputs is a real no-match result, not an unfinished run. Eligibility now treats an enrichment's completed status as terminal (regardless of output fill), so the auto cascade stops re-invoking billable provider calls on every no-match row each dispatch. Input changes still clear the exec entry, so genuine re-runs are unaffected; manual Run all still re-runs.
1 parent 4e7b751 commit a3c92ea

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

apps/sim/lib/table/workflow-columns.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,20 @@ export function classifyEligibility(
9090
if (mode === 'new' && exec && !isOrphanPreStamp) return 'has-prior-attempt'
9191

9292
const completedAndFilled = status === 'completed' && areOutputsFilled(group, row)
93-
if (!isManualRun && completedAndFilled) return 'completed-on-auto'
93+
// For an enrichment a `completed` run is terminal even with empty outputs —
94+
// a no-match is a real result, not an unfinished run. Treating it as "done"
95+
// stops the auto cascade from re-invoking billable provider calls on every
96+
// no-match row each dispatch. A genuine input change clears the exec entry
97+
// (see deriveExecClearsForDataPatch), so real re-runs still happen.
98+
const isDone = completedAndFilled || (group.type === 'enrichment' && status === 'completed')
99+
if (!isManualRun && isDone) return 'completed-on-auto'
94100
if (!isManualRun && status === 'error') return 'error-on-auto'
95101
if (!isManualRun && status === 'cancelled') return 'cancelled-on-auto'
96102
// Manual incomplete-mode runs (Run row / Run incomplete) treat a `completed`
97103
// group as done even if an output is blank — only "Run all" re-runs it. The
98-
// auto cascade still re-fills blank outputs (completedAndFilled).
104+
// auto cascade still re-fills blank workflow outputs (completedAndFilled).
99105
if (mode === 'incomplete') {
100-
if (isManualRun ? status === 'completed' : completedAndFilled) {
106+
if (isManualRun ? status === 'completed' : isDone) {
101107
return 'completed-on-incomplete'
102108
}
103109
}

0 commit comments

Comments
 (0)