Repository navigation
fix: MCP stress findings: explore fan-out, auth check, output size, quality mapping - #5
Merged
Merged
Conversation
…uality Explore walks breadth-first with one bulk /objects/related call per level (was one call per node, unbounded; one timeout aborted the walk), with a node budget and per-node errors; maxDepth 0 now means unlimited. Connect verifies the token on /v1/namespaces (/v1/info is public) and keeps the current token on re-connect. elementIds are deduplicated (max 100), tool results are capped with a narrowing hint, over-long suggestion queries skip fuzzy matching. Server side: a component history read failure now carries a 501 responseDetail instead of an empty series, and OPC UA status maps to quality by severity, so UncertainInitialValue (unused alarm sub-states) is no longer Bad and pseudo-session no longer leaks status names as quality.
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.
Findings from stress-testing
@node-i3x/mcpover stdio against a portal instance (about 450 calls). Before → after on the same instance:explore {maxDepth:3}i3X Gateway request timed out after 15000ms for /v1/objects/relatedi3x_connectwith a wrong tokenconnected, then every call 401auth_failed, previous connection kept501 … not supportedplus a noteUncertainInitialValue) reported as BadGoodNoData(needs the server fix deployed)Causes and fixes:
/objects/relatedrequest per node through an unboundedPromise.all, and one timeout aborted the whole walk. It now walks breadth-first with one bulk request per batch of each level, under a node budget (maxNodes, default 500), and records failures on the node.maxDepth: 0now means unlimited, as in the value tools; it used to silently become 2./v1/info, which is public. It now also reads/v1/namespaces, and keeps the current token when re-connecting to the same URL without one.elementIdsare deduplicated and capped at 100. Tool results are capped at 100 000 characters (I3X_MCP_MAX_RESULT_CHARS) with a notice saying how to narrow the query. Suggestions skip fuzzy matching for queries over 128 characters._readComponentsHistoryturned a component read failure into{ values: [] }. The component now carriesresponseDetail(501), an additive field.Bad. Quality now follows severity: Good subcodes stay Good, Uncertain becomesUncertain(orGoodNoDatawhen the value is null, per the spec's null rules). The pseudo-session connector no longer emits status names such asUncertainInitialValueas the quality.Tests:
packages/mcp/tests/contract-stress.test.ts(real rest-server throughinject()), plus core mapping and history, pseudo-session history quality and monitor summary tests. All 19 new tests fail onmain's sources.Caveats:
Badare nowGood, and Uncertain statuses are nowUncertain/GoodNoData. One existing test asserted that status1(Good severity, info bits only) is Bad; it was changed to0x80000000.demo-embeddedsmoke test is still flaky under load: it failed the first two pushes of this branch, then passed.