fix(web): device tool update failures show the server error, not network advice #17569
main fromrefs/pull/17569/head·merged by juliusmarminge View on GitHubProblem#
When Update for the Device hub or agent device fails in Settings → Integrations, the popover always says "Update failed. Check this host's network connection and try again." A failed npm install, such as one blocked by an unwritable npm cache, reads as a network problem.
Change#
- The popover shows the server's error message through
formatEnvironmentQueryError, as the device panel already does. - The server keeps npm's exit code when it wraps a failed install, so the message reads "Device update device tool failed: The device command failed (exit code 1)." npm's stderr stays out of the shown message, as before.
Scope and approval#
Refs #17431. The triage comment lists distinct Update failure copy as option 1; this does that. A redacted stderr detail and a private npm cache (options 2 and 3) are left out, and the message does not yet name npm or the install step, so the issue stays open. DeviceIntegrationControls is exported for the new test.
Verification#
Ubuntu 24.04:
vp test run src/components/settings/DeviceToolUpdate.test.tsxinapps/web: clicks Update with a failed install (exit code 243, a registry credential in its cause) and with a lost connection, and checks the alert shows the server's message and nothing from the cause. With the popover change reverted both cases fail with the old network copy.vp test run src/device/DeviceService.test.tsinapps/server: builds the realDeviceServicewith npm exiting 243 and checks the update error keeps the exit code. With the server change reverted it fails.- The settings and
src/devicetest runs pass (16 and 81 tests); web and server typecheck,vp lint, andvp fmt --checkare clean. - Rebased onto main
9a067b2dfa(2026-10-15) over #19961's new test inDeviceService.test.ts; on main the popover still shows the network copy and the update error has no exit code. On the rebased head both test files pass (29 tests); withDeviceService.tsreverted the server test fails, and with only the popover message line reverted both web cases fail with the old network copy. Web and server typecheck,vp lintandvp fmt --checkpass. - Real run on a dev server with
npm_config_cachepointed at a read-only directory, Settings driven by headless Chromium at 1280×800. The server trace shows npm failing withEACCES(exit code 1). Before the fix the popover blamed the network; after, it shows the exit-code message. Restarting with a writable cache and clicking Update again installed v0.12.0.
Before:
https://github.com/user-attachments/assets/e6bb8520-f91b-437f-840d-1fefe241fff8
After:
https://github.com/user-attachments/assets/812fa83d-96ef-4232-9973-fae279d52076
Retry with a writable cache:
Not tested on macOS.
Model: Claude Opus 5.5, Claude Fable 5.1 (review), GPT-6-Astra (review). Harness: Claude Code, Codex.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Approved at
f61ceeaMacroscope's review found this PR approvable — This is a focused error-reporting fix for an existing device-tool update flow, with no changes to installation behavior or product defaults. Regression tests cover both server-side exit-code propagation and the UI’s handling of command and connection failures while keeping npm output out of the displayed message.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
344339b1-2089-48b8-8060-94bb14ac0f9c
📥 Commits
-
Reviewing files that changed from the base of the PR and between f61ceea7076cda6e63a7ed2b6153a613f36fcef4 and 871fcb60b788ce0560c2f4afc22b7862e813bcd4.
📒 Files selected for processing: 3
-
apps/server/src/device/DeviceService.test.tsapps/server/src/device/DeviceService.tsapps/web/src/components/settings/IntegrationsSettings.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
📝 Walkthrough
-
The server documents that device-tool update errors omit npm output and include the exit code when available. The settings UI displays formatted update failures instead of a fixed connection error.
Changes: Device tool update errors
Layer / File(s) Summary Server update error reporting
apps/server/src/device/DeviceService.ts,apps/server/src/device/DeviceService.test.tsA comment documents the sanitized error message. A test checks that it includes the exit code and omits npm output containing credentials. Settings update error display
apps/web/src/components/settings/IntegrationsSettings.tsx,apps/web/src/components/settings/DeviceToolUpdate.test.tsxTool-update failures use formatEnvironmentQueryErrorrather than a fixed connection error. Tests check the displayed messages for failed installation and unavailable environment RPC responses.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~12 minutes
Change: Bug fix
Suggested reviewers:
juliusmarminge
Merge Risk: ⚪ Minimal · up to
871fc-
Device update failures now show the server’s sanitized error, while unavailable-environment failures retain connection guidance. The supplied tests cover both paths, and no actionable merge-blocking risk remains.
Pre-merge checks:
4-
Check name Status Explanation Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Title check The title clearly and concisely describes the main change: showing the server error instead of generic network advice for device tool update failures. Description check The description covers the problem, change, scope and approval, verification results, screenshots, limitations, and agent details. It provides focused test evidence and explains the remaining out-of-s…
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
coderabbitai[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge merged this17fa628
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes