Skip to content

fix(tray): continue when system tray is unavailable - #5968

Merged
ReenigneArcher merged 2 commits into
masterfrom
codex/fix-tray-initialization-failure
Oct 21, 2026
Merged

ReenigneArcher merged 2 commits into
masterfrom
codex/fix-tray-initialization-failure

Conversation

@ReenigneArcher

@ReenigneArcher ReenigneArcher commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Description

When system tray initialization fails, Sunshine enters the tray event loop and treats its immediate exit as a shutdown request. This prevents startup when a desktop tray is unavailable, such as in some headless or SSH sessions.

Wait for Sunshine's normal shutdown event when the tray was not initialized, keeping the web UI and streaming workers running. Log that Sunshine is continuing without a tray. An initialized tray retains its existing shutdown behavior.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Testing

Added regression tests that verify an unavailable tray does not raise the workers' shutdown event, waits for an explicit shutdown request, and honors an already-pending shutdown.

Validated on Windows with MSYS2/UCRT64:

  • cmake --build cmake-build-release --target test_sunshine -j2: passed.
  • test_sunshine.exe --gtest_filter=SystemTrayTest.*:LicenseStates/UnlicensedVirtualHidTrayTest.*: 16 passed; 1 Windows CI setup test skipped.
  • Fresh gcov data confirms 100% line coverage of the added fallback.
  • cmake --build cmake-build-release --target docs -j2: strict documentation build passed.
  • uv run --locked lb-update-clang-format and git diff --check: passed.

The reported Linux boot/SSH environment was not reproduced locally.

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Tests have been added or updated for new or modified functionality, including regression tests for bug fixes

AI Usage

See our AI usage policy.

  • AI tools were used while preparing this PR

This pull request was generated by Codex using GPT-6.1 Sol, extra high thinking level.

Copy link
Copy Markdown
Member Author

This pull request was generated by Codex using GPT-6.1 Sol, extra high thinking level.

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 1.53kB (0.04%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sunshine-esm 996.33kB 1.53kB (0.15%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: sunshine-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
images/logo-*.svg -630 bytes 1.51kB -29.47%
images/logo-*.svg (New) 2.17kB 2.17kB 100.0% 🚀

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 38.42%. Comparing base (cf0fff2) to head (3047ee3).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/system_tray.cpp 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5968      +/-   ##
==========================================
+ Coverage   38.41%   38.42%   +0.01%     
==========================================
  Files         140      140              
  Lines       29335    29340       +5     
  Branches    12722    12724       +2     
==========================================
+ Hits        11270    11275       +5     
+ Misses      13664    12959     -705     
- Partials     4401     5106     +705     
Flag Coverage Δ
Alpine-aarch64 30.74% <50.00%> (+0.03%) ⬆️
Alpine-x86_64 30.85% <50.00%> (+0.02%) ⬆️
Archlinux 28.51% <50.00%> (+0.02%) ⬆️
FreeBSD-amd64 30.52% <50.00%> (+0.05%) ⬆️
Linux-AppImage-aarch64 33.65% <75.00%> (+0.03%) ⬆️
Linux-AppImage-x86_64 33.89% <75.00%> (+0.03%) ⬆️
PowerShell 100.00% <ø> (ø)
Web-UI 56.65% <ø> (ø)
Windows-AMD64 39.01% <50.00%> (+0.02%) ⬆️
Windows-ARM64 33.27% <50.00%> (+0.02%) ⬆️
macOS-arm64 38.94% <75.00%> (+0.05%) ⬆️
macOS-x86_64 39.51% <75.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/system_tray.cpp 70.92% <75.00%> (+0.03%) ⬆️

... and 27 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cf0fff2...3047ee3. Read the comment docs.

@github-actions

Copy link
Copy Markdown
Last Updated 2026-10-21 02:12:29 UTC
Source Run CI Run #6404
Commit 3047ee318347261b58d2fdb394963300fca77d76

Screenshot Comparison

PR #5968 screenshots vs screenshots baseline.

Matrix: AppImage-aarch64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: AppImage-x86_64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: Windows-AMD64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: Windows-ARM64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: macOS-arm64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: macOS-x86_64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

@ReenigneArcher
ReenigneArcher merged commit 3494b23 into master Oct 21, 2026
78 of 84 checks passed
@ReenigneArcher
ReenigneArcher deleted the codex/fix-tray-initialization-failure branch October 21, 2026 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failure to start on system boot (Error: System tray is not initialized)

1 participant