Default agent-provider routes to the redact on-match policy
Provider routes (the agent talking to its own LLM API — api.anthropic.com, the Codex backend, etc.) carry the whole conversation payload, which is the worst source of token-shaped false positives. egress_routes_for_bottle now fills outbound_on_match=redact on any provider route that doesn't set it explicitly, so a match there is scrubbed and forwarded rather than blocked or queued for the operator. A provider that sets the policy keeps its choice; manifest routes still default to supervise. Tests: provider route gets redact default, explicit provider policy preserved, manifest route unaffected. README + PRD 0062 updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HnvBjPZC5V7qeQpFbQdDmS
This commit is contained in:
@@ -202,6 +202,23 @@ class TestProviderRouteMerge(unittest.TestCase):
|
||||
self.assertEqual((), routes[0].matches)
|
||||
self.assertEqual({}, egress_token_env_map(routes))
|
||||
|
||||
def test_provider_route_defaults_to_redact_on_match(self):
|
||||
b = _bottle([])
|
||||
pr = EgressRoute(host="api.anthropic.com")
|
||||
routes = egress_routes_for_bottle(b, (pr,))
|
||||
self.assertEqual("redact", routes[0].outbound_on_match)
|
||||
|
||||
def test_provider_route_explicit_on_match_preserved(self):
|
||||
b = _bottle([])
|
||||
pr = EgressRoute(host="api.anthropic.com", outbound_on_match="supervise")
|
||||
routes = egress_routes_for_bottle(b, (pr,))
|
||||
self.assertEqual("supervise", routes[0].outbound_on_match)
|
||||
|
||||
def test_manifest_route_does_not_get_redact_default(self):
|
||||
b = _bottle([{"host": "api.example.com"}])
|
||||
routes = egress_routes_for_bottle(b)
|
||||
self.assertEqual("", routes[0].outbound_on_match)
|
||||
|
||||
def test_two_provider_routes_with_same_token_ref_share_slot(self):
|
||||
b = _bottle([])
|
||||
routes = egress_routes_for_bottle(b, (
|
||||
|
||||
Reference in New Issue
Block a user