Skip to main content

vllm-hust-clm-lifecycle

CLM: Context Lifecycle Management perception plugin for vLLM-HUST.

Consumes the scheduler-level request lifecycle events exposed by the host (RequestFinished / RequestPreempted, contract vllm.request-lifecycle.v1) and reports session-level KV growth to an out-of-tree CLM controller, which decides when to compact a long conversation.

Bundle ID: org.vllm-hust.clm-lifecycle (Extension Bundle v1, schema 1.0)

What it does

  • Lifecycle-sink component (contract vllm.request-lifecycle.v1, execution plane scheduler): registers a sink on the engine's default-off typed EventBus. When a request finishes, is preempted, or has its KV actually reclaimed, the sink attributes the footprint to a session (engine-side session_id, or a __default__ bucket) and reports it to a controller endpoint.
  • Reports distinguish decisions from reclaims. kv_growth carries kv_reclaim_deferred, which is true when the host deferred the block release (a connector, or an in-flight step); kv_reclaimed is the event that means the blocks really returned to the pool. A controller should not treat a deferred kv_growth as free capacity.
  • Default-off, zero-overhead when absent: the events only exist on hosts that carry the request-lifecycle hook; without them register() skips gracefully. Reports never block serving (failures are swallowed).

Install

pip install vllm-hust-clm-lifecycle

Enable

Requires a host that exposes vllm.v1.events (vllm-hust with the request-lifecycle hook). Enable via plugin loading:

# runtime registration (vllm.general_plugins)
export VLLM_PLUGINS=ascend,clm_lifecycle
# ECPA static discovery and activation intent
vllm-hust-ext extension inspect org.vllm-hust.clm-lifecycle
vllm-hust-ext extension check org.vllm-hust.clm-lifecycle

Environment

Variable Default Meaning
VLLM_CLM_CONTROLLER (empty) HTTP endpoint receiving JSON reports. Empty = observation-only (no reports sent, no sender thread started).
VLLM_CLM_REPORT_BLOCKS 128 KV-block accumulation threshold per session before a report fires.
VLLM_CLM_REPORT_INTERVAL 5.0 Minimum seconds between two reports of the same session.
VLLM_CLM_QUEUE_MAXSIZE 1024 Bound on the in-process report queue.
VLLM_CLM_QUEUE_POLICY newest What to drop when the queue is full: newest discards the incoming report, oldest discards the queued head to make room.
VLLM_CLM_SEND_TIMEOUT 2.0 Per-attempt HTTP timeout, applied on the sender thread only.
VLLM_CLM_MAX_ATTEMPTS 3 Attempts per report before it is counted as failed and dropped.
VLLM_CLM_CLOSE_TIMEOUT 5.0 Upper bound on how long close() will spend draining.

Parse failures on these variables fall back to defaults (empty values are tolerated).

Reports never block the scheduler

emit() runs on the engine's scheduler thread, so it performs no I/O: it aggregates in memory and hands the report to a bounded queue drained by a private daemon thread. A slow or unreachable controller therefore cannot stall scheduling, and the bounded queue means it cannot grow memory without limit.

Every counter is available via ClmLifecycleSink.stats_snapshot() so "non-blocking" is observable rather than asserted:

Counter Meaning
events_seen lifecycle events received from the host
reports_queued reports accepted into the queue
reports_sent reports the controller accepted
failed_reports reports that exhausted their attempts
dropped_on_full reports discarded because the queue was full
dropped_on_shutdown reports discarded during/after close()
emit_duration_max_s worst observed emit() wall-clock time
last_error most recent send failure, for diagnosis

The test suite drives a real localhost HTTP server that stalls for seconds and asserts that emit() stays far below the sender timeout, that drops are counted, and that close() neither hangs nor loses reports silently.

Disable

unset VLLM_CLM_CONTROLLER VLLM_CLM_REPORT_BLOCKS VLLM_CLM_REPORT_INTERVAL
# or simply do not list clm_lifecycle in VLLM_PLUGINS
pip uninstall vllm-hust-clm-lifecycle

Development

pip install -e ".[test]"
python -m pytest tests/
ruff check .

tests/conftest.py stubs vllm.v1.events before the plugin is imported, so the test suite runs without a vLLM install.

License

Apache-2.0

Metadata

Release files for vllm-hust-clm-lifecycle 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vllm-hust-clm-lifecycle 0.1.1
File Size Uploaded Provenance
vllm_hust_clm_lifecycle-0.1.1.tar.gz 18.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for vllm-hust-clm-lifecycle 0.1.1
File Interpreter ABI Platform
vllm_hust_clm_lifecycle-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 33.2 kB

Release files / vllm_hust_clm_lifecycle-0.1.1.tar.gz

Download URL vllm_hust_clm_lifecycle-0.1.1.tar.gz
Size 18.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d0ae78b77c08516f23f539851f8a32eab721ac54ecc68248fead87e5a416dffe
BLAKE2b-256 checksum
How to use checksums
451bc63e66c7a061d032cd13a1bb35d5143ca002bda24b7ab9b76060b727406b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / vllm_hust_clm_lifecycle-0.1.1-py3-none-any.whl

Download URL vllm_hust_clm_lifecycle-0.1.1-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f54a0ccbcde65407de6219ef49eb4ab540565b9de87c612625227c100e69a057
BLAKE2b-256 checksum
How to use checksums
bb51ca04f3c30fb4e742289b251d3752d3b882ebc0b6f468153a351b8d4477d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Security for vllm-hust-clm-lifecycle 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page