Skip to content

fix: retry forester epoch processing failures - #2388

Open
sergeytimoshin wants to merge 1 commit into
mainfrom
fix/forester-epoch-rpc-retry
Open

fix: retry forester epoch processing failures#2388
sergeytimoshin wants to merge 1 commit into
mainfrom
fix/forester-epoch-rpc-retry

Conversation

@sergeytimoshin

Copy link
Copy Markdown
Contributor

Summary

  • retry epoch processing after transient RPC/provider failures
  • use exponential backoff from 2 seconds up to a 60-second cap
  • stop retries after the epoch report-work deadline and emit retry/recovery events

Root cause

The epoch monitor emits each epoch once. If process_epoch failed during that one attempt—for example, when the RPC provider returned HTTP 500—the spawned task exited and the forester never built that epoch's schedule. Processing remained stuck until the process was restarted.

Impact

Foresters now recover automatically from transient failures during epoch setup instead of silently remaining inactive for the rest of the epoch. Retry tasks are bounded by the report-work deadline.

Validation

  • cargo test -p forester test_epoch_processing_retry_delay_is_exponential_and_capped --lib
  • cargo check -p forester
  • git diff --check

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 1dfc1705-47f4-4653-9280-ad1a3adfb02f

📥 Commits

Reviewing files that changed from the base of the PR and between ad5964f and 3ed4560.

📒 Files selected for processing (1)
  • forester/src/epoch_manager.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sergeytimoshin sergeytimoshin changed the title fix(forester): retry epoch processing failures fix: retry forester epoch processing failures Sep 8, 2026
@sergeytimoshin
sergeytimoshin marked this pull request as ready for review September 8, 2026 12:12
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-08T12:16:23.587707Z 3ed4560 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ed45606c4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

error = ?error,
"Epoch processing failed; retrying"
);
sleep(retry_delay).await;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Bound the backoff by the report-work deadline

When an attempt fails with less than retry_delay remaining in the report-work phase—for example, a transient report_work_onchain failure—the unconditional sleep can carry the task past phases.report_work.end. The subsequent process_epoch call then skips the on-chain report and returns Ok(()), so the retry loop logs recovery even though has_reported_work remains false and the epoch's work is omitted from total_work. Cap the sleep to the remaining phase time or otherwise prevent a post-deadline attempt from being treated as successful.

Useful? React with 👍 / 👎.

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