[repo-assist] fix: surface FSI evaluation errors to stderr by default in FsiEvaluator - #1242
Draft
github-actions[bot] wants to merge 1 commit into
Draft
Conversation
When a code snippet fails during --eval, the error was silently discarded unless the caller subscribed to the EvaluationFailed event or provided an onError callback. This made failures very hard to diagnose (e.g. native library loading failures in issue #685). Now a concise error message (file name + stderr output from FSI) is always written to stderr immediately, while the existing onError callback (used for --strict mode) continues to work as before. The misleading 'and --strict is on' phrase in the onError message has also been removed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Closes #685
Problem
When a code snippet fails during
fsdocs --eval(e.g., native library loading fails), the error was silently discarded. TheFsiEvaluatorcatchesFsiEvaluationExceptionand fires theEvaluationFailedevent, but that event has no default subscribers. TheonErrorcallback also defaults toignore. This meant that users saw empty output blocks with no indication that evaluation had failed — exactly the symptom described in #685.Fix
Always write a concise error message to stderr when FSI evaluation fails, regardless of whether the caller subscribed to
EvaluationFailedor provided anonErrorcallback. The message includes the file name and the FSI stderr output, which typically contains the actual error (e.g., theNativeLibrary.Loadfailure message).The
onErrorcallback (used by the--strictpipeline) continues to work as before. The misleading "and --strict is on" phrase in the error message has also been removed — it was displayed even when--strictwas not in effect.Root Cause
onErrordefaults toignore:And the
EvaluationFailedevent has no subscribers in the fsdocs pipeline. So evaluation failures were silently swallowed.Trade-offs
EvaluationFailedandonErrorcallbacks still work.Test Status
✅ Build succeeded (
dotnet build— Release)✅ 143/143 tests passed (
tests/FSharp.Literate.Tests)Add this agentic workflow to your repo
To install this agentic workflow, run