fix(tools): wire reasoning model detection and compress_provider into agent#2367
Merged
fix(tools): wire reasoning model detection and compress_provider into agent#2367
Conversation
… agent (#2357, #2356) - Add ReasoningQualityFailure variant to AnomalyOutcome; quality failures from is_reasoning_model() models now call record_reasoning_quality_failure() which emits a reasoning_amplification WARN log; gated by reasoning_model_warning flag in AnomalyConfig stored in DebugState - Populate AuditEntry.error_phase from ToolErrorCategory::phase() in ShellExecutor.log_audit, WebScrapeExecutor.log_audit, and pre-execution verifier audit entries (was always None) - Resolve compression.compress_provider from [[llm.providers]] at bootstrap via build_compress_provider(); store in ProviderState.compress_provider (context-compression feature-gated); handle_compress_context() uses the named provider with fallback to primary provider
f8333e9 to
64883c9
Compare
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
is_reasoning_model()/record_reasoning_quality_failure()into the agent tool execution path: quality failures (ToolNotFound,InvalidParameters,TypeMismatch) from reasoning-enhanced models (o1, o3, o4-mini, QwQ, DeepSeek-R1, Claude extended-thinking) now emit areasoning_amplificationWARN log and count in the anomaly window; gated byAnomalyConfig::reasoning_model_warning(defaulttrue)AuditEntry.error_phasefromToolErrorCategory::phase()inShellExecutor,WebScrapeExecutor, and pre-execution verifier audit entries — was alwaysnullcompression.compress_providerfrom[[llm.providers]]at bootstrap and pass the named provider tohandle_compress_context()LLM call; falls back to primary provider when field is empty or resolution failsChanges
#2357 —
is_reasoning_model()+error_phasewiringtool_execution/mod.rs: newAnomalyOutcome::ReasoningQualityFailure { model, tool }variant;record_anomaly_outcome()dispatches todet.record_reasoning_quality_failure()whendebug_state.reasoning_model_warning = truetool_execution/native.rs(Errarm): setsReasoningQualityFailurewhenis_quality_failure && is_reasoning_model(provider.name())state/mod.rs:DebugState.reasoning_model_warning: boolfield mirrorsAnomalyConfig::reasoning_model_warningbuilder.rs: storesanomaly_config.reasoning_model_warningintoDebugStateinapply_session_config()shell/mod.rs,scrape.rs:log_auditnow setserror_phasefrome.category().phase().label()native.rspre-execution verifier block:error_phase = Some("setup")#2356 —
compress_providerwiringstate/mod.rs:ProviderState.compress_provider: Option<AnyProvider>(#[cfg(feature = "context-compression")])builder.rs:with_compress_provider()builder method (feature-gated)bootstrap/mod.rs:build_compress_provider()readsconfig.memory.compression.compress_providerand resolves viacreate_named_provider()(feature-gated)runner.rs: wiresbuild_compress_provider()→with_compress_provider()inside#[cfg(feature = "context-compression")]native.rs:handle_compress_context()usesproviders.compress_provider.as_ref().unwrap_or(&self.provider)Test plan
cargo +nightly fmt --check— cleancargo clippy -p zeph-tools -- -D warnings— cleancargo clippy -p zeph-core -- -D warnings— cleancargo clippy -p zeph-core --features context-compression -- -D warnings— cleancargo nextest run -p zeph-tools -p zeph-core --lib --bins— 2047 passedcargo nextest run -p zeph-core --features context-compression --lib --bins— 1212 passedCloses #2357
Closes #2356