Tyr Admission Controller - v0.36.1
    Preparing search index...

    Tyr 0.36.1 verification

    Date: 2026-11-29

    • Tyr package version: 0.36.1
    • Runtime version constant: 0.36.1
    • Runtime dependency: async-bulkhead-llm@3.19.1
    • Transitive bulkhead dependency: async-bulkhead-ts@1.0.1
    • Vendored runtime artifacts:
      • vendor/async-bulkhead-llm-3.19.1.tgz
      • vendor/async-bulkhead-ts-1.0.1.tgz
      • vendor/yaml-2.9.0.tgz
    • Package repository: https://github.com/janbalangue/tyr-admission-controller.git
    • Minimum Node.js version: 22
    • Container base image: node:24-alpine

    async-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:

    • The existing suite. All 339 tests from 0.36.0 and every executable verifier pass on 3.19.1. The only edit to an existing test is the version string one assertion expects.
    • Provenance across a limits update. 3.18.2 and later decide a call that finds a free slot when it is made, and emit 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.
    • The safety margin. Tyr caps the margin at a request's output reservation, and the library has capped a progressive hold at the whole reservation since 3.19.0. A new test in 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.
    • Same output as 0.36.0. The 0.36.0 build on 3.18.0 and this build were each started with three pools and sent the same 20 requests: Chat Completions, Messages and Responses, plain and streamed, two streamed requests whose reservations are below the safety margin, a high-priority request, a premium-class request, budget and concurrency rejections, an upstream 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:

    • Four requests made in one tick, two standard and then two premium, on a pool of 4 slots with 2 protected for premium. On 3.18.0 both standard requests were refused with concurrency_limit and the constraint admission_class_protection. On 3.19.1 all four were admitted.
    • A drain started while one request waited in the queue behind a 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.
    • The provenance case above. The 0.36.0 build on 3.18.0 decided the request after the update and recorded revision 2. This build records revision 1.

    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 .
    • The exported index holds four manifests: an image for linux/amd64, an image for linux/arm64, and an attestation manifest for each.
    • Each attestation manifest carries an SPDX 2.3 SBOM and a SLSA v1 provenance statement. The SBOM lists tyr-admission-controller@0.36.0, async-bulkhead-llm@3.18.0 and async-bulkhead-ts@1.0.1.
    • Both images run as the 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.
    • The build stage ran once, on linux/arm64, for both target platforms.
    • Started with 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.
    • Three type aliases that documented modules refer to were exported so the API reference includes them: 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.
    • A separate check of the Markdown as GitHub renders it resolved every relative link and anchor in the README, the 15 guides, EVALUATION.md, CONTRIBUTING.md and SECURITY.md.
    • The site has a page for each guide and for 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:

    • on a pool without a stop policy, a limits update that names 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;
    • a pool configured at revision 100 with 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;
    • on the same kind of pool, a Chat Completions stream whose closing usage chunk reports 9,000 output tokens is delivered in full, through data: [DONE], is audited as completed with that usage, and stops nothing;
    • a pool with 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;
    • a streamed request whose provider has answered with headers and no event is stopped by a take-back with 503 admission_stopped, not a closed connection;
    • at pool level, a stopped request whose callback ignores the abort leaves the pool with no slot in use and its tokens still charged: a request of the same size is refused with budget_limit, a smaller one is admitted, and the tokens return when the callback settles;
    • the built server, started with 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:

    • every refused policy: not an object, empty, an unknown key, a negative or fractional value, a grace period above 2,147,483,647, an overrun allowance without a token budget, and a policy on an observe pool, in both the programmatic and the YAML field names;
    • the starting revision: the configured one when it is above 0, 1 when it is 0 or omitted, and unchanged for a pool that starts closed, which gets the policy with its first update and can then abort the first request it admits;
    • class limits and the high-priority reserve surviving the startup update;
    • the policy restated on every update, a stop field on an update ignored on both control.applyLimits and Pool.controller.applyLimits, and the applied policy recorded on admission provenance events;
    • a usage report that leaves the pool above its budget stopping the request admitted last, although the reporting request stays inside its own allowance;
    • a stream whose first chunk reports the overrun: the request gets 503 with cause overrun, because nothing of its reply had been written;
    • closing usage of 9,000 output tokens on all three provider routes: each reply is delivered in full and audited as completed, and the pool's consumed tokens include all of it;
    • closing usage still reported as a mid-stream report on a pool without an overrun allowance, as in 0.34.1, and not on a pool with one;
    • which usage each stream extractor calls final, including a server that reports cumulative usage on every Chat Completions chunk;
    • a queued request that takes a stopped request's slot: admitted when its tokens fit, and refused with 429 budget_limit when the stopped request's tokens are still in the way;
    • a take-back that stops nothing when the work fits again within the grace period, and one that stops normal-priority work before high-priority work;
    • a stopping drain over two pools, its per-pool and total stopped counts, and a drain without the option reporting no stopped at all;
    • a shutdown with four requests on two pools, two of them on borrowed slots with a deadline: all four get 503;
    • a shutdown that stops an admitted request of an observe pool, and one with the option off, which closes the connection and audits client_disconnect as 0.34.1 did;
    • a Responses stream stopped before its final event: no response record is written and its follow-up gets 422 unknown_previous_response;
    • a managed pool behind the real Latchflo agent with a stubbed control plane: the pool stays at revision 0 until the grant, the grant's revision 11 carries the policy, the agent's acknowledgement is 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;
    • a streamed request that fails before its first chunk, on a pool with no stop settings: 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;
    • a streamed reply's status, content type and admission headers arriving with its first chunk, a provider reply with no body, and a provider error status on a streamed request;
    • the 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:

    • in the stop handling: the stop branch removed, the upstream call not dropped, the drain never asked to stop, the 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;
    • in the policy: left off updates, a caller's policy forwarded, not stated at startup, stated at startup by a closed pool, the pool not built one revision lower, allowed on an observe pool, left off provenance events, hidden from the request handler, and the pool ignoring stopOnTimeout;
    • in the stream path: the status line written when the provider answers, no status line for a reply without a body, closing usage reported on a pool with an allowance, closing usage held back on every pool, a chunk written after its own usage stopped the request, each extractor never calling usage final, and the Chat Completions extractor always calling it final;
    • the safety margin left uncapped, and the schema's budget rule removed.

    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:

    • A streamed request stopped before its first chunk had its connection closed with no status, where the documentation promised 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.
    • A request was stopped for an overrun that its provider reported only as the reply ended. The stop saved nothing and cost the client the end of a finished reply.
    • The schema accepted an overrun allowance without a token budget, and a 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:

    • The first version said a stopped request's tokens stay charged until the provider call settles, as protection against a provider that keeps working. In the gateway that call ends when Tyr drops it, and the tokens were back about 1 ms after the stop was answered.
    • A stop returns the slot before the tokens. On a pool with a queue, the request at the head of the queue takes the slot and is checked against a budget the stopped request still occupies. In one run four of five queued requests got 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:

    • One of the 19 is a streamed Responses request with 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.
    • With that request reserving 300 output tokens instead, those counters matched too, in five pairs of runs.
    • The only other difference seen was the whole-second 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:

    • The existing suite. All 273 tests from 0.34.0 and every executable verifier pass on 3.18.0. The only edit to an existing test is the version string one assertion expects.
    • The policy cannot arrive by accident. A new test in 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.
    • Same output as 0.34.0. The 0.34.0 build on 3.17.0 and this build were each started with three pools and sent the same 19 requests: Chat Completions, Messages and Responses, plain and streamed, a high-priority request, budget and concurrency rejections, an upstream 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:

    • without responsesState, a follow-up gets 400 invalid_request and /stats has no tyr.responsesState;
    • a follow-up to a recorded response gets 200 with x-admission-reserved-tokens: 161 and x-admission-prior-tokens: 50, and the pool's totalReserved is 111 + 161;
    • a follow-up to an unknown id gets 422 unknown_previous_response, the provider's call count does not change, and the pool's llm.rejected stays 0;
    • a reply to a store: false request and a reply without usage are not recorded;
    • a streamed reply is recorded from its response.completed event;
    • with 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;
    • with identity, a follow-up from the same tenant and application under another subject is admitted, and one from another tenant or application gets the same body as an unknown id without a provider call;
    • the built server, started with 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:

    • the recorded size added exactly on top of an adaptively corrected estimate, with the pool's calibration samples unchanged by the follow-up;
    • a follow-up admitted while the first reply's stream is still open, which shows the record exists before the reply ends;
    • a stream that reports usage on its first event and then breaks off, which leaves no record;
    • a 429 budget_limit follow-up that still reports its prior tokens;
    • a state file with a partly written last line, unreadable lines, a line longer than any Tyr writes, a foreign file, a newer schema, records that span read boundaries, and bounds changed between runs;
    • a write that fails partway through a line: nothing is appended after the fragment, and the next rewrite saves every record, including the one whose write failed;
    • a rewrite that keeps failing: appends stop, the retry delay doubles, and the file is restored with its header once the directory is back;
    • a start on a readable file that cannot be rewritten, which serves the records it read, and a start that cannot create the file, which fails;
    • capacity routing: a 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:

    • an upstream port that refuses connections must return 502 { cause: { name: "Error", code: "ECONNREFUSED" } };
    • an upstream that destroys the socket after reading the request must return 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:

    • an expired borrowed admission returns its local concurrency slot;
    • the admission's token hold remains while callback work is unsettled;
    • that outstanding token hold cannot be falsely re-admitted as free capacity;
    • a protected class can admit after local slot restoration;
    • no-timeout drain remains pending until the detached callback settles;
    • final callback settlement releases the remaining accounting and allows drain;
    • /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-borrowed
    • x-admission-borrowed-tokens
    • x-admission-slot-deadline-ms when the borrowed-slot policy applies

    On 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_total
    • tyr_pool_work_in_flight
    • tyr_pool_borrowed_admission_slot_deadlines_total
    • tyr_pool_admission_class_borrowed_slot_deadlines_total

    The 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:

    • 22 Vitest files passed, containing 341 tests;
    • every executable verifier passed, including the seven borrowed-restoration assertions, verify:responses-state and the seven verify:stop assertions;
    • telemetry smoke passed.

    On Node.js 24.18.0:

    • both shipped YAML examples passed runtime CLI validation;
    • 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.