You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(hosts): keep the upload-retention retry timer ref'd so it fires on Windows (fixes #536) - #550
Fixes#536: on Windows CI the upload-retention retry could be lost — "the
current policy to retry" never arrived at the daemon, leaving it on a
superseded policy until the next hello or change.
lib/hosts/upload-retention-sync.ts armed the retry with an unref'd setTimeout. An unref'd timer may never fire when nothing else keeps the
event loop alive, which is what was observed on Windows CI. The retry is now
deliberately ref'd: it must fire even when nothing else keeps the loop alive.
The callback re-checks the link and the current setting before sending, so a
late fire is harmless, and it never re-arms after disconnect.
Caveat: the root cause is still unproven on Windows — the unref'd timer is
the mechanism that fits the observed symptom, but this needs a Windows CI
run to confirm the flake is gone.
Tests (fresh main c110474, bun test): the existing lib/hosts/upload-retention-sync.test.mjs suite (6 tests, including the
retry-behaviour tests) passes; the targeted set for all three issues
(11 tests across 4 files) passes. tsc --noEmit clean.
Summary by CodeRabbit
Bug Fixes
Improved reliability of upload-retention updates by keeping eligible retries scheduled. Retries stop if the host disconnects or the retention setting changes.
Upload-retention retries now fire reliably even when nothing else keeps the process alive. The retry checks and backoff are unchanged, and shutdown still exits explicitly. No merge-blocking risk remains; a Windows CI run will confirm the flake is gone.
Architecture risk: Low · up to 4a014
The change affects 1 system.
Changed systems:lib
Architecture concerns
No architecture-level concerns identified.
Review details
Systems and components
observed — lib (service) was modified; 1 changed file maps to changed impact.
Before / after behavior
observed — Modified behavior in lib/hosts/upload-retention-sync.ts: Retry timers are no longer unreferenced, so they keep the event loop alive until firing. The retry’s link and current-setting checks, exponential backoff, and 30-second cap remain unchanged.
observed — Modified behavior in lib/hosts/upload-retention-sync.ts: The timer.unref() call was removed.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the actual change: the upload-retention retry timer is kept ref'd (not unref'd), and the stated purpose is to make it fire on Windows. The raw summary confirms the change replaces unre…
Linked Issues check
Issue #536 asks for a fix to the open lead: the unref'd setTimeout in lib/hosts/upload-retention-sync.ts can lose the upload-retention retry. The reviewed diff (merge base 743af31 to head 4a014d6) r…
Out of Scope Changes check
The whole-PR diff changes only lib/hosts/upload-retention-sync.ts (+7/-2). The change removes timer.unref() and adds a comment that explains why the retry is ref'd. Every changed line is part of the r…
Full details: Title check
Explanation
The title names the actual change: the upload-retention retry timer is kept ref'd (not unref'd), and the stated purpose is to make it fire on Windows. The raw summary confirms the change replaces unref() with a referenced timer in lib/hosts/upload-retention-sync.ts, and the linked issue #536 describes the unref'd setTimeout as the suspected lead. The title is specific, but the objectives say the root cause is unproven, so 'so it fires on Windows' states an intent that CI has not yet confirmed.
Full details: Linked Issues check
Explanation
Issue #536 asks for a fix to the open lead: the unref'd setTimeout in lib/hosts/upload-retention-sync.ts can lose the upload-retention retry. The reviewed diff (merge base 743af31 to head 4a014d6) removes timer.unref() from the retry in send(). The retry now stays referenced, so it fires even when nothing else keeps the event loop alive. The callback still checks getHost, isLinkUp, and loadWebServerSettings().uploadRetentionDays === days before it re-sends, so a superseded policy is not restored. No code path re-arms the timer after disconnect. The change targets the lead named in #536. Scope limits: the root cause is not proven, and no Windows run was done in this review. The issue lists a Windows reproduction as a next step, which is not a coding requirement. No new automated test was added in this diff. The PR description reports that the existing test file passes.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff changes only lib/hosts/upload-retention-sync.ts (+7/-2). The change removes timer.unref() and adds a comment that explains why the retry is ref'd. Every changed line is part of the retry path that #536 names. No unrelated code, configuration, or tests are changed in the reviewed diff.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Fix failing CI checks
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: fb3ec0ba-cc35-4415-8750-f39c159efd19
Commits
Reviewing files that changed from the base of the PR and between 5d7232a and 4a014d6.
Files selected for processing: 1
lib/hosts/upload-retention-sync.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #536: on Windows CI the upload-retention retry could be lost — "the
current policy to retry" never arrived at the daemon, leaving it on a
superseded policy until the next hello or change.
lib/hosts/upload-retention-sync.tsarmed the retry with an unref'dsetTimeout. An unref'd timer may never fire when nothing else keeps theevent loop alive, which is what was observed on Windows CI. The retry is now
deliberately ref'd: it must fire even when nothing else keeps the loop alive.
The callback re-checks the link and the current setting before sending, so a
late fire is harmless, and it never re-arms after disconnect.
Caveat: the root cause is still unproven on Windows — the unref'd timer is
the mechanism that fits the observed symptom, but this needs a Windows CI
run to confirm the flake is gone.
Tests (fresh main c110474,
bun test): the existinglib/hosts/upload-retention-sync.test.mjssuite (6 tests, including theretry-behaviour tests) passes; the targeted set for all three issues
(11 tests across 4 files) passes.
tsc --noEmitclean.Summary by CodeRabbit