Repository navigation
Conversation
…uest bambu-node sends a version request on connect and resolves connect() only after it is answered. Two X1 Carbons in LAN Only Mode broadcast reports but never answer it, so the 5 s command timeout became an unhandled rejection that terminated the server, and connect() hung for every caller. - Guard the command-timeout rejection like the other known bambu-node errors. - Wait for the initial request only 8 s after the MQTT session is up, share that bounded wait between concurrent callers, and evict a failed or late client. - get_printer_status reports commandsAnswered: false with a Developer Mode hint when its own status request is also unanswered. Bump to 1.2.11.
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.
Problem
Two Bambu Lab X1 Carbons (firmware 01.07, LAN Only Mode on) broadcast reports over MQTT but never answer bambu-node's initial information request. Effects:
get_printer_status. MCP clients saw this as a closed connection.connect()only after that request is answered, soconnect()hung, and with it every concurrent caller waiting oninitialConnectionPromises.Change
bambu-node-guard.ts: treat the command timeout as a known bambu-node internal error (same stack-origin check as the others).bambu.ts:getPrinterstops waiting for the initial request 8 s after the MQTT session is up, stores that bounded promise so concurrent callers share it, evicts the client ifconnect()fails later, clears the grace timer, and disconnects on failure.getStatusreturns the latest broadcast report and, when its own status request is unanswered,commandsAnswered: falseplus a Developer Mode hint.Evidence and limits
node --test tests/safety/bambu-node-guard.test.mjs: 5 pass (one new test reproduces the crash without the guard).get_printer_status, three concurrent calls, against two real X1 Carbons: all return the broadcast state, no crash. No print, heating or motion command was sent. A plainget_versionrequest also got no reply from either printer in 12 s, while broadcasts arrived.ledctrltoggled and restored on both, confirmed in the broadcast), but neither aget_versionnor apushallrequest produced any reply or echoed sequence id in 12-15 s.tests/behavior.test.mjs(and some Blender tests) fail identically on unmodified main (POSIX shell fixtures), so they are not caused by this change. The full suite was not run to completion here; CI on Linux is the gate.E404onPUT https://registry.npmjs.org/mcp-3d-printer-server, so npm still serves 1.2.9. The trusted publisher on npmjs.com probably needs to be set up for this repository andpublish.yml(maintainer action). Separate from this PR.