Addresses Daniel's review feedback to wire createLoggingFetch into other
providers that use the OpenAI client.
Providers updated:
- base-openai-compatible-provider.ts
- openai.ts (including Azure AI Inference and Azure OpenAI)
- openai-native.ts
- lm-studio.ts
- huggingface.ts
- xai.ts
- requesty.ts
- router-provider.ts
- qwen-code.ts
OpenRouter was already implemented as the reference.
Adds tests to verify the TTL-based cleanup mechanism that prevents memory
leaks from orphaned request timestamps. Tests cover:
- Cleanup after TTL (5 min) expires
- No cleanup before TTL expires
- Selective cleanup of only stale timestamps
This addresses the review feedback from @daniel-lxs regarding potential
memory leaks when requests fail before reaching logResponse/logError.
- Accept both ROO_CODE_API_LOGGING and ROO_CODE_LOGGING for backward compatibility
- Add automatic cleanup of stale request timestamps (5 min TTL)
- Prevents potential memory leaks if logResponse/logError is never called
- Add new logging module at src/api/core/logging/ with:
- ApiLogger singleton for structured request/response/error logging
- withLogging() wrapper for automatic stream metrics tracking
- createLoggingFetch() HTTP interceptor for raw request/response logging
- env-config for reading ROO_CODE_LOGGING from workspace .env.local
- Integrate logging into all 20+ providers via BaseProvider.getLogContext()
- Add protected providerName getter pattern to all provider classes
- Enable HTTP-level logging in OpenRouter provider as reference implementation
- Configuration: Set ROO_CODE_LOGGING=true in workspace .env.local to enable
- Logs include: provider name, model, operation, tokens, latency, errors
Test coverage: 67 tests passing for logging module and providers
* feat(types): add defaultToolProtocol: native to providers
- Added supportsNativeTools: true and defaultToolProtocol: native to all chutes models
- Added defaultToolProtocol: native to moonshot models (already had supportsNativeTools)
- Added defaultToolProtocol: native to litellm default model (already had supportsNativeTools)
- Added defaultToolProtocol: native to minimax models (already had supportsNativeTools)
This enables native tool calling by default for these providers, reducing
the number of users falling back to XML tool protocol unnecessarily.
* fix(litellm): merge only native tool defaults with router models
Only merges supportsNativeTools and defaultToolProtocol from litellmDefaultModelInfo,
not prices or other model-specific info that could be incorrect for different models.
Adds userAgentAppId configuration to the BedrockRuntimeClient in the
code indexing embedder, matching the implementation pattern already
used in the main Bedrock API provider.
This enables proper user agent identification in CloudTrail AWS requests
when using Bedrock for code indexing embeddings.
Fixes#10165
Co-authored-by: Roo Code <roomote@roocode.com>