Skip to content

Validate model listener filter references before serving traffic#947

Merged
Spherrrical merged 2 commits into
katanemo:mainfrom
mukeshbaphna:validate-output-filters
May 19, 2026
Merged

Validate model listener filter references before serving traffic#947
Spherrrical merged 2 commits into
katanemo:mainfrom
mukeshbaphna:validate-output-filters

Conversation

@mukeshbaphna
Copy link
Copy Markdown
Contributor

@mukeshbaphna mukeshbaphna commented May 17, 2026

Summary

Fixes #945.

This makes model-listener filter references fail closed in both config generation and Brightstaff startup. output_filters are now validated the same way as input_filters, and Brightstaff no longer silently drops missing filter IDs when resolving the runtime filter pipeline.

This PR does not change runtime output-filter failure behavior. It only makes invalid filter references fail fast before traffic is served. Startup/config validation and runtime stream execution need different handling modes: a missing filter ID is a config bug, while an output filter service failing mid-stream is still handled by the existing log-and-pass-through behavior.

Why

Filter chains are part of Plano's guardrails path. If an output_filters ID has a typo, config generation or startup should fail early with a clear error instead of allowing the response path to continue without the intended filter.

This came up while working on a similar ingress/egress processing flow in SGLang: sgl-project/sglang#21154

Design Notes

  • Python config generation catches the normal plano_config.yaml path before rendered config is produced.
  • Brightstaff startup catches rendered configs or non-CLI startup paths that bypass Python config generation.
  • Missing input_filters references already fail during config generation; this makes output_filters consistent with that behavior.
  • Existing runtime behavior for configured output filters is unchanged: if an output filter errors while streaming, Plano logs the error and passes through the original chunk.

Changes

  • Validate listener-level input_filters and output_filters against defined agents / filters during config generation
  • Preserve valid output_filters configs with a positive config-generator test
  • Make Brightstaff startup return an error when rendered config references a missing filter ID
  • Add focused Rust tests for valid, missing input filter, and missing output filter resolution

Local Testing

cd cli
uv run pytest test/test_config_generator.py
cd crates
cargo test -p brightstaff resolve_filter_chain

Result locally:

22 passed
3 passed

@mukeshbaphna mukeshbaphna force-pushed the validate-output-filters branch from 146bf41 to 6a3948e Compare May 17, 2026 16:42
@mukeshbaphna mukeshbaphna marked this pull request as ready for review May 17, 2026 22:51
@mukeshbaphna mukeshbaphna force-pushed the validate-output-filters branch from 6a3948e to fcc5f5d Compare May 17, 2026 23:14
@mukeshbaphna mukeshbaphna force-pushed the validate-output-filters branch from fcc5f5d to ee22001 Compare May 17, 2026 23:15
@mukeshbaphna mukeshbaphna changed the title Validate output_filters references during config generation Validate model listener filter references before serving traffic May 17, 2026
@Spherrrical Spherrrical requested a review from Copilot May 18, 2026 17:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR closes a validation gap for model-listener filter chains by ensuring both input_filters and output_filters references are validated up-front, causing startup/config generation to fail fast (fail closed) when a referenced filter/agent ID is missing—before any traffic is served.

Changes:

  • CLI config generation now validates listener-level output_filters the same way as input_filters.
  • Brightstaff startup now errors if a rendered config references missing filter IDs instead of silently dropping them.
  • Added focused Brightstaff unit tests covering valid chains and missing input/output filter references.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
crates/brightstaff/src/main.rs Replaces silent filter-chain resolution with strict resolution that errors on missing IDs; adds unit tests.
cli/planoai/config_generator.py Extends listener filter ID validation to include output_filters as well as input_filters.
cli/test/test_config_generator.py Adds config-generator test cases for missing/valid output_filters references.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Spherrrical
Copy link
Copy Markdown
Collaborator

Thank you for the contribution! Will merge once CI is finished.

@mukeshbaphna
Copy link
Copy Markdown
Contributor Author

Thank you for the contribution! Will merge once CI is finished.

Hi @Spherrrical - PR seems to be blocked by secret-backed e2e jobs. What's the recommendation?

@Spherrrical
Copy link
Copy Markdown
Collaborator

CI for fork PRs cannot access repository secrets (including after workflow approval), so e2e jobs will not get API keys on this PR.

I pushed the same branch to `katanemo/plano` and opened #955 to run full CI with secrets. Once #955 is green, this PR is safe to merge.

@Spherrrical Spherrrical merged commit 241a181 into katanemo:main May 19, 2026
21 checks passed
@mukeshbaphna mukeshbaphna deleted the validate-output-filters branch May 24, 2026 08:11
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.

Validate output_filters references during config generation

3 participants