Date: 2026-11-29
0.36.10.36.1async-bulkhead-llm@3.19.1async-bulkhead-ts@1.0.1vendor/async-bulkhead-llm-3.19.1.tgzvendor/async-bulkhead-ts-1.0.1.tgzvendor/yaml-2.9.0.tgzhttps://github.com/janbalangue/tyr-admission-controller.gitnode:24-alpineasync-bulkhead-llm@3.19.1 was published to npm on 2026-11-30 (UTC), before
this release was built. 0.36.1 moves Tyr from 3.18.0 to 3.19.1. Its changes
to Tyr's own source are the version constant, the way admission provenance
reads its limits, and one comment, described under Library update below.
Tyr's committed lockfile intentionally resolves the
exact bundled vendor/async-bulkhead-llm-3.19.1.tgz, so the Tyr build is
reproducible without the registry; the vendor artifact is not a substitute for
publishing the declared public package version.
npm run verify:vendor-provenance confirms the bundled tarball is
byte-identical to the published one.
3.18.2 and 3.19.0 fix bugs and change no public API. Between them they change when an admission is decided, what the queue-wait timing covers, how a progressive hold is capped, when a queued call leaves the queue and when a drain resolves. 3.19.1 changes only which files the tarball contains, described at the end of this section. Four checks cover what the update means for Tyr:
admit one microtask later.
0.36.0 read the limits in force when that event arrived. A new test in
test/pools-v311.test.ts starts a request at revision 1 and applies
revision 2 before the event. On 3.19.1 with the 0.36.0 code the test fails:
the pool counts one captureFailures and records no event. With this
release the event has limitRevision: 1, the limits of revision 1 and no
grant, and the next request has revision 2, its limits and its grant.test/progressive-reconciliation.test.ts reserves more than
the 256-token margin in total and 100 tokens for output, and holds 100
after its first usage report. The holds of three reservation shapes, read
after each of five usage reports, are the same on both builds.500, an unknown model, an observe-mode bypass, a borrowed slot
that outlived its 60 ms lease, a kill switch, a restore and a stale
revision through control.applyLimits, and a last request left running
for a bounded drain. The run recorded every reply with its admission
headers and body, /stats, /metrics, the 19 audit events, the applied
limits and the drain result: 1,811 values. Five pairs of runs showed no
difference in the 1,416 that were compared.The comparison leaves out the 395 values that differ between two runs of one build: admission ids, timestamps, the version string, the bucket and sum samples of the duration histograms (their counts are compared), and the retry hint, which is computed from wall-clock completion intervals.
The same script then made three pool-level checks where the two libraries are meant to differ, and they did:
concurrency_limit and the constraint
admission_class_protection. On 3.19.1 all four were admitted.maxConcurrent of 0 and nothing was running. The request timed out 40 ms
after it was queued. On 3.18.0 the drain was still pending 400 ms after it
started. On 3.19.1 it resolved.Not measured: the size of the timing shift. Over the five runs, the mean queue wait of an admitted request was 8.1 µs on 3.18.0 and 6.8 µs on 3.19.1, and the mean decision time 48.2 µs and 49.7 µs, from 70 admissions on each. The direction matches the change, but the runs were not built to measure it.
3.19.1 is a packaging release. The tarballs npm published for 3.18.0 through
3.19.0 contained files that were not part of the library's build: numbered
copies under dist/cjs/, such as adaptive 2.cjs. The 3.18.0 tarball that
Tyr vendored from 0.34.1 to 0.36.0 had four, and the 3.19.0 tarball had 28.
No file in the package referred to them, and Tyr imports the ESM build under
dist/esm/, which had none. The 3.19.1 tarball vendored here has 238 files
and none of the copies. It differs from the published 3.19.0 tarball in those
28 files, CHANGELOG.md and package.json; every other file is
byte-identical.
The image was built on the development Mac (Apple silicon) with Docker 29.8.0
and Buildx 0.37.1, for the platforms and with the attestation settings the
image CI job uses:
docker buildx build --no-cache --platform linux/amd64,linux/arm64 \
--sbom=true --provenance=mode=max \
-o type=oci,dest=tyr-0.36.0.oci.tar .
linux/amd64, an
image for linux/arm64, and an attestation manifest for each.tyr-admission-controller@0.36.0,
async-bulkhead-llm@3.18.0 and async-bulkhead-ts@1.0.1.node user on Node.js 24.22.3, the version
node:24-alpine resolved to at build time, and carry the
janbalangue/tyr-admission-controller source label.linux/arm64, for both target platforms.config/tyr.example.yaml mounted read-only, the container for
each platform answered GET /healthz with 200 and reported
tyr_build_info{version="0.36.0"} 1 on /metrics. The linux/amd64
container ran under emulation.Not verified: the image job on GitHub Actions, the push to the GitHub
Container Registry, and a pulled image. GitHub's runners emulate
linux/arm64, the reverse of this build. The job first runs when this release
is pushed, and the package it creates is private until it is made public.
The README's reference sections were moved into guides/ by a script that
copied each section and changed only its headings and links. Of the 1,444
content lines in the 0.35.0 README, 1,428 are unchanged in the new README or a
guide. The other 16 are the reworded opening, the two Node.js 20 statements,
the requirements list and the pointer to the changelog and roadmap, which the
new README states in its own sections.
npm run docs builds the TypeDoc site with no errors and no warnings.
TypeDoc's link validation covers the README and every document page and
reports no broken link.Logger in src/latchflo.ts, PoolState in
src/retry-hint.ts and AdvisoryStats in src/pools.ts. Before the
change the build reported one warning for each. The compiled
dist/latchflo.js, dist/retry-hint.js and dist/pools.js are
byte-identical before and after it; only their .d.ts files differ.EVALUATION.md,
CONTRIBUTING.md and SECURITY.md.EVALUATION.md, ROADMAP.md,
CHANGELOG.md, VERIFICATION.md, CONTRIBUTING.md and SECURITY.md, and
an API reference for 14 modules.Not verified: the site in a browser, the Docs workflow on GitHub Actions,
and the GitHub Pages deployment. The deploy job fails until Pages is enabled
for the repository with GitHub Actions as its source.
npm run verify:stop runs against the built dist/ and a stand-in provider.
It passes only if:
stop: { takeBackGraceMs: 0 } and leaves a running request above the new
limit stops nothing, /stats has no limits.stop, llm.stopped or
tyr.stop, and /metrics has no stop series;overrunAllowanceTokens: 50 reports
revision 100 with the policy applied. A streamed reply that reports 5,000
output tokens in mid-stream, against a 100-token output reservation, is cut
before its final event, the provider call is dropped, the audit event has
settlement: "stopped", stopCause: "overrun" and usage of 1 input and
5,000 output tokens, the pool's held tokens return to 0, and /stats and
/metrics each count one overrun stop;data: [DONE], is audited as completed with that usage, and stops
nothing;takeBackGraceMs: 40 and no configured revision starts at
revision 1. With two requests running, an update to maxConcurrent: 1
stops the request admitted second, no sooner than the grace period, with
503 admission_stopped, cause limits, the two stop headers and no retry
hint. Its provider call is dropped, the other request completes with 200,
and the stop field the update carried is not applied;503 admission_stopped, not a closed
connection;budget_limit, a smaller one is admitted, and the
tokens return when the callback settles;TYR_CONFIG_FILE, a pool stop block and
shutdown.stopOnDrainTimeout: true, reports the file's policy at the
configured revision 7. SIGTERM with one request in flight answers 503
with cause drain_deadline and connection: close, no sooner than the
150 ms drain deadline, drops the provider call, logs
shutdown drain deadline reached inFlight=1 pending=0 stopped=1, and exits
with code 0.The Vitest suite adds 65 tests: five new files and one test in
test/progressive-reconciliation.test.ts. Beyond the cases above they cover:
stop field on an update ignored on
both control.applyLimits and Pool.controller.applyLimits, and the
applied policy recorded on admission provenance events;503
with cause overrun, because nothing of its reply had been written;completed, and the pool's
consumed tokens include all of it;429 budget_limit when the stopped request's
tokens are still in the way;stopped counts,
and a drain without the option reporting no stopped at all;503;client_disconnect as 0.34.1 did;422 unknown_previous_response;applied, and the
request still running when the grant expires is stopped with cause
limits under revision 12, attributed to the grant that admitted it;504 idle_timeout when the provider stalls,
502 upstream_error with afterHeaders: false when the provider drops the
connection, and 504 borrowed_admission_deadline when a borrowed slot
expires. After the first chunk the same failures still cut the reply;stop blocks of both shipped example files, uncommented, and the
schema's stop, pool-rule and shutdown definitions.Each guarantee was also checked by breaking it on purpose and confirming a test failed. Of 28 such changes, 27 were caught:
connection: close header
removed, the audit event without its cause, the upstream duration not
labeled stopped, and a reply that has started answered instead of cut;stopOnTimeout;The one change no test catches is removing the turn of the event loop that
shutdown takes between stopping at the drain deadline and closing
connections. Without it every stopped request still got its 503 in these
tests, because each handler answers one or two microtasks before shutdown
continues. The turn is kept so that the answers do not depend on that order.
An independent review of the first version of this change reproduced five defects. Three were fixed in the code, and eight of the tests above fail when those fixes are reverted:
503. Tyr treated
a reply as started once the provider answered. The same was true, since
earlier releases, of a stream that hit its idle timeout, lost its provider
or outlived a borrowed slot in that window. On the 0.34.1 build all three
end in a closed connection; on this build they get 504, 502 and 504.stop block on an observe pool, both of which the runtime refuses. The
schema and the runtime loader now agree on 11 stop configurations and on
both shipped examples. That check was made once with ajv 6.15, which
reads the schema as draft-07 once $schema is removed; it is not part of
the suite.The other two are how the library's stops behave, and the documentation was corrected to say so:
429 budget_limit after two overrun stops; all five got 200
when the same streams ended normally.With no stop settings, this build was compared with a build of the 0.34.1 tag, using the 19 requests and the masking described under Library update (0.34.1). None of the 19 is a stream that fails before its first chunk:
max_output_tokens: 200, below the 256-token safety margin. For that
request the margin fix changes three counters of its pool:
totalOverrun from 43 to 0, totalRefunded from 1,695 to 1,652, and
earlyReleasedTokens from 43 to 56. Those counters, the class copies of
the first two, and their three /metrics lines were the only differences
in three pairs of runs. Counting /stats before and after the drain, that
is 13 of 2,278 values. Both builds exposed the same 629 metric lines.retry-after header,
present in one run and absent in the other, in one pair of each set. That
hint comes from wall-clock intervals and varies between runs of one build.Not verified: a live provider API, and so whether a provider keeps working after Tyr drops the call, and which of its events carry usage; a real Latchflo control plane; the container image; and more than one replica.
3.18.0 can stop work it has already admitted, when a limits snapshot carries a
stop policy or a drain passes stopOnTimeout. Tyr does neither, so this
release must behave as 0.34.0 did on 3.17.0. Three checks cover that:
test/pools-v311.test.ts applies a limits update that carries
stop: { takeBackGraceMs: 0 } and leaves one running call above the new
ceiling. The update is applied, the applied snapshot has no stop, and the
call runs to completion. With the field forwarded to the library, the same
test fails: the call is rejected with LLMAdmissionStoppedError.500, an
observe-mode bypass, a borrowed slot that outlived its 60 ms lease, a kill
switch and a restore through control.applyLimits, and a bounded drain
with one call still running. The comparison covered every reply with its
admission headers and body, /stats, /metrics, the 17 audit events, the
applied limits and the drain result: 2,278 values per run. Five pairs of
runs showed no difference.The comparison leaves out values that differ between two runs of one build: admission ids, timestamps, nanosecond timings, port numbers, the version string, the bucket and sum samples of the duration histograms (their counts are compared), and the retry hint, which is computed from wall-clock completion intervals.
npm run verify:responses-state runs against the built dist/ and a stand-in
provider that reports 20 input and 30 output tokens for every reply. With a
pool that has maxConcurrent: 4, a 5,000-token budget and adaptive estimation
off, the request { model: "gpt-4o", input: "hello", max_output_tokens: 100 }
reserves 111 tokens. The script passes only if:
responsesState, a follow-up gets 400 invalid_request and
/stats has no tyr.responsesState;200 with
x-admission-reserved-tokens: 161 and x-admission-prior-tokens: 50, and
the pool's totalReserved is 111 + 161;422 unknown_previous_response, the
provider's call count does not change, and the pool's llm.rejected stays 0;store: false request and a reply without usage are not
recorded;response.completed event;maxEntries: 2, the first of three responses is unknown and the third
is known; with ttlMs: 200, a follow-up 600 ms later is unknown;TYR_CONFIG_FILE and a relative
responsesState.file, has the record on disk when the reply arrives, is
killed with SIGKILL, is started again, and then admits the follow-up with
161 reserved tokens. SIGTERM afterward exits with code 0.The Vitest suite adds 74 tests in three files. Beyond the cases above they cover:
429 budget_limit follow-up that still reports its prior tokens;store: false request is forwarded to a peer with more
headroom, while a request whose reply will be recorded, and its follow-up,
are admitted on the replica that received them.Each of these guarantees was also checked by breaking it on purpose and confirming a test failed: follow-ups used as calibration samples, the recorded size passed through the estimator, a streamed record written after its final event was forwarded, usage accepted from a stream event that is not final, appending after a failed write, record-bound requests forwarded by capacity routing, and the owner check removed.
A second-pass review of the first version of this change found four defects
in the store, all fixed here: eviction and loading took time quadratic in
maxEntries, a failed append could corrupt the next record, a rewrite that
kept failing let the file grow without bound, and usage on a stream event
that was not final could create an undersized record. Eight of the tests
above fail against that first version.
The 199 tests from 0.33.0 pass with one edit, the version in the
tyr_build_info assertion. No other existing test or verify script changed.
With responsesState absent, this build was also compared with a build of the
0.33.0 tag. Both received the same nine requests: two plain Responses calls,
one of them streamed, a previous_response_id follow-up, a null
previous_response_id, store: false, conversation, background: true, a
Chat Completions call, and an unrouted model. The statuses, x-admission-*
headers and bodies, the /stats document, and all 236 /metrics lines were
identical once admission ids, timestamps, duration samples and the version
label were masked.
On the development Mac, writing 100,000 records with maxEntries: 10000 took
0.007 ms per record on average and 0.01 ms at the 99th percentile. The slowest
write, 17 ms, was a rewrite of the state file, which happens once per 10,000
or more records at that setting. Loading the resulting 3 MB file at startup
took 36 ms. At the largest allowed setting, maxEntries: 1000000, writing
2,100,000 records took 0.006 ms each on average, the one rewrite took 0.49
seconds, loading the 174 MB file took 1.8 seconds, and the records used about
240 MB of heap.
Not verified: a run against the live OpenAI API, the state file on a mounted volume in the container image, and more than two replicas.
npm run verify:eval runs the evaluation for 5 seconds per phase and passes
only if the direct phase shows contention, every interactive request completes
through Tyr, the provider rejects nothing behind Tyr, and Tyr rejects batch
work. It is part of release:check and runs in CI on Node 22 and 24.
A full npm run eval on the development Mac completed 12 of 188 interactive
requests (6%) directly and 60 of 60 through Tyr. The provider rejected 1,380
requests directly and none behind Tyr, and Tyr rejected 1,387 batch requests
with concurrency_limit. Batch throughput fell from 14.9 to 9.8 requests per
second. Provider peak concurrency was 8 of 8 in both phases.
With npm run eval:serve running, eval/sdk/quickstart.mjs (openai-node
7.23.0) and eval/sdk/quickstart.py (openai-python 3.19.1) each completed
responses.create(...) and a Chat Completions call through Tyr and reported
class=interactive outcome=admitted. Interrupting the runner stopped all three
processes and freed ports 8787, 9101, and 9102.
Against the evaluation stack, a request without an identity token returned
401, and max_completion_tokens: 1000 returned 400 because it exceeds
server.maxOutputTokens: 256. /metrics is readable without an operator token.
A model outside the pool's prefixes stopped the run at the first 422, and the
runner shut the stack down.
Live mode refuses to start without OPENAI_API_KEY, --model, and
--confirm-live. Run with an invalid key, Tyr forwarded the request over HTTPS
to api.openai.com, OpenAI returned 401 invalid_api_key, and the runner stopped
at that first error. A billed run against OpenAI was not performed.
LICENSE.txt is byte-identical to the Apache License 2.0 text (SHA-256
c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4), and
package.json declares Apache-2.0. npm pack includes LICENSE.txt,
NOTICE.txt and THIRD_PARTY_NOTICES.txt. An image built from this tree
contains all three files in /app and carries the
org.opencontainers.image.licenses=Apache-2.0 and source labels.
test/gateway.test.ts asserts that admitted, observe-mode and rejected
responses carry the x-latchflo-* grant headers and no x-korrx-* headers.
test/pools-v311.test.ts asserts that source: "zab" and source: "korrx"
are rejected with provenance.source must be "latchflo" before any pool
changes, and that source: "latchflo" applies. npm run release:check passes.
test/upstream-failure.test.ts checks the cause-chain helper on synthetic
chains: it takes the deepest bounded code, rejects unbounded codes and names,
and caps the detail at 300 characters. It also runs two real gateway cases:
502 { cause: { name: "Error", code: "ECONNREFUSED" } };UND_ERR_SOCKET or ECONNRESET.In both cases the response body must not contain the upstream address, and
exactly one upstream_failure diagnostic event must be emitted. The refused
case also checks that tyr_upstream_failures_total carries the code label.
An admission class may configure:
borrowedAdmissionSlot:
releaseMechanism: deadline_abandonment
deadlineMs: 30000
The deadline starts only after admission and applies only when that admission actually borrowed local concurrency. Expiry has deliberately different meaning for each constrained resource:
| Resource | Release mechanism | Enforceability | Expiry behavior |
|---|---|---|---|
| Tyr admission slot | deadline_abandonment |
enforced |
The borrowed local concurrency slot is returned immediately. |
| Local token accounting | callback settlement | enforced locally |
The reservation remains held until the callback settles, and unbounded drain waits for it. |
| Upstream capacity | abort_signal |
unverified |
Tyr requests cancellation but does not claim provider quota, queue, or accelerator capacity was reclaimed. |
Where provider-side termination cannot be proven, an unlent provider/account floor or independently enforceable partition remains necessary for an upstream capacity guarantee.
Run:
npm run verify:borrowed-restoration
The verifier builds Tyr and checks that:
/stats and Prometheus distinguish enforced local release from unverified
upstream cancellation.Vitest integration coverage additionally verifies the 504 borrowed_admission_deadline response, response headers, structured audit event,
bounded metrics, and strict rejection of incomplete or misleading policy values.
Successful admission response headers include exact resource attribution:
x-admission-slot-borrowedx-admission-borrowed-tokensx-admission-slot-deadline-ms when the borrowed-slot policy appliesOn expiry before response headers are sent, Tyr returns 504 with
x-admission-reason: borrowed_admission_deadline. The JSON body states that the
local slot was released, upstream cancellation was requested, and upstream
reclamation is unverified.
GET /stats exposes tyr.restoration per pool. Prometheus exposes:
tyr_resource_release_events_totaltyr_pool_work_in_flighttyr_pool_borrowed_admission_slot_deadlines_totaltyr_pool_admission_class_borrowed_slot_deadlines_totalThe resource metric uses fixed resource, release_mechanism,
enforceability, and outcome values. No provider, model, tenant, request,
admission, or grant identifier is introduced as a label.
Tyr registers the additive capability
borrowedAdmissionSlotDeadlines: true. Older Latchflo versions may ignore it.
Latchflo continues to replace only numeric admission-class limits; the deadline
and release mechanism remain fixed local Tyr policy. The provider request path
still has no synchronous control-plane call.
Tyr 0.36.1 retains the native Anthropic Messages, OpenAI Chat Completions, and
OpenAI Responses routes from 0.29.0. Responses requests stay stateless unless
responsesState is configured. Existing identity, routing,
managed-mode, provenance, timing, retry-hint, and progressive-reconciliation
paths remain intact. Classes without borrowedAdmissionSlot keep the existing
non-preemptive drain behavior, and no request is stopped unless a stop
block or shutdown.stopOnDrainTimeout is configured.
From a clean dependency install on Node.js 22 or newer:
npm ci
npm run release:check
The release gate verifies vendored tarball integrity, lint, TypeScript, the full
Vitest suite, all executable integration verifiers (including borrowed
restoration, response state and stopping), smoke imports, and
npm pack --dry-run.
For independent configuration checks:
npm run build
node dist/cli.js validate --config config/tyr.example.yaml
TYR_ROUTING_SECRET=verification-secret \
node dist/cli.js validate --config config/tyr.latchflo.example.yaml
git diff --check
The full release gate passed on the development Mac on 2026-11-29, after a
clean npm ci on Node.js 24.18.0. It ran on Node.js 24.18.0 in about 44
seconds and on Node.js 22.23.1 in about 47 seconds. On each:
verify:responses-state and the seven verify:stop assertions;On Node.js 24.18.0:
git diff --check passed;npm run verify:vendor-provenance passed: the three vendored artifacts
match their published releases;npm run docs built the site with no errors and no warnings;npm pack --dry-run included 68 files, approximately 184.6 kB packed and
752.9 kB unpacked;docker build --no-cache . built the image for linux/arm64 with Docker
29.8.0. Started with config/tyr.example.yaml mounted read-only, the
container answered GET /healthz with 200, reported
tyr_build_info{version="0.36.1"} 1 on /metrics, and ran
async-bulkhead-llm@3.19.1, with its 238 files, on Node.js 24.22.3 as the
node user.Not verified for 0.36.1: the linux/amd64 image, the SBOM and provenance
attestations, the image job on GitHub Actions and a pulled image. Nothing
was run on Node.js 20, which Tyr has not supported since 0.36.0. CI was not
run for this record.
The final ZIP is checked from a fresh extraction before delivery. It excludes
platform-specific node_modules; consumers install the locked development
dependencies with npm ci.