Skip to content

fix(stepper): handle evaluator errors gracefully in BasicEvaluator and RunnerPlugin#30

Open
Shrey5132 wants to merge 1 commit into
source-academy:mainfrom
Shrey5132:feat/conductor-stepper
Open

fix(stepper): handle evaluator errors gracefully in BasicEvaluator and RunnerPlugin#30
Shrey5132 wants to merge 1 commit into
source-academy:mainfrom
Shrey5132:feat/conductor-stepper

Conversation

@Shrey5132

Copy link
Copy Markdown

This PR introduces error handling in BasicEvaluator and RunnerPlugin to catch and handle evaluator-side errors, propagating RunnerStatus.ERROR to the host. This prevents the host REPL loop from hanging indefinitely when evaluator plugins crash or fail to initialize.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces error handling to the evaluator startup process by wrapping the execution loop in try-catch blocks. In BasicEvaluator.ts, the evaluator loop is now monitored to notify the host of errors, and RunnerPlugin.ts has been updated to handle these errors asynchronously. Feedback highlights that the code following the infinite loop in BasicEvaluator.ts is unreachable and may cause compilation errors. Additionally, it is recommended to log the caught error in RunnerPlugin.ts rather than swallowing it silently to aid in debugging.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +17 to +18
// The REPL loop only exits if the conduit is terminated externally.
this.conductor.updateStatus(RunnerStatus.STOPPED, true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This code is unreachable because of the preceding infinite while (true) loop. If allowUnreachableCode is disabled in tsconfig.json, this will also cause a compilation error. Since the loop never terminates normally, these lines should be removed.

Comment on lines +45 to +49
} catch (_e) {
// BasicEvaluator already sends RunnerStatus.ERROR; this is a safety net for
// evaluator subclasses that override startEvaluator without the same guarantee.
this.updateStatus(RunnerStatus.ERROR, true);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The caught error is currently swallowed silently. Swallowing errors makes debugging extremely difficult because the stack trace and error message are lost. It is highly recommended to log the error to console.error so that the failure details are visible in the logs.

            } catch (e) {
                console.error("Evaluator error:", e);
                // BasicEvaluator already sends RunnerStatus.ERROR; this is a safety net for
                // evaluator subclasses that override startEvaluator without the same guarantee.
                this.updateStatus(RunnerStatus.ERROR, true);
            }

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.

1 participant