Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): updater failures log the error code and exit status #14008

ClosedTonybynMp4(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/14008/headopened View on GitHub

When an update check, download or install fails, the desktop log only records the error tag, so there's no way to tell a missing feed file from a network error or a cancelled password prompt (#13977).

Updater failures now also log two bounded fields from the cause:

  • errorCode: the cause's code, but only if it looks like an identifier (ERR_UPDATER_*, HTTP_ERROR_404, ENOTFOUND).
  • exitStatus: the number from electron-updater's Command … exited with code N, which is how a dismissed pkexec prompt reports on .deb installs.

The message and URL are still never logged, since electron-updater messages can embed the feed URL with credentials. The fields are added to the check, download and quit-and-install handlers, and to the updater error event handler, which is where DebUpdater reports a failed install.

Tests: the existing redaction test now gives its cause a code and checks that the code is logged while the token still isn't. A new test covers a cancelled pkexec install, checking for exitStatus: 126 and operation: install. Both fail without the change.

Verified on a locally built 0.0.90 .deb against scripts/mock-update-server.ts:

# no channel file on the feed
Desktop updater check operation reported an error.  operation: check  errorCode: ERR_UPDATER_CHANNEL_FILE_NOT_FOUND
# fake 0.0.91 feed, Install, then cancel the pkexec prompt
Desktop updater install operation reported an error.  operation: install  exitStatus: 126

No updater log line contained the feed URL.

Closes #13977

🤖 Generated with Claude Code (Claude Opus 5.5)

Summary by CodeRabbit

  • Bug Fixes
    • Update failure logs now include more useful diagnostic details, such as available error codes and installer exit statuses. This can make it easier to understand why an update check, download, or installation failed, while avoiding logging URL-bearing error messages.
    • Installer failures that provide an exit status are recorded with that status, even when no error code is available.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      Important

      Review skipped

      We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration

      Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

      Review profile: CHILL

      Plan: Advanced

      Run ID: 15d33c07-5400-40fe-bdf6-cc04aef028b1

      📥 Commits

      Reviewing files that changed from the base of the PR and between 94f92a7a386a26c98892b24fabdd0ea9fa804ce3 and d3eb02444e9d8764d96241510531544cbfdbeef1.

      📒 Files selected for processing (2)
      • apps/desktop/src/updates/DesktopUpdates.test.ts
      • apps/desktop/src/updates/DesktopUpdates.ts

      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

      Walkthrough

      Updater failure logs now include bounded error codes and installer exit statuses when available. Tests cover HTTP error codes and installer exit status, and check that sensitive URL details remain excluded.

      Changes

      Updater failure diagnostics

      Layer / File(s)Summary
      Extract and log bounded failure fields
      apps/desktop/src/updates/DesktopUpdates.ts, apps/desktop/src/updates/DesktopUpdates.test.ts
      A helper extracts valid error codes and installer exit statuses from error causes. Updater check, download, install, and error-handler logs include those fields when available. Tests check the HTTP error code and installer exit status, and verify that sensitive URL details are not logged.

      Priority: ⬇️ Low

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

      Change: Bug fix · Severity of issue fixed: Low

      Suggested reviewers: juliusmarminge

      Merge Risk: ⚪ Minimal · up to d3eb0

      This change adds bounded updater failure details without logging raw error messages or URLs. No concrete regression is established, so no merge-blocking issue is identified; real installer exit-status coverage remains unverified.

      Architecture Summary

      Architecture risk: 🔵 Low · up to d3eb0

      The change affects 1 system.

      Changed systems: apps/desktop

      Architecture concerns No architecture-level concerns identified.

      Review details

      Systems and components

      • observed — apps/desktop (service) was modified; 2 changed files map to changed impact.

      Before / after behavior

      • observed — Modified behavior in apps/desktop/src/updates/DesktopUpdates.test.ts: The test error now includes code: "HTTP_ERROR_404" in addition to the sensitive URL message; the existing assertions continue to check that the logged annotations do not expose the raw error or secret.
      • observed — Modified behavior in apps/desktop/src/updates/DesktopUpdates.test.ts: The test now expects the logged error annotations to include errorCode: "HTTP_ERROR_404".
      • observed — Modified behavior in apps/desktop/src/updates/DesktopUpdates.test.ts: Adds a test that emits an installer error containing pkexec exit code 126 and checks that the logged install annotations include exitStatus: 126 but omit errorCode.
      • observed — Modified behavior in apps/desktop/src/updates/DesktopUpdates.ts: Added describeUpdaterFailureCause, which returns no fields for non-Error causes, includes errorCode only when code is a string matching ^[A-Z][A-Z0-9_]{0,63}$, and extracts exitStatus only from a trailing exited with code followed by one to three digits.
      🚥 Pre-merge checks | ✅ 4 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly and concisely describes the primary change: logging updater error codes and exit statuses.
      Description check✅ PassedThe description clearly explains what changed, why it changed, security considerations, tests, and issue closure. It omits the template headings and checklist, but the core required information is pre…
      Linked Issues check✅ PassedThe changes address #13977. DesktopUpdates.ts adds bounded failure context for updater check, download, install, and error event logs. The context includes a validated errorCode and parsed insta…
      Out of Scope Changes check✅ PassedThe changes stay within #13977. The source changes add diagnostic fields to desktop updater failure logs, and the test changes verify those fields and redaction behavior. No unrelated behavior is desc…
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR

      Comment `@coderabbitai help` to get the list of available commands.
    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at d3eb024

      Macroscope's review found this PR approvable — This is a small, self-contained updater diagnostics fix that adds sanitized error codes and installer exit statuses to existing failure logs without changing update control flow or product defaults. Tests cover both new logging paths, and the companion test changes have no production impact.

      Notes:

      • Diff unchanged. Approvability was decided on eligibility alone.

      No code changes detected at ee64ffc. Prior analysis still applies.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. juliusmarminge added labelsmacroscope-review

    5. Note

      Grok responding on behalf of Julius.

      Thanks for this! #18864 just landed on main and covers the same thing: updater check, download, install, and updater-event failures now log a redacted summary of the underlying cause. That fixed #13977, so I'm closing this one as superseded. If something from here is still missing on main (the explicit exitStatus from a cancelled pkexec, for example), feel free to open a smaller follow-up on top of current main.

    6. juliusmarminge closed this

Sign in to join this conversation.