fix: handle inspector intercept in additional limit frame tracking #121
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
When an inspector's
callorcreatehook returns early (returnsSome(outcome)),frame_initis skipped butframe_return_resultis still called. This caused frame stack misalignment in the additional limit trackers, leading to a panic with "frame stack is empty".Fix: Override
inspect_frame_initinMegaEvmto callon_inspector_intercept()when the inspector intercepts a call/create. This pushes an empty frame to all trackers, keeping the stacks aligned soframe_return_resultcan pop normally.Changes
on_inspector_intercept()method toAdditionalLimit,DataSizeTracker,KVUpdateCounter, andStateGrowthTrackerinspect_frame_initinMegaEvmto handle inspector early returntest_inspector_early_return_with_additional_limitsto validate the fix