fix: trace tool forwarding decisions

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
mmc
2026-04-29 06:12:21 +08:00
parent 3c9d419726
commit d9fec3fd74
4 changed files with 168 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ from .config import Settings, load_settings
from .http.execution_core import (
_apply_cached_instance_or_invalidate as _shared_apply_cached_instance_or_invalidate,
_resolve_ask_mode as _shared_resolve_ask_mode,
_tool_config_summary,
UpstreamExecutionError,
complete_execution,
finalize_stream_execution,
@@ -459,6 +460,12 @@ async def v1_chat_completions(req: ChatCompletionsRequest, request: Request):
# 3. Stick the request to the pool instance that originally served it.
tool_config = _openai_tool_config(req, settings=settings)
has_tooling_context = _openai_has_tooling_context(req, messages_dump)
logger.info(
"chat.request stream=%s tooling=%s tool_config=%s",
req.stream,
has_tooling_context,
_tool_config_summary(tool_config),
)
execution = await prepare_execution_context(
protocol="chat",
requested_model=req.model,
@@ -892,6 +899,12 @@ async def v1_messages(req: AnthropicMessagesRequest, request: Request):
message = error.get("message") or str(detail) or "invalid tool configuration"
return _anthropic_error(exc.status_code, "invalid_request_error", message)
has_tooling_context = _anthropic_has_tooling_context(req)
logger.info(
"anthropic.request stream=%s tooling=%s tool_config=%s",
req.stream,
has_tooling_context,
_tool_config_summary(tool_config),
)
try:
execution = await prepare_execution_context(
protocol="anthropic",