Skip to content

fix(sync): re-arm a recovery probe that died while offline (closes #207) - #212

Merged
gnacho merged 2 commits into
mainfrom
fix/207-offline-probe-recovers
Sep 17, 2026
Merged

gnacho merged 2 commits into
mainfrom
fix/207-offline-probe-recovers

Conversation

@gnacho

@gnacho gnacho commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Problem

After a period without connectivity, folders stayed Offline and never synced again on their own; only a manual sync (or an app restart) recovered them.

Root cause, in the scheduler:

  • The server-unreachable recovery probe (Mark folder offline after N consecutive failed syncs regardless of error class #179) is a one-shot timer that re-enters start(). If it fires while the machine is offline, start aborts on !self.online - and the timer is gone for good (it is only ever re-armed from finished(NetworkError)).
  • When the network comes back, set_online(true) requests Trigger::NetworkRestored, but request() parks it behind the server_unreachable gate (only Manual passes). Nothing re-arms the probe, so the folder sits queued forever.

Fix

In set_online(true) (!was_online), when the server_unreachable gate is still armed: queue a Retry and call schedule_server_probe(). The probe guard (start_source) makes this a no-op when a probe is already pending, so the common path (network flapped before the probe fired) is unaffected. Once the probe fires with connectivity back, the engine runs, and the first success clears the gate - no manual sync, no restart.

Test (red-green)

network_restore_rearms_a_probe_that_died_while_offline: arm the gate via NetworkError, fire the probe while offline (assert the timer died and no engine run started), then restore the network and assert the probe is re-armed, a run starts, and Success returns the folder to IdleOk.

  • Red: fails at "the recovery probe is re-armed on network restore" (pending == 0).
  • Green: passes; full gate 713 passed + 1 ignored (known flaky), clippy --all-targets clean, fmt clean.

@gnacho
gnacho merged commit 72dead7 into main Sep 17, 2026
2 checks passed
@gnacho
gnacho deleted the fix/207-offline-probe-recovers branch September 17, 2026 18:56
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.

1 participant