Est.
ObservabilityLong read

Procurement Criteria for Pull Request Hold Mechanisms Anchored to Live Error Rate and Latency Budgets

Turn PR gate requirements into measurable acceptance tests.

· 8 min read
Cover illustration for “Procurement Criteria for Pull Request Hold Mechanisms Anchored to Live Error Rate and Latency Budgets”
Observability · November 26, 2026 · 8 min read · 1,895 words

A pull request hold mechanism anchored to live error rates and latency budgets is a systems-engineering procurement decision. A binding gate must account for concurrent work, enforce separate budgets, detect tail degradation, and refuse unsafe admission. Those properties must become measurable acceptance targets before the tool enters the pipeline.

Why PR admission gates fail under concurrent load

A point-in-time budget check cannot account for work whose cost has not yet been recorded. A model call’s actual cost remains unknown until completion, so concurrent calls can each see the same available balance and pass individually. The balance is already spoken for, but invisibly. As concurrency and call duration grow, more unrecorded commitments can accumulate behind the check.

Tempr’s concurrency analysis identifies this as the central flaw in checking before dispatch and charging only at completion. Each request can pass the check while the workload as a whole goes over the limit. Latency monitoring has a related blind spot. A merge-time check against a rolling measurement can miss slow calls still in flight, allowing a burst to push the tail beyond the budget before the gate reacts. A procurement candidate that leaves these commitments invisible cannot serve as a binding admission gate.

What worst-case reservation actually requires from a hold mechanism

Worst-case reservation makes each commitment visible before dispatch. The mechanism must reserve the request’s maximum cost against the shared budget, retain that hold throughout execution, and release it only when actual cost is recorded. A soft budget may report an overrun, but that is a different contract.

Tempr describes a lock-free sequence that writes the hold first, sums every live hold including the new one, and withdraws the hold and refuses the request if the total exceeds the limit. Two requests competing for the last available room can therefore both be refused. The acceptance target favors occasional over-refusal over overspend.

The reservation must also have defensible inputs. Worst-case output uses declared max_tokens, or a capped model maximum when it is absent, while input accounting includes every character in messages, the system prompt, and tool definitions at the more conservative token-per-character ratio. Cached input is priced as uncached. Evaluators should require agents to declare max_tokens or accept conservative holds, and require per-request latency contributions to be tracked with the in-flight set.

The design described here has a stream-close gap of a few milliseconds when neither the hold nor actual cost appears in the budget. Vendors must disclose that bounded exposure rather than equate reservation with an unconditional guarantee. The concurrent-load test must demonstrate prevention of overshoot.

Per-tier budget allocation as a first-class design decision

A global budget mixes workloads with different cost and latency profiles. Without separate allocations, a well-behaved tier can lose its available capacity to another tier’s overruns. Procurement criteria should require configurable hard limits and independent reservation pools without raising one tier’s limit to accommodate another’s load.

Rule selection is part of that enforcement contract. When there are tenant, application, and pipeline-scoped budget rows, the most specific matching rule should apply before broker dispatch. The payswapdotorg/YOU PR implements pre-dispatch budget checks with a typed error envelope for over-budget submissions. No durable job is created, and the job is marked failed.

Strict reservation has its own operating cost. Setting and releasing a hold each requires a write, which can become significant for pipelines with many short requests. Tempr makes strict mode opt-in per budget for that reason. A candidate should expose equivalent selectivity so evaluators can scope the overhead to the tiers that require it, without weakening those tiers’ limits.

How to specify tail-latency behaviour as a testable budget criterion

A defensible latency criterion names the measurement point, percentile, and threshold-setting method. Tracking only the median can hide slow requests getting slower, including when a vendor change moves p95 while p50 stays the same. The two measurements serve different purposes here. Both should be visible, but the latency budget should operate on p95.

Declared SLOs must name the points to measure, such as api.read at p95, live.session.setup, or live.state.stream. Each SLO should make its measured p50 and p95 values and lifetime breach counters available through a metrics endpoint. Teams set their own thresholds from those measurements. A latency value used by another system is not grounds for making it an acceptance target for every system.

Production criteria also need thresholds that adapt to changes in load, deployments, and time-of-day patterns. DDSketch offers O(1), constant-memory quantile estimation with relative-error guarantees of plus or minus one percent, so each host can be measured in real time with low overhead. Where the pipeline uses hedging, a token-bucket budget can cap it at a configurable percentage of traffic and stop load amplification when exhausted. The gate’s own latency overhead belongs in its CI acceptance test.

Vendor-update windows as a forcing function for tightened gates

AI pipelines face regressions that clean HTTP responses cannot reveal. A vendor can change a model without announcement, reducing output correctness or structured-output parse success while HTTP error rates remain flat. Error-budget definitions must include the output failures that the pipeline is meant to prevent, because transport success alone does not show that the pipeline is healthy.

For declared vendor-update windows, the candidate must support temporary tightening through configuration. The rolling measurement window becomes shorter, and the alert threshold moves from two standard deviations to one for that period. Defaults must come back automatically when the window closes. These settings describe a response mechanism adjustable to each workload.

