Skip to content

devtool: complete raced round initialization fix - #3995

Open
j0sh wants to merge 2 commits into
masterfrom
ja/devtool-round-init
Open

devtool: complete raced round initialization fix#3995
j0sh wants to merge 2 commits into
masterfrom
ja/devtool-round-init

Conversation

@j0sh

@j0sh j0sh commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

The prior fix in #3970 only handled transactions that reverted after submission. Also tolerate initializeRound failures during gas estimation when another initializer has already completed the round.

Attempts to fix the sporadic e2e test failures during CI

Summary by CodeRabbit

  • Bug Fixes
    • Improved round initialization handling when a round is already initialized.
    • Initialization now succeeds gracefully in cases where the transaction fails during gas estimation or after mining, while preserving genuine errors.
    • Added clearer diagnostic logging for initialization failures.

The prior fix in #3970 only handled transactions that reverted after
submission. Also tolerate initializeRound failures during gas estimation when
another initializer has already completed the round.
@j0sh
j0sh requested a review from rickstaa July 22, 2026 18:59
@github-actions github-actions Bot added the go Pull requests that update Go code label Jul 22, 2026
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

InitializeRound now centralizes handling of initialization failures, treating them as successful when the round is already initialized and preserving the original error otherwise.

Changes

Round initialization handling

Layer / File(s) Summary
Centralize initialization race handling
cmd/devtool/devtool/devtool_utils.go
InitializeRound routes initialization and CheckTx failures through tolerateInitializedRound, which rechecks round state, logs follow-up errors, and returns success only when initialization is confirmed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • livepeer/go-livepeer#3970: Updates the same InitializeRound flow to tolerate failed initialization transactions when the round is already initialized.

Suggested reviewers: rickstaa

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: finishing the raced round initialization fix in devtool.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ja/devtool-round-init

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.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
cmd/devtool/devtool/devtool_utils.go (1)

298-312: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Add focused coverage for both race windows.

Test tolerateInitializedRound when the round is initialized, not initialized, and when the state check fails; also exercise both InitializeRound and CheckTx callers. This protects the CI-flake fix and verifies original errors remain preserved.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/devtool/devtool/devtool_utils.go` around lines 298 - 312, add focused
tests for tolerateInitializedRound covering initialized, not initialized, and
CurrentRoundInitialized failure cases, asserting successful suppression or
preservation of the original initialization error as appropriate. Also exercise
both InitializeRound and CheckTx callers to cover each race window and verify
their original errors remain intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@cmd/devtool/devtool/devtool_utils.go`:
- Around line 298-312: add focused tests for tolerateInitializedRound covering
initialized, not initialized, and CurrentRoundInitialized failure cases,
asserting successful suppression or preservation of the original initialization
error as appropriate. Also exercise both InitializeRound and CheckTx callers to
cover each race window and verify their original errors remain intact.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4c10966a-050b-4a59-8cf8-a89092f6bfdf

📥 Commits

Reviewing files that changed from the base of the PR and between 8956155 and f78ac14.

📒 Files selected for processing (1)
  • cmd/devtool/devtool/devtool_utils.go

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 35.41977%. Comparing base (8956155) to head (f78ac14).

Files with missing lines Patch % Lines
cmd/devtool/devtool/devtool_utils.go 0.00000% 11 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##              master       #3995         +/-   ##
===================================================
- Coverage   35.42499%   35.41977%   -0.00522%     
===================================================
  Files            174         174                 
  Lines          45036       45037          +1     
===================================================
- Hits           15954       15952          -2     
- Misses         27825       27827          +2     
- Partials        1257        1258          +1     
Files with missing lines Coverage Δ
cmd/devtool/devtool/devtool_utils.go 0.00000% <0.00000%> (ø)

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8956155...f78ac14. Read the comment docs.

Files with missing lines Coverage Δ
cmd/devtool/devtool/devtool_utils.go 0.00000% <0.00000%> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@j0sh
j0sh enabled auto-merge (squash) July 22, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant