Skip to main content

AI Cost Firewall v0.4.2

AI Cost Firewall v0.4.2 hardens the structured-evidence lifecycle and completes the production integration path from AI Cost Firewall to VCAL Audit.

Highlights

  • finalized vcal.evidence.event schema version 1.1
  • stable trace_id across validation, guard, cache, upstream, and terminal stages
  • exactly one terminal request.completed or request.failed event for every trace that emits request.received
  • explicit guard.security.* and guard.privacy.* event names
  • Security Guard rule_id propagation to responses, metrics, and evidence where available
  • Privacy Guard restore skipped when Security Guard blocks a response
  • buffered HTTP delivery to VCAL Audit with bounded queue, batching, flush interval, request timeout, and exponential retry backoff
  • global rejection of stream=true with HTTP 422 before cache, guard, or upstream processing
  • expanded guard orchestration metrics and latency histograms

Evidence lifecycle

A successful non-cached request can produce:

request.received
cache.lookup.miss
upstream.request.sent
upstream.response.received
request.completed

A blocked or failed request ends with request.failed. The terminal invariant makes incomplete traces and duplicate terminal outcomes easier to detect in VCAL Audit.

Guard event names include:

guard.security.request.allow
guard.security.request.warn
guard.security.request.block
guard.security.request.failed
guard.security.response.allow
guard.security.response.block
guard.security.response.failed

guard.privacy.request.detected
guard.privacy.request.anonymized
guard.privacy.request.redacted
guard.privacy.request.failed
guard.privacy.response.restored
guard.privacy.response.restore_failed

VCAL Audit delivery

audit_enabled true;
audit_url http://vcal-audit:8092;
audit_api_key replace-with-shared-audit-token;
audit_producer_instance_id ai-firewall-01;
audit_queue_capacity 10000;
audit_batch_size 100;
audit_flush_interval_ms 1000;
audit_request_timeout_seconds 5;
audit_retry_max_attempts 5;
audit_retry_initial_backoff_ms 250;

Evidence is queued asynchronously and delivered to POST /v1/events/batch. A partial batch is sent when the flush interval expires. Failed requests are retried with exponential backoff up to the configured attempt limit.

The queue is bounded and memory-backed. Audit delivery does not normally block the client request, but evidence can be dropped if the queue is full or retry attempts are exhausted. Such conditions are logged for operators.

Observability

The release exposes orchestration metrics including:

aif_guard_requests_total{guard,stage,result}
aif_guard_latency_seconds{guard,stage}
aif_security_blocks_total{stage,rule_id}
aif_privacy_restore_skipped_total{reason}

Enable structured evidence logs with:

RUST_LOG=info,vcal_evidence=info

Validation

Version 0.4.2 was validated with AI Cost Firewall, Redis, Qdrant, VCAL Privacy Guard, VCAL Security Guard, VCAL Audit, and an OpenAI-compatible upstream. Validation covered request- and response-side guard decisions, buffered batch ingestion, trace reconstruction by trace_id, SQLite persistence, and successful SHA-256 record-chain verification in VCAL Audit.

Compatibility notes

  • The supported client and upstream API style remains OpenAI-compatible.
  • Provider-specific configuration blocks are not introduced in this release.
  • Streaming chat completions remain unsupported and return HTTP 422.
  • The Audit sender does not provide disk-backed replay.