Skip to content

fix: environment leak when function calls error - #388

Open
DeveloperC286 wants to merge 1 commit into
mainfrom
claude/environment-frame-leak-fix-9hnvm3
Open

fix: environment leak when function calls error#388
DeveloperC286 wants to merge 1 commit into
mainfrom
claude/environment-frame-leak-fix-9hnvm3

Conversation

@DeveloperC286

@DeveloperC286 DeveloperC286 commented Sep 6, 2026

Copy link
Copy Markdown
Owner

No description provided.

`evaluate_call_expression` pushed a new environment and then used `?`
while evaluating the arguments and the function's block, so any error
inside a call returned early without ever popping that environment.

Because the REPL reuses a single `Evaluator` across lines, each such
error permanently orphaned a frame: subsequent bindings landed in the
leaked environment and the chain grew without bound.

The body of the call is now evaluated by a helper, so the result is
propagated only after the environment has been popped, pairing every
push with a pop on both the success and the error paths.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P9XgLUX4gdGGRvKhnCAUs6
@DeveloperC286 DeveloperC286 changed the title Fix environment leak when function calls error fix: environment leak when function calls error Sep 6, 2026
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