Repository navigation
Keep the server answering when a streamed call or a tool VI raises an error - #53
Open
JanGoebelsBot wants to merge 6 commits into
Open
JanGoebelsBot wants to merge 6 commits into
JanGoebelsBot wants to merge 6 commits into
Conversation
98 of the toolkit's VIs had LabVIEW's automatic error handling enabled. Many of them leave error outputs unwired on purpose and clear errors later. Where such a VI ran in the background clone that answers a streamed tools/call (Run Streamed Request.vi, started with the Run VI method), an error on an unwired output opened LabVIEW's modal "Error occurred" dialog. The call then never returned and kept the request context, which serialises all requests, so the whole server stopped answering until someone pressed Continue in the LabVIEW IDE. Any streamed tools/call that failed triggered it: an unknown tool, an argument of the wrong type, in both protocol eras. The client saw an empty event stream, and every later request, including GET, timed out. Only the VI setting changes; no diagram is touched. The VIs were saved from inside LabVIEW MCP Server SDK.lvproj and are still LabVIEW 20.0, source only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tool and prompt VIs are run with the Run VI method. A VI that has LabVIEW's automatic error handling enabled, which is LabVIEW's default for new VIs, opened the modal "Error occurred" dialog when an error appeared on an output it left unwired. The call never returned and the server stopped answering every request until someone pressed Continue in the IDE. This happened for plain and streamed calls alike. New private VI Disable Automatic Error Handling.vi reads the setting of the VI it is given and writes FALSE when it is TRUE, in memory only; the VI is not saved. Reinitialize VI Inputs.vi, which tool call.vi and prompts get.vi run right before every call, now calls it first. In the IDE a tool VI whose setting was on shows as modified afterwards. In a built application the setting cannot be changed at run time (error 1073); that error is discarded, and technical-details.md now asks to wire the error outputs of tool VIs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Test 64 sends tools/call requests that fail while they are streamed (an unknown tool, and fake_tool_add with an argument of the wrong type, in both eras) and checks that the last event on the stream is the JSON-RPC answer with the request id, and that the server answers the next request. Test 65 calls the new fixture tool fake_tool_unwired_error, which has automatic error handling enabled and leaves the error of a JSON parse unwired, plainly and streamed, and checks that both calls are answered and the server keeps answering. Add Fixture Unwired Error Tool.vi registers it in Test_MCP_Server.vi. Inside the suite, which LabVIEW CLI runs, LabVIEW does not open the automatic error handling dialog, so both tests also pass against the old toolkit; they guard the answers on the stream. The check that fails without the fix is in the protocol tester (next commit), run against a server started on its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Test-McpServer.ps1 now also calls an unknown tool with a progressToken, which a server may answer as an SSE stream, and checks that the answer is an error with the request id and that the server answers tools/list afterwards. Against the Datalogger example started with Start VI.vi, the old toolkit fails both checks: the stream stays empty and the server stops answering, because LabVIEW's automatic error handling dialog blocks the streamed call. This is the same way Test-InstalledPackage.ps1 runs the installed examples, so the package test now catches this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
Tests✅ All 66 tests passed (243 assertions, 0 failures; LabVIEW CLI, LabVIEW 2026 64-bit). Per-test results
VI changesVIs: 99 modified, 6 added, 0 deleted 93 more modified VIsAdded VIs (6)Produced locally (the pull request workflow has not run: the self-hosted runner is offline). Tests: LabVIEW 2026 64-bit; VI comparison: LabVIEW 2026 32-bit. Report for commit 5f3b2e4. |
JanGoebelsBot
marked this pull request as ready for review
November 26, 2026 11:19
Tests✅ All 66 tests passed. Per-test results
Protocol tests✅ Protocol tester output (0 failed required checks)VI changesVIs: 99 modified, 6 added, 0 deleted 93 more modified VIsAdded VIs (6)Report for commit 5f3b2e4. The installable test package is under Artifacts of this run once the build job has finished. |
Review finding: Disable Automatic Error Handling.vi switched the setting off only for the tool or prompt VI itself. A subVI with automatic error handling on and an unwired error still opened LabVIEW's modal dialog and froze the server, the symptom this pull request is meant to fix. The Datalogger example's own tool calls such a subVI. The VI now also walks the callees of the tool VI, level by level and each VI once (Callees' Names), and switches the setting off where it is on. VIs under vi.lib, locked or password-protected VIs and VIs that cannot be read are left alone and not walked into. Measured in LabVIEW 2026: about 0.3 ms per call for one subVI, 3 ms for a hierarchy of 220 VIs; the first call after loading takes longer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review finding: Test 65 could not fail after its first run in a LabVIEW session, because the first call left the fixture switched off in memory, and inside the CLI-run suite LabVIEW does not open the dialog. The fixture fake tool unwired error.vi now calls the new fixture subVI fake unwired error subvi.vi (automatic error handling on, unwired JSON parse error). Before each half the test switches the setting on for both, in memory; after each call it asserts that both are off. With the previous Disable Automatic Error Handling.vi the subVI assertions fail, with no switching at all all four new assertions fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
Update: review fixes pushedNew commits: c7f2efc, 5f3b2e4.
Tests: Caraya suite through LabVIEW CLI, LabVIEW 2026 64-bit: 66 of 66 tests, 243 assertions, 0 failures. Still open: nothing on this pull request. |
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.


















































































































































































































Summary
A failing streamed
tools/call(with_meta.progressTokenandAccept: text/event-stream) froze the whole server: LabVIEW's modal automatic error handling dialog opened in the background clone that answers the stream, the call never returned, and because requests are handled one at a time every later request — evenGET— timed out until someone pressed Continue in the IDE. The same happens to a user's tool or prompt VI that leaves an error output unwired with automatic error handling on (LabVIEW's default for new VIs). This turns automatic error handling off in the toolkit's VIs and, in memory, for every tool and prompt VI and its subVIs before it runs.tools/callof an unknown tooldata:event with error-32602and the request idtools/callwith an argument of the wrong typedata:event with the result,isError: trueFound while checking the toolkit against MCP 2026-07-28 with the official suite
@modelcontextprotocol/conformance(0.2.0-alpha.12): from itstools-call-with-progressscenario on, every scenario timed out. This is the first of a series of pull requests for 2026-07-28; the next ones build on this branch.Changes
src/MCP Server/— VI setting Automatic Error Handling switched off. No diagram changed. Saved from insideLabVIEW MCP Server SDK.lvproj, still LabVIEW 20.0, source only. LabVIEW also refreshed the stored copies of linked typedefs and subVI link records in many of them (the file sizes grow; checked: no compiled code, 20.0).Disable Automatic Error Handling.vi— new, private (Private/SubVIs). Reads the setting of the VI it is given and writes FALSE when it is TRUE, in memory only; never saves. It does the same for the VI's callees, level by level and each VI once (Callees' Names); VIs undervi.lib, locked or password-protected VIs and VIs that cannot be read are left alone and not walked into. Errors of the read and write are discarded (in a built application the write is refused with 1073). Measured in LabVIEW 2026: about 0.3 ms per call for one subVI, 3 ms for a hierarchy of 220 VIs; the first call after loading takes longer.Reinitialize VI Inputs.vi— modified. RunsDisable Automatic Error Handling.vibefore resetting the inputs.tool call.viandprompts get.vicall it right before every tool and prompt VI runs, so both are covered.MCP Server.lvlib— the new VI added toPrivate/SubVIs.tools/test/Test-McpServer.ps1— two new required checks: an unknown tool called with aprogressTokenis answered with an error carrying the request id (on the stream or as JSON), and the server still answerstools/listafterwards.test streamed tool error.vi(Test 64),test tool automatic error handling.vi(Test 65), fixturefake tool unwired error.viand its subVIfake unwired error subvi.vi(both saved with automatic error handling on, on purpose) andAdd Fixture Unwired Error Tool.vi; both tests wired intoTest_MCP_Server.vi.docs/technical-details.md— says that the server switches the setting off before a tool or prompt VI runs, that the VI may then show as modified in the IDE, and to wire error outputs in tool VIs anyway (built applications cannot change the setting at run time).Code summary
Reinitialize VI Inputs.viDisable Automatic Error Handling.viAdd Tool.vi,tool call.vi,Mark Tool Error Result.vi, …)fake tool unwired error.vi,Add Fixture Unwired Error Tool.vi,Test_MCP_Server.viReinitialize VI Inputs.vi— modifiedRuns right before every tool and prompt VI is called (
tool call.vi,prompts get.vi); it now first makes sure that VI cannot open LabVIEW's error dialog.Disable Automatic Error Handling.vigets the tool or prompt VI first.error inruns through it, so with an incoming error nothing is changed.Disable Automatic Error Handling.vi— addedSwitches LabVIEW's automatic error handling off in memory, for the given VI and for every VI below it; never saves. The "Error" frame of the outer case, the "Already off" frame and the frame that skips a VI do nothing (all in the detailed report).
The walk (inner case, "False" frame: there are subVIs):
Test VIs
test streamed tool error.vi(Test 64): unknown tool and wrong argument type, streamed, legacy and modern era; the last event carries the answer with the request id;tools/listanswers afterwards.test tool automatic error handling.vi(Test 65):fake_tool_unwired_errorcalled plainly and streamed. Before each half it switches automatic error handling on in memory for the fixture tool and its subVI; after each call it asserts that both are off again, that the call was answered and that the server keeps answering.fake tool unwired error.vi,fake unwired error subvi.vi(unwired JSON parse error),Add Fixture Unwired Error Tool.vi: the fixture tool, its subVI and its registration;Test_MCP_Server.viregisters it and calls the two tests after Test 63.Verified
Disable Automatic Error Handling.vibefore c7f2efc its subVI assertions fail; with no switching at all its four new assertions fail.Run_Protocol_Tests_CLI.vi), LabVIEW 2020: 26 of 26 required checks passed.mainstarted withtools/ci/Start VI.viin LabVIEW 2026 →Test-McpServer.ps1: both new checks FAIL, the server stops answering, 18 of 24 required checks. Same example on this branch: 26 of 26, twice.Mark Tool Error Result.vi).Call VI.vidoes: modal dialog, LabVIEW blocked. Same VI after writing the setting FALSE in memory first: runs and returns, no dialog.npx @modelcontextprotocol/conformance@0.2.0-alpha.12 server --requirements 2026-07-28) against the Datalogger example: before, every scenario fromtools-call-with-progresson timed out; after, the server answers all of them (91 checks pass; the remaining failures are 2026-07-28 gaps and fixture tools the follow-up pull requests address).Not verified
main. Test 65 therefore checks the setting itself (above). The check that shows the freeze is the protocol tester against a server started on its own (above) — which is howTest-InstalledPackage.ps1tests the installed examples.maintoo, not caused by this change.Known rough edges
Reinitialize VI Inputs.viwas regenerated (three nodes, generated diagram); its layout is LabVIEW's.Maintainer steps
C:\actions-runner) is configured but not running, so the pull request workflow has not run; the review report comment was produced locally.🤖 Generated with Claude Code