This integration completes 100% of the features, test cases, and documentation updates from PR #80 (fix: stabilize Anthropic-native streaming, timeout handling, and fallback cancellation), and addresses the issues surfaced during the RE-REVIEW pass.
- Problem: Previously, when a user configured
"streaming_timeout_ms": 600000(total stream timeout) without setting"stream_timeout_ms"(idle timeout), the loader would silently assignStreamTimeoutMs = TimeoutMs(default 300000ms). As a result, the idle watchdog would fire at 300s and effectively neutralize the user's 600s total stream timeout whenever a stream stalled or went idle. - Fix: Updated
applyDefaultsinloader.go. WhenStreamTimeoutMsis unset, it now inherits the user-suppliedStreamingTimeoutMsfirst (when present), and only falls back toTimeoutMsif neither is set. - Test coverage: Added
TestDefaults_StreamingTimeoutFallbacktoloader_test.goto exercise the real JSON file parsing path and assert the fallback behavior.
- The expansion of
IsAnthropicModel(inopencode.go) andisAnthropicNativeGo(inopencode_go.go) to returntrueforminimax-m2.5/2.7/3and theqwen-plusfamily is an intentional bug fix. - These models reject OpenAI-format streaming with tools on OpenCode Go with
400: invalid params, function name or parameters is empty. Routing them through the Anthropic-native/v1/messagesbranch resolves the failure mode at its root. - Test cases in
internal/client/opencode_test.gowere updated in lockstep to reflect this new behavior.
- Heartbeat Suppression: Pauses the SSE keepalive ticker while copying a raw Anthropic stream via the
heartbeatPausedflag. - Early Cancellation: Cancels fallback attempts as soon as the parent context is canceled in
ExecuteWithFallback(fallback.go). transformToolsHardening: Skips tools with missing names, validates that the schematypeisobject, and adds a guard for null/emptyinput_schema.- Documentation: Added the Streaming Scenario Routing section to
CONFIGURATION.mdandREADME.md.
All test suites on the current workspace pass at 100%:
go test ./...Output:
ok github.com/routatic/proxy/internal/client 0.007s
ok github.com/routatic/proxy/internal/config 1.224s
ok github.com/routatic/proxy/internal/daemon (cached)
ok github.com/routatic/proxy/internal/handlers 1.503s
ok github.com/routatic/proxy/internal/router (cached)
ok github.com/routatic/proxy/internal/token (cached)
ok github.com/routatic/proxy/internal/transformer (cached)
ok github.com/routatic/proxy/pkg/types (cached)
All changes remain in the Unstaged state. No commits have been created.