Before go-live, teams must configure three response levels as a template fitted to their pipeline. Alert begins investigation when budget consumption exceeds baseline, fallback activation routes the primary model to a fallback while investigation continues, and rollback request calls for contacting the vendor to revert or freeze the update window. These responses cannot wait for incident-time improvisation. A candidate that cannot express them in configuration leaves a critical part of gate behavior unspecified.

CI job budget ceilings as hard acceptance criteria

The evaluator should reject a candidate that requires new CI jobs, increased time caps, or relaxed budget thresholds to accommodate its overhead. That constraint precedes functional evaluation. A gate that fits only after the pipeline’s limits change has not met the original acceptance contract.

The onepipeline-ui issue #738 provides a concrete model. Large-corpus journeys and large-run budgets must run inside the existing CI job on every pull request that affects projects with the measured paths. Existing thresholds and test assertions remain unchanged. Only a measured budget reading moving down is acceptable, so the engineering lever is reduced cost.

For an evaluation under that contract, measure every target’s uncached duration using the existing CI task selection and produce a job-time accounting. Check the whole job through the actual merge path. Local measurements from one node do not establish that the job fits. Where reductions are needed, the issue identifies shared corpora and servers, condition-based waits, removal of duplicate measurements, and parallelism that does not disturb timed measurements. It also points to a live-node-view server fold as a place to reduce CPU work by processing only what was appended.

Fail-closed defaults and what they mean as a procurement non-negotiable

For hard budgets, a mechanism that silently admits requests when its checks fail serves only as a monitor. A soft budget can email administrators when a limit is reached, but it does not block requests and therefore cannot provide fail-closed admission.

Reservation failure needs an explicit, tier-specific contract. If the reservation datastore is unavailable, the tool must refuse or fall back to an ordinary budget check. Tempr documents the ordinary-check fallback when setting a hold fails. That preserves a check, but not strict reservation under concurrency. Evaluators must require refusal for hard-budget tiers where the weaker fallback would invalidate the spending guarantee.

Fail-closed behavior must still work when the configuration changes. Raising a threshold, negotiating headroom, or moving a large-run test to a later stage disables the original gate for that change, even if the tool continues reporting success. The audit trail makes that distinction inspectable afterward. Budget configuration changes, threshold changes, and strict-mode changes must each record a timestamp and actor, so a breach can be evaluated against the policy actually in force.

Governance requirements when agents can trigger the gate directly

Machine principals need budget controls, credit assignment, and audit records just as human submitters do. Submission through an agent cannot become an exemption. Tempr explicitly applies strict holds to model calls from agent runs on its server as well as direct gateway requests, establishing the parity evaluators should require.

Role-based access control must support a separate allocation for each agent principal rather than silently drawing from a human team’s pool. Limit changes require a clear approval flow as well as an audit record. Interoperability must be testable as well. A downstream agent should be able to query current SLO state, budget consumption, and breach history through an MCP-compatible interface. Agents that can trigger campaign sends, pipeline jobs, or deployments also need upstream budget gates with rollback and access controls that are treated at least as seriously as production API keys.

The Letter Company, a computational marketing company whose coding agent operates growth primitives continuously, provides a relevant example of metered operations through per-token usage itemized in a line-by-line bill. Its API, MCP, and CLI interfaces make those primitives scriptable by developers or agents, illustrating the accounting visibility evaluators should seek when comparing in-flight spend exposure.

Turning the criteria into a testable acceptance checklist before a tool merges into CI

Diagram: The Seven-Step Acceptance Checklist. Visualizes: The article closes with a strict sequential acceptance procedure that must be followed in order, with each step being a gate before the next.

The acceptance procedure should run in the following order, with evidence recorded at each step. Run the candidate at the team’s observed peak concurrency. Require zero overshoot events, confirm refusal when reservations exceed the limit, and document an over-refusal rate within the team’s tolerance. Then configure independent hard limits for interactive, batch, and agent-submitted tiers, exhausting and releasing each pool separately without consuming another tier’s allocation.

Next, inject stragglers at the declared SLO measurement point. Require a p95 breach to trigger the configured response before p50 moves, while p50-only degradation must not produce a false positive for the p95 criterion. Simulate a vendor-update window and require automatic shortening of the measurement window, adjustment of the standard-deviation multiplier, and restoration of defaults. Check that the configuration change appears in the audit log without manual intervention being needed to tighten or restore the settings.

Then measure uncached target durations and gate overhead within the existing CI task selection. Produce the complete job-time accounting through the merge path, with every threshold unchanged. Induce reservation-datastore failure and test the fallback contract. No request may pass silently without a budget check, and hard-budget tiers must refuse where an ordinary check would break their strict-reservation guarantee.

Finally, change a threshold, toggle strict mode, and change an agent’s credit allocation. Require timestamped, actor-attributed records for all three events, queryable through the API. Send the same loads through human and agent principals and require the same strict-hold coverage for both. Test the agent’s ability to query budget state through the standard interface and confirm the approval flow for allocation changes.

Admit the tool only when every test passes. A failed criterion disqualifies it until remediation. The resulting pipeline follows the same discipline as metered, scriptable primitives, with one source of truth for commitments, measured outcomes, and authorized changes. That instrumentation lets engineering improvements compound instead of leaving the gate as a collection of ad-hoc checks.

Filed underObservability

More in Observability