Files
engine/hanzo.yml
079edc6182 fix(engine): isolate the prefix cache per tenant and cache only written KV (#119)
Prefix blocks were hashed from token content alone, so any two requests with the
same prefix shared KV across orgs, and the sequence-level cache and its disk spill
were keyed by tokens too. Every block hash, sequence-cache key and recurrent-prefix
key now carries the request's cache salt, which the server derives from the
gateway's X-Org-Id plus an optional cache_salt body field. Salted prefixes are
dropped instead of spilled to disk.

The scheduler also cached blocks no forward had written: a prompt preempted in the
pass that admitted it, the last sampled token's slot of every finished or preempted
sequence, and sequences that ended in error. Now only written positions become
reusable.

kv_isolation drives the real scheduler against a simulated KV store and checks every
read for unwritten, foreign-context or other-tenant KV; hanzo.yml gates on it.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-19 16:39:53 -05:00

44 lines
2.0 KiB
YAML

# Canonical CI/CD config for hanzoai/engine — read by the hanzoai/ci reusable
# (.hanzo/workflows/cicd.yml) and by platform.hanzo.ai.
#
# The Zen inference engine: a 23-crate Rust workspace.
#
# The image is declared at the end of this file and built by the build door;
# it is the Dockerfile's one builder. The GPU/FFI/release lanes sit beside it.
#
# `rustup component add rustfmt` first: the toolchain this workflow provisions
# (dtolnay/rust-toolchain@stable) installs the compiler ALONE, so `cargo fmt`
# dies with "'cargo-fmt' is not installed for the toolchain" before reading a
# line of code — a red run that says nothing about the repo. ci.yml buys this
# with `components:` on the toolchain action; the provision step above is not
# ours to configure, so the gate buys it itself. It is idempotent.
#
# The gates are the repo's own (.hanzo/workflows/ci.yml), cheapest first: fmt
# is seconds and catches what needs no compiler, then a full type-check of every
# member. `cargo check` — not `cargo build` — because nothing here consumes a
# binary; the question this gate asks is whether the workspace still compiles.
test:
# Every first-party path is /v1/...; a quoted "/api/" or a joined `}api/`
# outside Markdown (prose that cites third-party APIs) is a regression.
- name: v1-only
run: |
! git grep -nE -e '["(`]/api/' -e "'/api/" -e '}api/' -- ':!*.md' ':!hanzo.yml'
- name: fmt
run: rustup component add rustfmt && cargo fmt --all -- --check
# Prefix-cache tenant isolation: no request decodes against another tenant's KV or against KV no
# forward wrote. A security boundary, so it runs before the workspace-wide check, which a crate
# it does not build could turn red.
- name: kv-isolation
run: cargo test -p hanzo-engine -p hanzo-server-core --lib -- kv_isolation tenant::
- name: check
run: cargo check --workspace
# Built by the build door, one BuildKit Job per platform.
images:
- name: engine
context: .
dockerfile: Dockerfile
repo: ghcr.io/hanzoai/engine
platforms: [linux/amd64]