Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): device host checks show the error without a stack trace #29912

Mergedsaphid(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/29912/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Problem

In Settings → Device hosts, Test connection checks a host from each selected environment. When a check fails, its row has a "Show error" disclosure. The hook built that text with Cause.pretty(result.cause), so the user saw the error class name and a client stack trace instead of the message the server wrote:

DeviceHostUnavailableError: Mac mini is unavailable: SSH connection refused.
    at http://…/assets/…js:…
    at …

Change

useHostConnectionChecks now throws squashAtomCommandFailure(result) and does not wrap Cause.pretty. The existing checkDeviceHostConnections helper already reports a thrown error by its message. This uses the same failure handling as DevReplayHost, CommandPalette, and the other Settings dialogs. Every device.testHost error (the DeviceError union and EnvironmentAuthorizationError) is a tagged error with a user-facing message, so the message alone loses nothing the user needs.

Scope and approval

This is a very small, focused fix for an obvious bug, so there is no prior issue. The diff changes 2 lines in one hook and adds one focused browser test.

Overlap search: the local PR index and GitHub search for useHostConnectionChecks, "device host", and "test connection". Open #19173 redacts SSH addresses in the same settings area. It edits deviceHostConnectionChecks.ts but does not change how the hook turns the RPC failure into text, so the two changes are independent. #29889 fixes the same class of problem for scheduled tasks' lastRunError on the server.

Verification

  • Red on main: the new useHostConnectionChecks.browser.test.tsx failed with - "Mac mini is unavailable: SSH connection refused." / + "DeviceHostUnavailableError: Mac mini is unavailable: SSH connection refused.\n at http://localhost…".
  • Green: vp test run src/components/settings/useHostConnectionChecks.browser.test.tsx src/components/settings/deviceHostConnectionChecks.test.ts: 2 files, 4 tests passed.
  • vp run check:changed passed format, lint, knip, typecheck (2 packages), tests, and the React Compiler check.
  • Not checked: a real-client capture. Only the text changes; the layout does not.

Reviewed with sol-loop: 1 round with GPT-6.1 Sol on high. Sol verdict: approved (one nit about test mock reset, applied).

Created with Claude Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. Approvability

      Verdict: Approved at 3cba0b7

      Macroscope's review found this PR approvable — Device-host connection failures now display the underlying error message rather than a formatted stack trace. Probe behavior and authorization checks are unchanged, keeping the change limited to error presentation.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. Review in Change Stack →

      No actionable comments were generated in the recent review.

      Walkthrough

      The hook now converts failed atom-command results with squashAtomCommandFailure. A browser test checks that an SSH connection check returns a failed status and the formatted host-unavailable message.

      Changes: Host connection failure formatting

      Layer / File(s)Summary
      Convert and verify command failures
      apps/web/src/components/settings/useHostConnectionChecks.ts, apps/web/src/components/settings/useHostConnectionChecks.browser.test.tsx
      The hook uses squashAtomCommandFailure when the command fails. The browser test checks the failed status and formatted error message for DeviceHostUnavailableError.

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Suggested reviewers: juliusmarminge

      Merge Risk: Minimal · up to 3cba0

      Host connection failures should show the server message. No material merge risk was identified.

      Pre-merge checks: Passed 4
      Check nameStatusExplanation
      Title checkPassedThe title "fix(web): device host checks show the error without a stack trace" matches the main change. The hook now throws squashAtomCommandFailure(result) instead of formatting the cause with Cause.p…
      Description checkPassedThe description follows the repository template. It has Problem, Change, Scope and approval, and Verification sections. The Problem section explains the stack trace output and the expected message. Th…
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Full details: Title check

      Explanation

      The title "fix(web): device host checks show the error without a stack trace" matches the main change. The hook now throws squashAtomCommandFailure(result) instead of formatting the cause with Cause.pretty, so the Show error disclosure displays the message without the error class name or client stack trace. The title is specific, uses a conventional commit prefix, and is 65 characters long.

      Full details: Description check

      Explanation

      The description follows the repository template. It has Problem, Change, Scope and approval, and Verification sections. The Problem section explains the stack trace output and the expected message. The Change section explains the switch to squashAtomCommandFailure. The Scope section states this is a small, focused fix of an obvious bug and gives an overlap search. The Verification section lists a red-then-green browser test run and a changed-files check run, and it states what was not checked (a real-client capture). The description does not include a screenshot, but the change affects only text, so the template's before/after screenshot requirement for UI changes is not clearly met. The Scope section also does not link a triaged issue, but it explains why none is needed for a very small obvious bug, as the template permits. The description is mostly complete.

      Finishing Touches
      Generate unit tests (beta)
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Warning

      Some tools did not complete. Review the errors below.

      ast-grep (0.51.1)

      ast-grep could not parse rule config: /ast-grep-rules/ast-grep-essentials/rules/python/security/python-pymongo-empty-password-python.yml

      Usage-based review receipt

      Note

      This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.

      CodeRabbit Verify

      • Run CodeRabbit Verify to test the changes in this pull request.
      Recent review info
      Run configuration
      Commits

      Reviewing files that changed from the base of the PR and between 61c3794c32b0eeebfac09add43e403618c65d2d7 and 3cba0b7ed26fbde4484ea50746364fc4fb064742.

      Files selected for processing: 2
      • apps/web/src/components/settings/useHostConnectionChecks.browser.test.tsx
      • apps/web/src/components/settings/useHostConnectionChecks.ts

      Limit details: You’ve used all 10 included reviews currently available.

    4. maria-rckscommented

      Note

      Written by gpt-6.1-sol on behalf of Maria

      Verified in a real dev environment

      verified exact head 3cba0b7ed26fbde4484ea50746364fc4fb064742 on a linux boat vm, using the real dev web app in google chrome driven by the repo's playwright. no mocks, fixtures, or demo data. no code changes needed.

      • reproduced on github/main (61c3794c32), installed in a separate worktree: settings → devices → add source → machine over ssh → test connection against localhost port 1. the real device.testHost rpc failed and "show error" displayed DeviceOperationError, client stack frames, and the nested ssh connection-refused error.
      • stopped main and started the exact pr head. the same input and real rpc displayed only Device probe host failed: Could not communicate with device support. Try refreshing devices. no error class or stack trace.
      • checked repeated failures, clearing stale results after editing the port, localhost port 22 reporting "already available locally", saving the host, and the saved-row test connection action showing the clean error toast.
      • added a project pointing at the real main git worktree through the app. selected codex gpt-6.1-sol and ran a read-only git inspection turn through the client and local provider proxy. it completed in 14s with VERIFY_CODEX_OK; the client showed zero changed files.
      • vp run check:changed 61c3794c32b0eeebfac09add43e403618c65d2d7 passed through blacksmith-check: format, lint, knip, affected typechecks, the browser test, and react compiler check. the worker needed playwright chromium installed first. github ci is also green.

      short runtime transcript

      main: real failed host check with client stack trace

      pr: matching failed host check shows only the server message

      pr: retry, port edit, local success, and saved-host test interaction

      pr: saved-host failure toast has no stack trace

      pr: real codex turn completed through the web client

      Not verified

      native ios/android and electron clients; macos/windows hosts; multi-environment checks; a successful remote ssh device host with installed simulator tooling. this vm provides linux web verification. the real ssh failure is wrapped as DeviceOperationError, rather than the DeviceHostUnavailableError used by the added browser test; both use the same changed client path. the server's existing generic probe-failure message remains generic.

Sign in to join this conversation.