Select alert work within the team's response capacity
In brief
Limit discretionary alerts to the work each owner has time to handle.
- Subtract existing commitments and leave room for interruptions before admitting new cases.
- Give deferred cases a review date and retain the time they first qualified.
A rule can find forty valid account-review cases while the account owner has time for six. Sending all forty transfers the selection problem to the recipient, usually without recording why the other thirty-four received no attention.
For discretionary business alerts, we’d admit work against an effort budget set for each owner and planning period. Keep the other eligible cases with a deferral reason and review date. The budget includes work already accepted and leaves room for interruptions and estimate error.
This policy fits tasks such as account reviews or sales follow-ups, where timing counts but some work can wait.
Safety incidents and mandatory obligations need an escalation path for when capacity runs out. They can’t disappear behind a daily notification limit.
Start with the time the workflow can use
Ask the people doing the work how much time they can give the next planning period. Subtract the estimated remaining effort for cases already accepted, including follow-ups. Then keep a reserve for interruptions and estimate error.
Suppose Pat has 90 minutes available today, 30 minutes of accepted follow-ups, and a 15-minute reserve. New cases get an estimated 45 minutes. Kim has 60 minutes available, 20 committed, and a 10-minute reserve, leaving 30.
A global limit of five alerts would miss the difference between their workloads. So would a count-only limit when one case takes five minutes and another needs a call, an investigation, and a writeback. Overload is easier to see when you measure the work in task queues, beyond page counts.
Estimate the next meaningful unit of work.
Take a case with a five-minute triage followed by a possible hour of investigation. Budget the triage separately. Make accepting the larger task its own decision. Don’t label the whole case “five minutes” because that’s how long opening the message takes.
Define the order before applying the budget
Order cases by a small number of explained priority classes, then the time each case first became eligible, then its stable identifier. Keep that first-eligible time when a deferred case reappears. Otherwise every detector run makes old work look new.
Eligibility comes first: the signal has usable evidence, the action is still meaningful, and the case isn’t already open, closed, or suppressed under another policy. Capacity selection receives one current record per case, with duplicate identity and detector correctness settled before it runs.
Within the chosen order, admit a case if its estimated effort fits its owner’s remaining budget. If it doesn’t fit, keep it as deferred and move on to later cases.
Pat might accept case A at 25 minutes, defer B at 25, and accept C at 15. That commits 40 of Pat’s 45 available minutes. Kim can independently accept a 20-minute case.
This priority policy can leave capacity unused, and it doesn’t try to maximize saved revenue. Maximizing total value under a size limit is the knapsack problem. An optimizer for it would need defensible values, trustworthy effort estimates, and agreement that its objective matches the business. A severity score isn’t automatically an estimate of what intervening is worth.
Make the allocation repeatable
The following TypeScript function models one allocation snapshot. Its inputs are validated case records with integer UTC timestamps, positive integer effort estimates, and lower numeric priorities for more important work. Budgets hold the minutes left after existing commitments and reserve. It returns decisions without sending messages or changing storage.
type Case = Readonly<{
caseId: string;
owner: string;
priority: number;
firstEligible: number;
expiresAt: number;
minutes: number;
mandatory?: boolean;
}>;
function allocate(cases: readonly Case[], budgets: ReadonlyMap<string, number>, now: number) {
if ([...budgets.values()].some((v) => !Number.isSafeInteger(v) || v < 0)) {
throw new Error('Budgets must be nonnegative integer minutes');
}
if (new Set(cases.map((c) => c.caseId)).size !== cases.length) {
throw new Error('One current record per case is required');
}
if (cases.some((c) => !Number.isSafeInteger(c.minutes) || c.minutes <= 0)) {
throw new Error('Effort must be positive integer minutes');
}
const remaining = new Map(budgets);
const decisions: Array<[caseId: string, reason: string]> = [];
const ordered = [...cases].sort(
(a, b) =>
a.priority - b.priority ||
a.firstEligible - b.firstEligible ||
(a.caseId < b.caseId ? -1 : a.caseId > b.caseId ? 1 : 0),
);
for (const c of ordered) {
const available = remaining.get(c.owner);
let reason: string;
if (c.mandatory) {
reason = 'escalate_mandatory';
} else if (c.expiresAt <= now) {
reason = 'expired';
} else if (available === undefined) {
reason = 'needs_owner_capacity';
} else if (c.minutes > available) {
reason = 'deferred_capacity';
} else {
remaining.set(c.owner, available - c.minutes);
reason = 'admitted';
}
decisions.push([c.caseId, reason]);
}
return { decisions, remaining };
}Mandatory cases come back as escalate_mandatory for a separate escalation policy, even if their ordinary action window has passed. The caller must persist and route that outcome. A case whose owner has no budget comes back as needs_owner_capacity. Expired discretionary cases stay visible as expired instead of consuming current capacity.
People covering for each other still have individual capacity limits. Assignment models with task sizes give each worker a capacity of their own. Our simpler function keeps the existing owner. Reassigning a case to another person means checking their skill, authority, and available time first.
Reserve capacity when work is accepted
The pure function isn’t the concurrency boundary.
Two schedulers can read the same 45 available minutes and both admit 40. A retry can reserve the same case twice unless acceptance has a durable identity.
For a small PostgreSQL-backed workflow, keep one budget record per owner and period. In a short transaction, lock the budget records involved in a consistent order and read their current commitments. Check that each candidate is still eligible, then persist admitted cases with their reserved estimates. Store the run’s identifier and policy version. A repeated request for the same run should then return its persisted decisions instead of calculating another batch.
In PostgreSQL, row locks persist until the transaction ends. Every writer that changes those commitments has to go through the same budget record. A row lock only holds back processes that try to take it.
Create durable delivery work in that acceptance transaction and send it afterward. If the email fails, retry it from that delivery record. The case is already admitted.
Release a reservation only through a recorded cancellation or revised estimate. At the next period boundary, carry forward the remaining effort for unfinished work before admitting new cases.
Recheck the action window and current routing before delivery. If accepted work becomes obsolete during an outage, record that outcome and reconcile its reservation.
Prevent deferred work from aging forever
Skipping a case that doesn’t fit lets smaller work proceed. It can also keep a large case waiting indefinitely. Review the oldest deferred cases separately from today’s admitted list, with their expiry and estimated effort visible.
Choose a concrete escalation condition with the business owner, such as reaching a specified age or having too little time left to act. The decision might reserve a larger block tomorrow or split off a triage step that’s worth doing on its own. It might also route the case to a qualified backup, or decline it with a recorded reason. Raising its priority won’t help if it never fits any budget.
Keep deferral distinct from rejection.
A case awaiting capacity should be reconsidered under current evidence and its original waiting time. If the evidence no longer supports action, close it with that reason. If its action window passes, record that it expired without action. Neither outcome counts as completed work.
Effort estimates need correction too: if a class routinely takes twice the estimated time, its healthy-looking admission totals hide overload. Adjust the estimate for future allocations and update accepted commitments where the remaining work is known. Don’t use estimated minutes as a worker productivity score.
Inspect the work the policy leaves behind
Track admitted and deferred counts by owner and priority, estimated versus observed handling effort, the age of deferred cases, and cases that expire before action.
Include accepted work waiting on someone else. It can return as a follow-up even while the recipient’s inbox looks quiet.
A fixed daily cap can make the delivered volume look stable while the deferred population grows every day. If estimated arrivals repeatedly exceed sustainable completion, change the scope, the effort required, or the available capacity.
Before enabling delivery, replay a synthetic allocation with unequal owner budgets, duplicate IDs, missing owners, oversized tasks, expired cases, and equal-priority ties. Reorder the input and check that the decisions don’t change.
Then simulate two schedulers using one stale budget snapshot: the unsafe version should oversubscribe, while the persistence implementation must serialize acceptance. Finally, review a week of real deferred cases with the owners before treating the priority classes as settled.
More in this domain: Automation
Browse allTest whether acting on an alert changes the outcome
Test an optional alert by randomly assigning eligible accounts to the new workflow or to current practice.
Alert configuration should control business behavior, not system structure
Give business owners configuration for alert thresholds, wording, schedules, and routing.
Data-Driven Alerts: System Breakdown
Use a data-driven alert when someone can act on a business condition in time to change the outcome.
Deduplication, cooldowns, and expiry in operational alerting
Give each alert a stable case ID so repeated detection respects work already in progress.
Related patterns
An alert is not a notification
Send a notification when awareness is enough. Create an operational alert when someone owns a decision.
Why alert feedback should be structured first
Collect a structured response first and leave room for an optional note.
Give Cloud Run health probes a recovery policy
Match each Cloud Run health probe to a recovery action.
Plan regional recovery for a single-region service
Rehearse a full restore outside the primary region. Consider a warm standby if restoration can't meet the recovery time or data-loss target.