feat(routing): allow tuning classifier weights via grob_configure (T-P5a)#268
Merged
Destynova2 merged 1 commit intomainfrom Apr 25, 2026
Merged
feat(routing): allow tuning classifier weights via grob_configure (T-P5a)#268Destynova2 merged 1 commit intomainfrom
Destynova2 merged 1 commit intomainfrom
Conversation
…P5a)
Adds a `Classifier` variant to `ConfigSection` so MCP clients can read
and update the [classifier.weights] (5 signals) and [classifier.thresholds]
(2 tier boundaries) sections at runtime. Hot-reload reuses the existing
`config_guard::reload_state()` pipeline — no extra plumbing.
Whitelisted keys:
- weights.{max_tokens,tools,context_size,keywords,system_prompt}
- thresholds.{medium_threshold,complex_threshold}
Other keys are rejected with `unknown classifier key`. The existing
`is_key_denied` deny-list still blocks anything containing `api_key`.
Unblocks the auto-tune MCP tool (T-P5b) which will batch-suggest weight
patches based on observed metrics.
This was referenced Apr 25, 2026
Destynova2
pushed a commit
that referenced
this pull request
Apr 25, 2026
…bration (T-P5b) Closes the Phase P routing-intelligence work. Pairs with the ConfigSection::Classifier work (T-P5a, #268) by exposing a higher-level MCP surface dedicated to classifier tuning. Two actions: - action=suggest — returns the seven classifier weights/thresholds (5 weights + 2 tier thresholds) as TuneSuggestion entries. The MVP reports the current values with proposed == current; future revisions will infer patches from observed traffic. Operators can still iterate manually using the rationale field as a placeholder. - action=apply — accepts a list of {key, value} patches and persists them via the existing config_guard::persist_and_reload pipeline. This is sugar over batching multiple grob_configure calls into one MCP round-trip; the same deny-list (api_key, providers, dlp) and whitelist (weights.*, thresholds.*) apply. Files: - src/routing/classify/autotune.rs — new module with TuneSuggestion, AutotunePatch, current_snapshot() + 4 unit tests. - src/routing/classify/mod.rs — registers the autotune module. - src/server/mcp_handlers.rs — handle_autotune handler, dispatch registration, tool description in tools/list. The implementation is intentionally minimal: it ships the surface without speculating on the inference strategy. See docs/how-to/auto-tune-routing.md for the manual tuning workflow.
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
Whitelisted keys
Other keys → `unknown classifier key: `. The deny-list (anything containing `api_key`) still blocks credential-shaped names.
Files changed
Test plan
Example MCP call
```json
{
"method": "grob_configure",
"params": {
"action": "update",
"section": "classifier",
"key": "weights.tools",
"value": 5.0
}
}
```