Repository navigation
Record the unsupported-tool refusal as a routing event - #31
Draft
Deep-Sixed wants to merge 1 commit into
Draft
Deep-Sixed wants to merge 1 commit into
Deep-Sixed wants to merge 1 commit into
Conversation
PR #23 refuses a non-function tool on dispatch-path aliases with a 400 before any upstream call, but emitted no routing event, so the refusal never appeared in /admin/events or the telemetry sink. Fusion and jev-router already record their own caller-field refusals. The refusal now emits an invalid_request event (status 400, no attempts) under the caller's identity and the request's revision, and the 400 body carries the event's request_id so the two can be matched. docs/architecture.md now states the dispatch-path caller-field rule: the CALLER_FIELDS allowlist, what is dropped and why, the function-tool refusal, and how fusion and jev-router differ. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TVM2AGUsSu6Fyr5s5LSvew
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.
Follow-up to #23, covering two gaps it left: the refusal emitted no routing event, and the caller-field rule wasn't documented.
Problem
#23 answers a non-function tool on a dispatch-path alias with
400 unsupported_toolbefore any upstream call. The check runs inapp.pyand coversdispatch,freeandjevaliases plus direct free models. It emitted no routing event, so the refusal never reached/admin/eventsor the telemetry sink. Fusion and jev-router record their own caller-field refusals.docs/architecture.mdalso never described the dispatch-path rule. It documents jev-router's allowlist only.Change
router/dispatch.py: newinvalid_request_event(...), built likeunauthorized_event: status 400, outcomeinvalid_request, no attempts, no target.invalid_requestis the outcome jev-router already uses for the same situation: "the caller sent a field the alias does not accept; nothing went upstream". The admin UI already styles it.app.py: theunsupported_toolrefusal now emits that event with the caller's identity and the request's config version and checksum. The 400 body gains arequest_idthat matches the event. This is additive:messageandreasonare unchanged.docs/architecture.md: a new paragraph in Dispatch control plane covers:CALLER_FIELDSallowlist, withmodelreplaced by the targetmodels,route,plugins,preset,provider, …) and whyNot changed: fusion still records its own caller-field refusal as
upstream_error/400, from beforeinvalid_requestexisted. The doc doesn't name fusion's outcome, so aligning it later won't require a doc change.Tests
tests/test_caller_fields.py::test_server_tool_refusal_is_a_routing_eventcovers anopenrouter:fusionentry intoolsand anopenrouter:fusiontool_choice. Each case checks:invalid_requestand status 400request_idequals the one in the responseThe test fails on current
mainand passes with this change../scripts/ci.sh(ruff + pytest) passes with 433 tests.🤖 Generated with Claude Code
https://claude.ai/code/session_01TVM2AGUsSu6Fyr5s5LSvew
Generated by Claude Code