Skip to content

fetch: exit non-zero when behind and no download landed - #11

Merged
mindrunner merged 1 commit into
mainfrom
cm-fetch-exit-nonzero-when-behind
Nov 5, 2026
Merged

mindrunner merged 1 commit into
mainfrom
cm-fetch-exit-nonzero-when-behind

Conversation

@mindrunner

@mindrunner mindrunner commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

On 2026-10-06 wt-2 ran cm fetch as ExecStartPre. Every full plan failed, the cycle logged no download plan succeeded this cycle reason="behind", then fetch complete: no download needed, and exited 0. Firedancer booted from a snapshot about 1.5M slots behind and never caught up.

fetch_if_needed now returns a FetchOutcome (Downloaded, NotNeeded, NoPeers, Unresolved(reason)) instead of a bool. cm fetch exits non-zero on:

  • Unresolved(behind): bootstrap at least min_slots_behind behind the best peer and nothing landed, including the "behind, but no worthwhile plan" case
  • Unresolved(bootstrap): no usable local snapshot, including no local snapshot with nothing on offer
  • NoPeers

A failed top-up within tolerance still exits 0 with its own log line. The daemon auto-fetch loop is unchanged in behavior.

The sample cm.service now runs ExecStartPre=-cm fetch, so a failed fetch does not stop the daemon from serving. The deployed rpc-infrastructure unit has no fetch ExecStartPre.

Tests: two regressions in tests/download_test.rs (behind with every plan failing on checksum, and empty local plus empty peer). cargo fmt --check, cargo clippy -- -D warnings, and cargo test pass locally.

Copy link
Copy Markdown
Owner Author

@mindrunner
mindrunner marked this pull request as ready for review November 5, 2026 10:33
@mindrunner
mindrunner merged commit a9007d8 into main Nov 5, 2026
5 checks passed
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