Skip to content

Recover the parent of a frame in a recursive cycle - #473

Merged
timholy merged 1 commit into
masterfrom
teh/fix456
Sep 1, 2026
Merged

timholy merged 1 commit into
masterfrom
teh/fix456

Conversation

@timholy

@timholy timholy commented Sep 1, 2026

Copy link
Copy Markdown
Member

When inference resolves a cycle of mutually-recursive calls, the call that closes the cycle is absent from the caller's CodeInstance edges and is recorded only in the callee's MethodInstance backedges. A frame reachable only through that call therefore looked like an entrance to inference and became a direct child of ROOT, where its missing backtrace made inference_triggers throw.

Consult the MethodInstance backedges for any frame that has neither a caller nor a backtrace, and follow the recovered link when building the tree. Resolving the top of a chain of callers now tolerates cycles, which the recovered links can introduce.

Fixes #456

Assisted-by: Claude Opus 5 noreply@anthropic.com

When inference resolves a cycle of mutually-recursive calls, the call that
closes the cycle is absent from the caller's `CodeInstance` edges and is
recorded only in the callee's `MethodInstance` backedges. A frame reachable
only through that call therefore looked like an entrance to inference and
became a direct child of `ROOT`, where its missing backtrace made
`inference_triggers` throw.

Consult the `MethodInstance` backedges for any frame that has neither a caller
nor a backtrace, and follow the recovered link when building the tree.
Resolving the top of a chain of callers now tolerates cycles, which the
recovered links can introduce.

Fixes #456

Assisted-by: Claude Opus 5 <noreply@anthropic.com>
@timholy
timholy merged commit 0783950 into master Sep 1, 2026
12 of 15 checks passed
@timholy
timholy deleted the teh/fix456 branch September 1, 2026 12:10
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.

inference_triggers says root is child node

1 participant