Skip to content

feat(grid-llmd-pool-metrics): add kvCachePressure scoring flavor - #13

Open
jordigilh wants to merge 2 commits into
praxis-proxy:mainfrom
jordigilh:feat/llmd-pool-metrics-kv-cache-flavor
Open

feat(grid-llmd-pool-metrics): add kvCachePressure scoring flavor#13
jordigilh wants to merge 2 commits into
praxis-proxy:mainfrom
jordigilh:feat/llmd-pool-metrics-kv-cache-flavor

Conversation

@jordigilh

Copy link
Copy Markdown
Contributor

What

Adds a second, selectable Forge config flavor to grid-llmd-pool-metrics: --kv-cache selects forge-kv-cache.yaml (Grid's kvCachePressure scoring strategy) instead of the default forge.yaml (queueDepth). Both flavors share the same resources/ and configs/ assets and run entirely against published ghcr.io images — no local build or grid checkout required.

Why

This is the demos-repo counterpart to a mirrored --kv-cache flag added to the internal grid xtask e2e topology (praxis-proxy/grid#46) — but this demo is independent of that PR: forge-kv-cache.yaml hardcodes scoringPolicy.strategy: kvCachePressure directly, so it works today against main, whether or not grid#46 has merged.

ScoringStrategy::KvCachePressure is a real, already-tested Grid strategy; this demo makes it live-demoable using only published images.

How it was validated

Ran both flavors end-to-end (quick + full mode) on helios08:

  • ./run.sh --full --teardown (queueDepth, unchanged default) — pressure/flip/recovery proofs pass.
  • ./run.sh --full --kv-cache --teardown (kvCachePressure) — KV-cache utilization rises and drives the A→B rank flip while queue depth stays flat, confirming the two flavors exercise genuinely different Grid scoring paths, not a cosmetic label swap.

Changes

  • demos/grid-llmd-pool-metrics/forge-kv-cache.yaml (new) — same two-pool topology as forge.yaml, scoringPolicy.strategy: kvCachePressure on both sites.
  • scripts/run-grid-demo.sh — new FORGE_CONFIG_NAME env var to select a Forge config file, defaulting to forge.yaml (backward compatible).
  • demos/grid-llmd-pool-metrics/run.sh — intercepts --kv-cache and sets FORGE_CONFIG_NAME before delegating.
  • demos/grid-llmd-pool-metrics/README.md — documents both flavors side by side.

DCO sign-off included.

Ships a second Forge config flavor (forge-kv-cache.yaml) alongside the
existing forge.yaml, selecting Grid's kvCachePressure scoring strategy
instead of queueDepth. Both flavors share the same resources/ and
configs/ assets and are driven entirely by published ghcr.io images
(grid-operator, grid-ai-rollup, grid-overlay-sync v0.1.3) -- no local
build or grid checkout changes required.

- forge-kv-cache.yaml: same two-pool topology as forge.yaml, with
  scoringPolicy.strategy: kvCachePressure on both GridNetwork sites.
- run-grid-demo.sh: new FORGE_CONFIG_NAME env var lets a demo select
  which Forge config file to use, defaulting to forge.yaml.
- run.sh: intercepts a new --kv-cache flag and sets FORGE_CONFIG_NAME
  accordingly before delegating to run-grid-demo.sh.
- README.md: documents both flavors side by side (which strategy each
  selects, how the score is computed, how to run either), and notes
  that both queue_depth and kv_cache are always shown in the live
  table regardless of which flavor is active.

Live-validated end-to-end on helios08 (Aug 11): the kv-cache flavor's
routing flip is driven by the KV signal while queue depth stays flat,
confirming the two flavors exercise genuinely different Grid scoring
paths, not just a cosmetic label change.

Signed-off-by: Jordi Gil <jgil@redhat.com>
…_NAME

Restricts FORGE_CONFIG_NAME to a bare filename within DEMO_DIR: any "/"
(e.g. a stray "../" or an absolute path) is now rejected before it's
used to build FORGE_CONFIG, instead of silently resolving outside the
demo directory.

Flagged as optional defense-in-depth by an independent security review
of this PR (local-only, same-user config control, not a demonstrated
exploit) -- applying it anyway since it's a two-line, zero-behavior-
change guard for the two legitimate values (forge.yaml,
forge-kv-cache.yaml).

Signed-off-by: Jordi Gil <jgil@redhat.com>
@jordigilh

Copy link
Copy Markdown
Contributor Author

Ran an independent security review of this diff. Summary: no medium/high/critical issuesrun.sh/run-grid-demo.sh quote all variable expansions correctly, there's no eval, and forge-kv-cache.yaml contains no embedded secrets (only public ghcr.io images and standard in-cluster TLS/credential references created at demo runtime, not checked-in material).

One optional hardening idea came up (path traversal via FORGE_CONFIG_NAME, e.g. a stray ../) — reviewer explicitly flagged it as local-only/same-user config control, not a demonstrated exploit, but it was a cheap two-line guard so I went ahead and pushed it: FORGE_CONFIG_NAME is now rejected outright if it contains a /, restricting it to a bare filename within the demo directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant