Enable circuit_breaker, pinch, and pinch.relevance by default (with budget-gate) #10
Reference in New Issue
Block a user
Delete Branch "neuralwatt-router-service"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What & why
Flip three config knobs from disabled-by-default to enabled-by-default, update the tests to expect the ON state, and update the one live doc that still said pinch "ships disabled".
circuit_breaker.enabled: a model that 5xxes is temporarily skipped with exponential backoff (passive recovery). Low-risk availability win; worst case if wrong is briefly avoiding a healthy model.pinch.enabled: relevance-based context pruning on long sessions (trims old tool results upstream to cut the token spend that dominates this router's cost).pinch.relevance.enabled: makes pinch trim the LEAST relevant tool results first instead of blindly by recency.Safety fix caught by dual high-accuracy plan review (Oracle)
The relevance embed was NOT gated by
budget_tokens— it fired synchronously on the hot path for ANY request with 2+ old tool results, even under budget. This PR adds a minimal budget-gate to_relevance_order_for(signature takesbudget_tokens, early-returnsNonewhen the conversation is under budget using the same token measureprune_contextuses), so the embed only runs when a prune will actually happen. User chose "gate it properly".The backup-regex fix in the admin config test is also comment-immune (switched to
yaml.safe_loadparse) after review caught that a real regex would break on the comment block betweencircuit_breaker:andenabled:.Scope
False -> Trueinsrc/config.pyfor the three knobs; valuesfalse -> trueinconfig/config.yaml; stale "off by default" text updated._relevance_order_forbudget-gate + both call sites; new budget-gate test;test_admin_config.pyYAML-parse backup assertion;AGENTS.mdon-by-default wording.escalation.preemptive_on_low_confidence,routing.min_tool_proficiency, pinch value knobs, session_cache behavior.Verification
test_config_endpoints,test_admin_config,test_dispatcher_helpers) green.python -m pytest: 734 passed, 0 failed.enabled=True; budget gate fires (0 embed calls) under budget and engages over budget.nomic-embed-textalready pulled on local Ollama — no setup cost.Commits
69662f0feat: enable circuit_breaker, pinch, and pinch.relevance by defaulte289f50docs: mark pinch on-by-default in AGENTS.md6c8151ftest: isolate session_cache in chat fixture; import subprocess/sys in health test