Skip to content

Conversation

@seefeldb
Copy link
Contributor

@seefeldb seefeldb commented Sep 15, 2025

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.

  • Bug Fixes
    • Added a shared seen Set across discovery methods to short-circuit revisits of recipes, modules, and values.
    • Propagated seen through nested recipes, module references, and input traversal.
    • Handles circular graphs without altering behavior for acyclic cases.

@seefeldb seefeldb requested a review from Copilot September 15, 2025 20:41
Copy link
Contributor

Copilot AI left a 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 seen parameter to track visited objects and prevent cycles
  • Updates all recursive function discovery methods to pass and check the seen set
  • 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.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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
@seefeldb seefeldb merged commit 24afb73 into main Sep 16, 2025
7 checks passed
@seefeldb seefeldb deleted the fix/avoid-infinite-recursion-in-function-cacher branch September 16, 2025 17:45
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