fix: tool result sanitization and context truncation#33
fix: tool result sanitization and context truncation#33saxyguy81 wants to merge 1 commit intoCaddyGlow:dev/v0.2from
Conversation
943b452 to
78550bd
Compare
|
Ran SDK integration tests locally: ============================= test session starts ============================== ============================ no tests ran in 0.10s ============================= (2 passed, 2 skipped: manual injection + compare SDK vs API). |
Summary\n- prevent mixed content in tool_result user messages by only summarizing orphaned tool_results when no valid tool_results remain\n- truncate context before sanitization (token estimation + fallback content truncation) to avoid creating orphaned tool blocks\n- normalize Anthropic SSE errors and expand coverage\n- add missing tests/fixtures package marker; minor lint/mypy compliance tweaks\n\n## Testing\n- PYTHONPATH=. pytest tests/test_tool_result_sanitization.py tests/plugins/claude_api/unit/test_native_anthropic_sanitization.py tests/unit/llms/test_context_window_management.py tests/unit/llms/test_truncation_creates_orphans.py tests/unit/streaming/test_deferred_stream_errors.py tests/plugins/claude_sdk/integration/test_sdk_compaction_behavior.py