…dow rollup
The window governance counters (blocked_budget, blocked_policy, failed)
were incremented inside the per-workflow loop, so a run whose workflow_id
is no longer in the config (a pilot deleted/renamed while its historical
runs remain) was never counted — while the all-time counters, tallied in a
per-run pass with no workflow lookup, DO count it. So for an in-window
incident on a since-deleted workflow the window counter read 0 while the
all-time counter read 1, breaking the documented "_all is a superset of the
window" relationship and understating the window's governance posture.
Add a small pass over the window runs for workflows absent from the config,
classifying their blocks/failures the same way. Runs of known workflows are
already tallied above, so the pass is disjoint — no double counting, and no
change for any org whose runs all belong to current workflows.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bug
The window governance counters and the all-time counters disagreed for a workflow that had been deleted/renamed in config while its historical runs remained in the store. For an in-window budget block on such an orphaned
workflow_id:governance.blocked_budget(window) = 0governance.blocked_budget_all= 1The
_allcounters are documented as a superset ("since the beginning, so old incidents stay visible"), so the window counter reading 0 while_allreads 1 for an incident that is in the window is internally inconsistent and understates the window's governance posture.Root cause
The window counters (
blocked_budget/blocked_policy/failed) are incremented inside thefor workflow_id, workflow in org.workflows.items()loop, so a run whoseworkflow_idisn't a current workflow is never seen. The_allcounters are tallied in a per-run pass with no workflow lookup, so they include orphaned runs.Fix
After the per-workflow loop, a small pass over the window runs whose
workflow_idis absent from the config classifies their blocks/failures the same way (budget vs policy, and failed). Runs of known workflows were already tallied in the loop above, so the pass is disjoint — no double counting.Because every run in a normal org belongs to a current workflow, this changes nothing for existing orgs (verified: the full suite and the deterministic demo are unaffected); it only surfaces incidents that were previously dropped.
Test
test_window_governance_counts_orphaned_workflow_incidents: seeds a budget block, a policy block, and a failed run for adeleted-wfin the window, then asserts each window counter now equals its all-time counterpart. Fails onmain(window=0, all=1), passes with the fix.Full suite: 177 passed, 92.74% coverage (gate 85%);
ruffclean; offlineflightdeck demo+audit verifyintact.Found by an autonomous
bughuntiteration.