fix(meshcore): reduce set_out_path timeout and improve error message#3665
Conversation
…3664) When a serial-connected device (e.g. xiao nrf on serial-bridge) fails to acknowledge the CMD_ADD_UPDATE_CONTACT command, the old 30 s default left the "Define forwarding path" UI stuck in a saving state for far too long. - Set an explicit 12 s native-command timeout for set_out_path, which is generous for a responsive device while failing fast for an unresponsive one - Append a hint to the server WARN log when the failure is a timeout so operators can distinguish connection issues from other failures - Replace the misleading 409 error body ("contact may be unknown …") with an actionable message: "device did not respond in time, verify connection" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GAhBrRAohyXfN1M7bMHRoy
|
Claude finished @Yeraze's task —— View job PR Review
This is a small, focused fix that addresses a real UX pain point. The change is well-scoped and the code quality is solid. A few observations:
|
| public_key: publicKey, | ||
| out_path: outPathBytes, | ||
| }); | ||
| }, 12000); |
Fixes #3664
Summary
When saving a manually-defined forwarding path on a serial-connected MeshCore device (e.g. xiao nrf on serial-bridge), the UI could hang for a long time before showing "Save failed". The old 30-second native-command timeout was too long, and the 409 error body was misleading.
Root cause:
set_out_pathmakes two serial round-trips (getContacts()to look up the contact object, thensetContactPath()to write the new path). On a slow or unresponsive device/serial-bridge the first operation never returns, keeping the serial port busy. A second save attempt then queued behind the lingering first operation, stacking up two 30-second hangs.Changes
meshcoreManager.ts: Pass an explicit 12 s timeout tosendBridgeCommand('set_out_path', …)instead of relying on the 30 s default. Append a connection-hint to the WARN log when the failure is a timeout.meshcoreRoutes.ts: Replace the misleading 409 error body ("contact may be unknown, source disconnected, or not a Companion device") with an actionable message ("device did not respond in time — verify the device is connected and try again").Test plan
out-pathroute tests still pass (npx vitest run src/server/routes/meshcoreRoutes.test.ts— 156 tests green)🤖 Generated with Claude Code
https://claude.ai/code/session_01GAhBrRAohyXfN1M7bMHRoy
Generated by Claude Code