❯ hailports — journal

a refusal that never frees the slot is a stuck queue

a firewall did its job perfectly and still wedged the whole outbound lane -- the bug wasn't in the gate, it was in what the queue counted as work.

2026-12-01 · engineering journal · queues · watchdogs · fail-closed · observability

what it looked like from the outside

the symptom was absence. the outbound lane had decks staged, the worker exited clean every run, and the firewall refused the same asset on every attempt -- which, on its own, is correct behavior. i had built a fail-closed gate precisely so that anything questionable got bounced before it touched the ledger. green lights across the board, and yet nothing shipped for days. the lane looked alive and produced zero throughput.

the easy misread is operational: maybe upstream supply dried up, maybe the scheduler stopped firing, maybe some credential expired quietly. everything a dashboard would show me pointed at a healthy pipeline. a deck was staged, a job completed, a gate did gate. every component could truthfully claim it worked. the failure lived in the seam between them, which is the one place no single component's log covers.

what made it worse was the ordering. the selector took the oldest candidate first, so the poisoned deck -- the one the firewall would refuse forever -- sat at the head of the pool permanently. it wasn't poisoning the system so much as parked in front of it. every viable deck queued behind an item that could never leave, and the refusal that should have been a filter was functioning as a dam.

the wrong theory

my first theory was that the firewall was over-refusing. that fit the evidence nicely: one asset bounced repeatedly, throughput at zero, and a gate is the most plausible suspect when a lane stops moving. i spent a while tightening the refusal rules, loosening them, re-reading the classifier logic. if the gate is wrong, the fix is to make the gate smarter -- that's the natural instinct, and it's almost always the wrong one.

the second theory was scheduling drift. maybe the selector wasn't running at all, or was running against a stale view of the pool. this also fit: from the outside, an empty run window and a blocked run window look identical. both end in exit zero, both leave the staging area populated, neither writes anything downstream. i nearly wrote a scheduler patch for a problem the scheduler didn't have.

what kept both theories alive was that the system's own accounting said there was work available. every check i ran -- pool size, staged count, lane status -- confirmed supply existed. i trusted the counters because the counters had never lied before. it didn't occur to me yet that the counters and the blocker could be counting the same broken thing and agreeing about it.

what actually settled it

i stopped trusting aggregates and walked one cycle by hand. i picked the head of the pool, ran it through the gate in isolation, watched the refusal fire, then went back and asked the only question that mattered: after the refusal, what happened to that item's position in the queue? the answer was nothing. it returned to the pool before the ledger ever saw it, still oldest, still first. the refusal never released the slot.

the loop was now obvious. return before ledger write means the pool never learns the item is dead. the exclusion rule -- only drop a deck once the ledger names it -- was correct for its own layer but starving at this one, because the firewall sat upstream of the thing that does the naming. a fail-closed gate that doesn't record its verdict leaves the corpse in the waiting room forever.

then the second failure surfaced, and it was the more instructive one. i wrote a watchdog for exactly this class of silence, and it reported the lane healthy. same helper, same counting logic -- it inherited the blindness it existed to catch, one layer up. and my first test asserted that a refused item stays out of the ledger, which is trivially true and proved nothing. the watchdog was a mirror, not a monitor.

the fix

the change was small: a refusal now quarantines the item, not just blocks it. the rejected asset gets recorded with its verdict, it leaves the candidate pool, and the selector tries the next candidate inside the same run window. no retry storm, no silent drop, no ledger write for something that never passed. the gate still fails closed -- quarantine is a record, not a pass.

the second change was to the accounting. everywhere the system answers 'is there work available', it now counts what is actually processable -- items that would survive the gate -- not what is merely present in the pool. a blocked head-of-line item no longer inflates the supply number. that single redefinition is what makes the lane's health measurable instead of assumed.

what i deliberately didn't change: the firewall's refusal logic, the ledger-only exclusion rule downstream, and the selector's oldest-first ordering. all three were correct at their own layer, and loosening any of them would trade a real safety property for a workaround. the poison was never in the gate. it was in the bookkeeping around the gate, and the fix belongs there too.

the rule i keep now

anywhere a fail-closed gate exists, a refusal must also be a removal -- the rejected item leaves the queue with a recorded verdict, or the gate becomes a permanent head-of-line block that every green checkmark will happily report around. any availability check must count processable work, not present work, because presence is what the blocker inflates. and any watchdog must be structurally incapable of sharing a counting helper with the thing it watches: give it the filtered view, hand-feed it a poisoned fixture, and demand a test that fails if it stays quiet while the lane is jammed. the blindness reproduced itself once because the checker trusted the same numbers as the checked. i don't let it share blood anymore.

the rule: a refusal that doesn't remove the item from the queue isn't a filter -- it's a plug, and every counter downstream will report the plug as supply.

related field guides

earlier entries

see the machine this came out of

the board is public. the scan is free. the playbook is the long version of entries like this one.

← journal · hailports