Skip to content

fix: replace flaky internet checks with explicit offline mode#1615

Merged
AlexCheema merged 1 commit intomainfrom
alexcheema/replace-internet-checks-with-offline-mode
Feb 24, 2026
Merged

fix: replace flaky internet checks with explicit offline mode#1615
AlexCheema merged 1 commit intomainfrom
alexcheema/replace-internet-checks-with-offline-mode

Conversation

@AlexCheema
Copy link
Copy Markdown
Contributor

Motivation

The socket-based internet connectivity probes (connecting to 1.1.1.1/8.8.8.8/1.0.0.1 every 10 seconds) are flaky — they produce false negatives on some networks/ISPs, causing downloads to silently fail or get stuck. Instead of dynamically detecting connectivity, this replaces it with an explicit offline mode that the user opts into.

Changes

  • Removed internet check infrastructure: Deleted _test_internet_connection() (socket probes) and _check_internet_connection() (10s polling loop) from DownloadCoordinator
  • Renamed internet_connectionoffline on ShardDownloader base class and all subclasses (SingletonShardDownloader, CachedShardDownloader, ResumableShardDownloader)
  • Removed on_connection_lost callbacks from download calls — no longer needed without dynamic connectivity detection
  • Added EXO_OFFLINE env var support in constants.py and Args default in main.py
  • Added Offline Mode toggle to macOS app Settings → General tab, which sets EXO_OFFLINE=true in the process environment and restarts

Why It Works

The download behavior (skip_internet conditionals in download_utils.py) is unchanged — we just changed what drives it. Instead of a flaky socket probe setting internet_connection=True/False, the user explicitly sets offline mode via:

  1. --offline CLI flag
  2. EXO_OFFLINE=true environment variable
  3. macOS app Settings → General → Offline Mode toggle

This is more reliable and predictable. Users on flaky networks no longer get intermittent download failures.

Test Plan

Manual Testing

  • uv run exo --offline starts without internet checks, rejects downloads for unavailable models
  • EXO_OFFLINE=true uv run exo behaves identically
  • macOS app Settings toggle persists across restarts and passes env var to the exo process

Automated Testing

  • All existing tests pass (222 passed), including 8 offline-mode specific tests
  • uv run basedpyright — 0 errors
  • uv run ruff check — all checks passed
  • nix fmt — 0 files changed

🤖 Generated with Claude Code

@AlexCheema AlexCheema force-pushed the alexcheema/replace-internet-checks-with-offline-mode branch from 7cce807 to f1fc762 Compare February 24, 2026 21:15
Remove socket-based internet connectivity probes (1.1.1.1/8.8.8.8 every
10s) that caused false negatives. Replace with an explicit offline mode
toggled via --offline CLI flag, EXO_OFFLINE env var, or macOS app settings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@AlexCheema AlexCheema force-pushed the alexcheema/replace-internet-checks-with-offline-mode branch from f1fc762 to e859593 Compare February 24, 2026 21:16
Comment thread src/exo/download/coordinator.py
Copy link
Copy Markdown
Contributor

@JakeHillion JakeHillion left a comment

Choose a reason for hiding this comment

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

Looks okay, one comment about missing a bit of cleanup

Copy link
Copy Markdown
Collaborator

@rltakashige rltakashige left a comment

Choose a reason for hiding this comment

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

Image

@AlexCheema AlexCheema merged commit 7660893 into main Feb 24, 2026
7 checks passed
@AlexCheema AlexCheema deleted the alexcheema/replace-internet-checks-with-offline-mode branch February 24, 2026 21:36
adurham pushed a commit to adurham/exo that referenced this pull request Feb 27, 2026
…plore#1615)

The socket-based internet connectivity probes (connecting to
1.1.1.1/8.8.8.8/1.0.0.1 every 10 seconds) are flaky — they produce false
negatives on some networks/ISPs, causing downloads to silently fail or
get stuck. Instead of dynamically detecting connectivity, this replaces
it with an explicit offline mode that the user opts into.

- **Removed internet check infrastructure**: Deleted
`_test_internet_connection()` (socket probes) and
`_check_internet_connection()` (10s polling loop) from
`DownloadCoordinator`
- **Renamed `internet_connection` → `offline`** on `ShardDownloader`
base class and all subclasses (`SingletonShardDownloader`,
`CachedShardDownloader`, `ResumableShardDownloader`)
- **Removed `on_connection_lost` callbacks** from download calls — no
longer needed without dynamic connectivity detection
- **Added `EXO_OFFLINE` env var support** in `constants.py` and `Args`
default in `main.py`
- **Added Offline Mode toggle** to macOS app Settings → General tab,
which sets `EXO_OFFLINE=true` in the process environment and restarts

The download behavior (`skip_internet` conditionals in
`download_utils.py`) is unchanged — we just changed what drives it.
Instead of a flaky socket probe setting
`internet_connection=True/False`, the user explicitly sets offline mode
via:
1. `--offline` CLI flag
2. `EXO_OFFLINE=true` environment variable
3. macOS app Settings → General → Offline Mode toggle

This is more reliable and predictable. Users on flaky networks no longer
get intermittent download failures.

- `uv run exo --offline` starts without internet checks, rejects
downloads for unavailable models
- `EXO_OFFLINE=true uv run exo` behaves identically
- macOS app Settings toggle persists across restarts and passes env var
to the exo process

- All existing tests pass (222 passed), including 8 offline-mode
specific tests
- `uv run basedpyright` — 0 errors
- `uv run ruff check` — all checks passed
- `nix fmt` — 0 files changed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

3 participants