Skip to content

Fix Apple Watch complications freezing at old values - #5370

Merged
bgoncal merged 2 commits into
mainfrom
bgoncal/fix-watch-complications-stuck
Aug 6, 2026
Merged

Fix Apple Watch complications freezing at old values#5370
bgoncal merged 2 commits into
mainfrom
bgoncal/fix-watch-complications-stuck

Conversation

@bgoncal

@bgoncal bgoncal commented Aug 6, 2026

Copy link
Copy Markdown
Member

AI Policy

Select exactly one option that describes AI usage in this contribution:

  • I have not used AI for this contribution.
  • AI assistance was used for this contribution.
  • AI fully generated the code for this contribution, but I've reviewed and understood it before submitting and will respond without AI during review.

Summary

Watch complications could stay frozen at an old value in the background until the app was opened or a manual refresh was triggered. The background refresh task completes at a ~10s watchdog deadline, but the complication fetches used URLSession's default 60s timeout and ran sequentially, so a slow or unreachable server stalled the whole refresh before fresh values were written. This bounds the fetch timeout to 8s and fetches complications concurrently so one slow server can't stall the rest.

Screenshots

N/A – no visual change.

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

Copilot AI lite review requested due to automatic review settings August 6, 2026 12:25
@bgoncal
bgoncal enabled auto-merge (squash) August 6, 2026 12:28
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

⚠️ Unused L10n strings detected

Found 5 unused localization strings in the codebase.

Click to see details
Parsing Strings.swift...
Found 2421 L10n strings

Reading all Swift source code...
Read 8590963 characters of Swift code

Checking for unused strings...
Checked 100/2421 strings...
Checked 200/2421 strings...
Checked 300/2421 strings...
Checked 400/2421 strings...
Checked 500/2421 strings...
Checked 600/2421 strings...
Checked 700/2421 strings...
Checked 800/2421 strings...
Checked 900/2421 strings...
Checked 1000/2421 strings...
Checked 1100/2421 strings...
Checked 1200/2421 strings...
Checked 1300/2421 strings...
Checked 1400/2421 strings...
Checked 1500/2421 strings...
Checked 1600/2421 strings...
Checked 1700/2421 strings...
Checked 1800/2421 strings...
Checked 1900/2421 strings...
Checked 2000/2421 strings...
Checked 2100/2421 strings...
Checked 2200/2421 strings...
Checked 2300/2421 strings...
Checked 2400/2421 strings...

================================================================================
UNUSED STRINGS REPORT
================================================================================

Found 5 unused strings:


ENTITYPICKER:
  - L10n.EntityPicker.addAll
    Key: entity_picker.add_all
    Line: 1725

WATCH:
  - L10n.Watch.Complications.Builder.colors
    Key: watch.complications.builder.colors
    Line: 6495
  - L10n.Watch.Complications.Builder.customColors
    Key: watch.complications.builder.custom_colors
    Line: 6505
  - L10n.Watch.Config.Add.Error.fetchFailed
    Key: watch.config.add.error.fetch_failed
    Line: 6710
  - L10n.Watch.Config.Assist.Error.fetchFailed
    Key: watch.config.assist.error.fetch_failed
    Line: 6738

================================================================================
Total unused: 5
================================================================================

================================================================================
Copy-paste these keys into the "Lokalise: Delete Keys" workflow (keys input):
================================================================================
entity_picker.add_all,watch.complications.builder.colors,watch.complications.builder.custom_colors,watch.config.add.error.fetch_failed,watch.config.assist.error.fetch_failed

To remove them, run the
Lokalise: Delete Keys
workflow — it deletes the keys from Lokalise and opens a PR removing them from
Localizable.strings and regenerating Strings.swift. Copy-paste these keys into the keys input:

entity_picker.add_all,watch.complications.builder.colors,watch.complications.builder.custom_colors,watch.config.add.error.fetch_failed,watch.config.assist.error.fetch_failed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent Apple Watch complications from remaining stuck on stale values after a background refresh by reducing the chance that background refresh work exceeds watchOS’s short watchdog window.

Changes:

  • Fetches complication snapshots concurrently during a refresh run, rather than sequentially.
  • Bounds REST fetch duration for complication state fetches by using a URLSession configuration with an 8s timeout.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
Sources/WatchApp/ExtensionDelegate.swift Switches complication refresh from sequential to concurrent snapshot builds (task group) while preserving config order.
Sources/WatchApp/Complication/ComplicationStateFetcher.swift Uses a bounded URLSessionConfiguration (8s timeouts, no waitsForConnectivity) for complication REST calls to avoid long hangs.

Comment thread Sources/WatchApp/ExtensionDelegate.swift Outdated
@bgoncal
bgoncal merged commit 4e09438 into main Aug 6, 2026
11 checks passed
@bgoncal
bgoncal deleted the bgoncal/fix-watch-complications-stuck branch August 6, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants