Repository navigation
fix(executor): a loop whose condition cannot be evaluated fails instead of ending early as success - #10282
Conversation
…ad of ending early as success For, ForEach, and count-driven Do While loops decide continuation from their count instead of evaluating '<loop.index> < N' in the isolated VM, so a sandbox failure can no longer truncate them. A While or Do While condition that fails to evaluate (syntax or runtime error, unresolvable reference, sandbox failure) now fails the loop with a loop error log and a secret-projected message instead of being read as false. Author errors are attributed to the user; sandbox failures stay internal.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The PR appears safe to merge; no actionable issues remain in the reviewed changes. SummaryLoops now fail when their conditions cannot be evaluated, rather than returning incomplete results as success.
Reviews (3) · Last reviewed commit: "fix(executor): mark a loop condition fai..." · Reviewed by Greptile |
…t helpers Extract projectLoopErrorMessage for the ForEach-resolution and condition-evaluation failure paths, drop the count check that the native continuation now covers, and move loopWorkflow/runLoopWorkflow into a shared test helper.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
…s not log it again
|
@cubic-dev-ai review |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Bug.
LoopOrchestrator.evaluateWhileConditionreturnedfalsewhenever the isolated VM failed to evaluate a loop condition, whether the VM answered with an error or the call threw. The loop exited with the iterations it had so far and emitted subflow success. For, ForEach and count-driven Do While loops also evaluated<loop.index> < Nin the VM. That meant any sandbox failure could cut any loop short: capacity, owner lease limit, queue timeout, worker crash, or a missingREDIS_URLmakinggetRedisClient()throw.Impact. The run silently returned wrong results. A ForEach over N items could return 1 result and a While loop 0, and the run still reported success. Downstream blocks treated the truncated array as complete. A typo in a While condition looked like "the condition was false".
Fix.
nextIteration < maxIterations), with no VM call.<loop.index>already resolved toscope.iteration, so successful runs behave the same. The synthesized condition and its now-dead helpers are removed."<While|Do While> loop condition could not be evaluated: …"message, projected throughprojectResolvedSecretDiagnosticError;validationError;isSystemError, unresolvable references) are markeduser. Sandbox failures stayinternal.getRedisClient()stays outside the leasetry. Moving it inside would quietly tolerate a missingREDIS_URL, against chore(redis): require Redis and remove the no-Redis fallbacks #10272. With this fix, a rejection already fails the loop loudly.Tests (
executor/orchestrators/loop.test.ts):DAGExecutorruns:@sim/testingisolated-vm mock (from fix(executor): keep the condition-join loop test off the Redis-backed isolate lease #10275) now rejects every call by default instead of evaluating<index> < <count>.evaluateLoopIndexCheckis removed. Any test whose counted loop reached the sandbox would now fail.