Skip to content

safety(continuous): pool-epoch listener liveness metrics#557

Open
julio4 wants to merge 1 commit into
mainfrom
feat/pool-epoch-liveness-metrics
Open

safety(continuous): pool-epoch listener liveness metrics#557
julio4 wants to merge 1 commit into
mainfrom
feat/pool-epoch-liveness-metrics

Conversation

@julio4

@julio4 julio4 commented Jul 10, 2026

Copy link
Copy Markdown
Member

Adds pool_change_epoch gauge + pool_epoch_listener_exit counter so we can detect dead pool-change listener from a genuinely idle pool. A dead listener could silently degrades continuous candidate gating.

Copilot AI review requested due to automatic review settings July 10, 2026 09:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds liveness-oriented metrics around the continuous-build pool-change listener so operators can distinguish “no new pending txs” from “listener is no longer running,” which would otherwise silently freeze continuous candidate gating behavior.

Changes:

  • Added pool_change_epoch (gauge) and pool_epoch_listener_exit (counter) to OpRBuilderMetrics.
  • Updated the pending-tx listener task to publish the current epoch to the gauge and increment/log on listener exit (including panics via catch_unwind).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
crates/op-rbuilder/src/metrics.rs Adds new gauge/counter fields for pool-epoch listener liveness/exit detection.
crates/op-rbuilder/src/builder/service.rs Instruments the pool pending-tx listener to update the epoch gauge and record exits.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +201 to +203
/// Current value of the continuous-build pool-change epoch counter.
/// A flatlined gauge on a dashboard means the pool listener died, not
/// that the pool is idle.
Comment on lines +134 to +140
let _ = std::panic::AssertUnwindSafe(listen).catch_unwind().await;
listener_metrics.pool_epoch_listener_exit.increment(1);
warn!(
target: "payload_builder",
"Pool epoch listener exited (channel closed or task panicked); \
continuous candidate gating is now frozen and will degrade to idle-backoff"
);
@julio4
julio4 enabled auto-merge (squash) July 10, 2026 10:14
listener_metrics.pool_change_epoch.set(epoch as f64);
}
};
let _ = std::panic::AssertUnwindSafe(listen).catch_unwind().await;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do you need to catch panics for this?

@julio4 julio4 Jul 13, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The counter is an alert signal, without catching panic we would skip it and miss alert.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I mean have you been seeing anything to motivate tracking this? This closure is very simple so I don't see the need to catch a panic here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I would like to move all this pool logic somewhere else, so from the builder service I consider this closure like a black box even if it is very simple (at the moment).

Now if the pool listener panic for whatever reason we can't tell anything from the builder service, and can't make the difference between an empty pool or a panicked one. But totally agree that in the current shape this seems useless, I can always add this later with more changes that justify this if needed.

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