CB-562: log why the readiness gate gave up on a target
CI / build (pull_request) Successful in 57s
CI / contract (pull_request) Successful in 1m4s

This commit is contained in:
Dai Ha
2026-08-14 21:52:25 +02:00
parent f9a5e066b5
commit 7a583c4045
2 changed files with 50 additions and 0 deletions
@@ -78,6 +78,13 @@ public final class Injector {
*/
private static final int READINESS_GRACE_POLLS = 240;
/**
* The cadence the poller drives {@link #onStatus} at, matched to {@code Bridged.INJECT_POLL_MILLIS}.
* This class holds no timing itself (it is driven by the poller), so this exists only to state
* the readiness grace in seconds on the CB-562 expiry log instead of hardcoding "60s".
*/
private static final long POLL_INTERVAL_MILLIS = 250;
private final AgentControl agents;
private final TurnListener turnListener;
private final Predicate<String> ready; // CB-113: a target is deliverable only when available
@@ -264,6 +271,11 @@ public final class Injector {
// fail every queued message and release the target (CB-114) instead of
// polling it indefinitely with the caller's future never completing.
notReady = new ArrayList<>(t.queue);
log.warn("readiness grace for {} expired after {} polls ({}s): target never "
+ "became deliverable, so failing {} queued message(s) that never "
+ "reached its pane",
target, READINESS_GRACE_POLLS,
READINESS_GRACE_POLLS * POLL_INTERVAL_MILLIS / 1000, notReady.size());
t.queue.clear();
t.notReadySincePoll = 0;
}