fleetd #480 Unit E: BLOCKED is not a settled turn boundary #484
Reference in New Issue
Block a user
Delete Branch "worker/480-e-blocked-is-not-settled-e3d8e7-7"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
LeadRollover.waitUntilInjectable used AgentStatus#injectable(), which accepts BLOCKED. A BLOCKED pane is a live turn paused on a prompt (e.g. an approval), not a settled turn. Reusing injectable() as the safety gate let /clear (or bootstrapText after it) fire into an open prompt within the turnSettleSeconds/clearSettleSeconds window, destroying the lead's live context — exactly the failure the gate exists to prevent.
Fix
Tests added (LeadRolloverTest)
Mutation proof (ticket-mandated)
git show HEAD:fleetd/src/main/java/dev/ltms/fleet/lead/LeadRollover.java | grep -c "status != null && status.injectable()"= 1.if (status != null && status.injectable())in place of the IDLE/DONE check.grep -n "status != null && status.injectable()"found it present;grep -c "status == AgentStatus.IDLE || status == AgentStatus.DONE"= 0 (fixed line gone).mvn -o test -Dtest=LeadRolloverTest: 2 failures, exactly the two new tests:All other 15 tests still passed against the mutant, as expected (they don't exercise BLOCKED).
git checkout --reverted to the pre-fix HEAD; re-applied the real fix from a saved backup) and confirmedgit status --porcelainwas clean before staging/committing.Build
mvn clean installfrom the fleetd module: BUILD SUCCESS, Tests run: 1654, Failures: 0, Errors: 0, Skipped: 0.Out of scope (reported, not fixed per ticket instructions)
Checked every other call site of AgentStatus#injectable() in fleetd/src/main/java: LeadCoordLoop, LeadHeartbeatLoop, ReplyPushLoop, Injector, and HerdrPeerLauncher's two spawn-readiness checks. All six are message-delivery gates asking "may I inject now", which is exactly what injectable() is for (queuing behind BLOCKED is safe for delivery). None of them need a turn-boundary rule instead.