-
Notifications
You must be signed in to change notification settings - Fork 11
fix(runner): avoid infinite recursion in function cacher #1776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(runner): avoid infinite recursion in function cacher #1776
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an infinite recursion issue in the function caching mechanism by adding cycle detection to the recursive traversal of recipes and modules.
- Adds
seenparameter to track visited objects and prevent cycles - Updates all recursive function discovery methods to pass and check the
seenset - Prevents infinite loops when modules or recipes contain circular references
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 1 file
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="packages/runner/src/runner.ts">
<violation number="1" location="packages/runner/src/runner.ts:715">
Adding value to seen before delegating causes nested modules/recipes found in inputs to be skipped; module/recipe handlers return early due to seen.has(...). Guard only non-module/recipe objects here.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
- prevent the runner’s function cache walk from re-entering cells, shadow refs, and opaque refs - tighten opaque-ref typing so JSON conversion uses the shared OpaqueRefMethods surface - teach the recipe factory to pull cell names from export() so unnamed internal cells get stable, meaningful aliases - refresh recipe.test.ts expectations to cover the corrected alias naming and avoid the long-standing double naming bug
1063f55 to
d4b629c
Compare
Summary by cubic
Prevents infinite recursion in the runner’s function discovery by tracking visited nodes, so cyclic recipes/modules no longer cause hangs or stack overflows.