fix: overhaul tinyclaw context compression and fix 8 bugs#586
Merged
Conversation
Critical fixes: - compress() now uses proxy-first fallback (proxy -> Ollama -> extractive) instead of always bypassing proxy and going to Ollama directly - Summary is now injected into LLM context after compression via build_proxy_messages() helper with user+assistant pair - proxy_messages built from post-compression session state, not stale pre-compression snapshot that caused context loss Additional fixes: - tools_available() no longer auto-resets failure flag (was defeating the circuit breaker set by tool_call() on error) - Removed dead summarize_at_token_ratio config field - AnthropicUsage uses Anthropic-canonical field names with OpenAI aliases - Removed all #[allow(dead_code)] violations - Made test_text_only_fallback deterministic (unreachable port, not default) 7 new tests covering all changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
b5b62fc to
6f8fe99
Compare
- Remove unused Latency import in advanced_routing.rs - Prefix unused spawner variable with underscore in unified_routing.rs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace vec! with arrays to satisfy clippy useless_vec lint. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace CostOptimized::default() with CostOptimized (unit struct) - Replace remaining vec! with arrays in strategy.rs tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AlexMikhalev
added a commit
that referenced
this pull request
Apr 25, 2026
* fix: overhaul tinyclaw context compression and fix 8 bugs Critical fixes: - compress() now uses proxy-first fallback (proxy -> Ollama -> extractive) instead of always bypassing proxy and going to Ollama directly - Summary is now injected into LLM context after compression via build_proxy_messages() helper with user+assistant pair - proxy_messages built from post-compression session state, not stale pre-compression snapshot that caused context loss Additional fixes: - tools_available() no longer auto-resets failure flag (was defeating the circuit breaker set by tool_call() on error) - Removed dead summarize_at_token_ratio config field - AnthropicUsage uses Anthropic-canonical field names with OpenAI aliases - Removed all #[allow(dead_code)] violations - Made test_text_only_fallback deterministic (unreachable port, not default) 7 new tests covering all changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: stabilize pr-586 on main by resolving ci blockers * ci: decouple rust validation from desktop frontend pipeline * ci: fix python lint env and resolve ontology clippy regressions * fix: resolve rolegraph example clippy failures in CI * fix: remove unused imports and variables in router examples - Remove unused Latency import in advanced_routing.rs - Prefix unused spawner variable with underscore in unified_routing.rs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: replace vec! with arrays in router strategy tests Replace vec! with arrays to satisfy clippy useless_vec lint. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve remaining clippy errors in router examples - Replace CostOptimized::default() with CostOptimized (unit struct) - Replace remaining vec! with arrays in strategy.rs tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Alex <alex@example.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
AlexMikhalev
added a commit
that referenced
this pull request
May 1, 2026
* fix: overhaul tinyclaw context compression and fix 8 bugs Critical fixes: - compress() now uses proxy-first fallback (proxy -> Ollama -> extractive) instead of always bypassing proxy and going to Ollama directly - Summary is now injected into LLM context after compression via build_proxy_messages() helper with user+assistant pair - proxy_messages built from post-compression session state, not stale pre-compression snapshot that caused context loss Additional fixes: - tools_available() no longer auto-resets failure flag (was defeating the circuit breaker set by tool_call() on error) - Removed dead summarize_at_token_ratio config field - AnthropicUsage uses Anthropic-canonical field names with OpenAI aliases - Removed all #[allow(dead_code)] violations - Made test_text_only_fallback deterministic (unreachable port, not default) 7 new tests covering all changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: stabilize pr-586 on main by resolving ci blockers * ci: decouple rust validation from desktop frontend pipeline * ci: fix python lint env and resolve ontology clippy regressions * fix: resolve rolegraph example clippy failures in CI * fix: remove unused imports and variables in router examples - Remove unused Latency import in advanced_routing.rs - Prefix unused spawner variable with underscore in unified_routing.rs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: replace vec! with arrays in router strategy tests Replace vec! with arrays to satisfy clippy useless_vec lint. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve remaining clippy errors in router examples - Replace CostOptimized::default() with CostOptimized (unit struct) - Replace remaining vec! with arrays in strategy.rs tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Alex <alex@example.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
compress()now uses proxy-first fallback (proxy -> Ollama -> extractive) instead of always bypassing the proxy and going to Ollama directlybuild_proxy_messages()helper. Previously, compression stored the summary but never used it, actively destroying context.proxy_messagesis now built from post-compression session state instead of a stale pre-compression snapshottools_available()auto-reset -- The getter no longer has a side effect that resets the failure flag, which was defeating the circuit breakersummarize_at_token_ratiofield removed (was never read)AnthropicUsagefield naming -- Uses Anthropic-canonical names (input_tokens/output_tokens) with OpenAI aliases#[allow(dead_code)]-- All violations removed per project rulestest_text_only_fallbackis now deterministic (uses unreachable port)Test plan
cargo fmt -p terraphim_tinyclaw -- --checkcleancargo clippy -p terraphim_tinyclawzero warningscargo test -p terraphim_tinyclaw --lib-- 108 passed, 0 failedcargo test --workspace --lib-- all passingGenerated with Terraphim AI