Skip to content

[repo-assist] fix: surface FSI evaluation errors to stderr by default in FsiEvaluator - #1242

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
repo-assist/fix-issue-685-evaluator-error-surfacing-7615d874a66fd7d5
Draft

[repo-assist] fix: surface FSI evaluation errors to stderr by default in FsiEvaluator#1242
github-actions[bot] wants to merge 1 commit into
mainfrom
repo-assist/fix-issue-685-evaluator-error-surfacing-7615d874a66fd7d5

Conversation

@github-actions

@github-actions github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🤖 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. The FsiEvaluator catches FsiEvaluationException and fires the EvaluationFailed event, but that event has no default subscribers. The onError callback also defaults to ignore. 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 EvaluationFailed or provided an onError callback. The message includes the file name and the FSI stderr output, which typically contains the actual error (e.g., the NativeLibrary.Load failure message).

The onError callback (used by the --strict pipeline) 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 --strict was not in effect.

Root Cause

onError defaults to ignore:

let onError = defaultArg onError ignore

And the EvaluationFailed event has no subscribers in the fsdocs pipeline. So evaluation failures were silently swallowed.

Trade-offs

  • The stderr message is always emitted, even in non-strict mode. This is intentional — invisible failures are worse than noisy ones. Users who want silence can redirect stderr.
  • No breaking API change: existing subscribers to EvaluationFailed and onError callbacks still work.

Test Status

✅ Build succeeded (dotnet build — Release)
✅ 143/143 tests passed (tests/FSharp.Literate.Tests)

Generated by 🌈 Repo Assist, see workflow run. Learn more.
Comment /repo-assist to run again

Add this agentic workflow to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@42c2ab5b4e4c9273534c39259b2e0df7f20f07e9

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't load native library in literate script

0 participants