feat(grid): hot reload route overlays#540
Draft
nerdalert wants to merge 4 commits into
Draft
Conversation
Add AI-owned grid_route inference and MCP tool routing under praxis-ai-filters and register it from praxis-ai-proxy. The filter selects ctx.cluster from static candidates, prefers fresh candidates over stale, applies local-site preference on equal freshness, and routes MCP tools/call by mcp metadata with precedence over model-header routing. Add docs, examples, and schema coverage for the new filter. Signed-off-by: Brent Salisbury <bsalisbu@redhat.com>
Add an end-to-end schema test for the MCP grid_route example. The test runs the mcp filter, routes a tools/call request through grid_route, and verifies the selected tool-owning backend responds. Signed-off-by: Brent Salisbury <bsalisbu@redhat.com>
Add overlay-file mode for grid_route with bounded reads, last-known-good reload behavior, parent-directory watching for Kubernetes ConfigMap symlink swaps, and ArcSwap-backed snapshot updates. Include overlay example config, generated filter docs, and schema-level tests covering initial overlay routing and in-process hot reload. This is stacked on the grid_route PR and remains draft/WIP for broader review. Signed-off-by: Brent Salisbury <bsalisbu@redhat.com>
Add Grid overlay metadata parsing and single-process session affinity to grid_route. The filter now treats Grid/config candidate order as authoritative, filters by admission state, and only reuses existing_only candidates for valid existing session bindings.\n\nAccept canonical credential.secretRef in Grid-produced overlays while keeping secret_ref as a compatibility alias, and keep rejecting embedded credential values. Regenerate the grid_route filter docs to describe ordered selection, session metadata, and affinity configuration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds draft/WIP hot-reload support for the
grid_routefilter.This introduces an overlay-file mode where
grid_routereads a Grid-generatedgrid-config.jsonfile, builds an in-memory route snapshot, and can update that snapshot in-process when the file changes. The intent is to let Grid update provider candidates without requiring a Praxis AI pod restart, rollout restart, or full proxy pipeline reload.This PR is intentionally stacked on top of #339 and should remain draft until
grid_routelands.Why this exists
Grid owns provider discovery, provider health/freshness, and route ordering. Praxis AI owns request-time routing.
The handoff between them is the Grid routing overlay:
This PR implements the Praxis AI side of that handoff.
High-level behavior
grid_route now supports two modes:
Static mode
Existing behavior. Candidates are declared inline in the Praxis config and remain fixed for the lifetime of the filter.
Overlay mode
Candidates are loaded from overlay_file, normally /etc/grid/grid-config.json. The filter can watch the overlay file parent directory and reload candidate state when the file changes.
The two modes are mutually exclusive.
Reload algorithm
At startup:
read overlay file with a bounded reader
On filesystem event:
On request:
The request path does not read files or talk to Kubernetes.
Kubernetes ConfigMap behavior
The watcher intentionally watches the overlay file's parent directory. This is needed because Kubernetes projected ConfigMap updates are usually delivered as symlink swaps involving ..data, timestamped directories, rename events, or create/remove events rather than a simple direct file modification.
The implementation avoids canonicalizing the overlay path so projected-volume symlink behavior is preserved.
Important deployment requirement:
Safety properties
This PR is designed around last-known-good behavior:
What hot reload can change
The overlay can change:
The overlay cannot change:
Every cluster name that may appear in any overlay version must already exist in the downstream load_balancer config. If an overlay references an unknown cluster, it is syntactically valid and may become active, but requests selecting that cluster will fail downstream.
Files changed
filters/src/grid/overlay.rs
filters/src/grid/route.rs
examples/configs/grid-route-overlay.yaml
tests/schema/tests/suite/examples/ai/grid_route.rs
Validation
Ran locally:
Draft review focus
This is intentionally still draft/WIP.
Known remaining work
Before this is ready to merge: