feat: adoption funnel and trust fixes (roadmap phase A)#58
Merged
Conversation
Funnel: - crate-level lib.rs docs with a quick-start example (the docs.rs landing page was empty); Cargo.toml documentation now points at docs.rs - README: stale install version fixed, honest per-provider capability caveats (thinking 3/7, client-side caching Anthropic-only), registry claim corrected - API keys resolve from provider-conventional env vars when with_api_key is not called (ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY, ..., AWS composite for bedrock); explicit keys always win Trust (advertised features now actually wired): - CostConfig::cost_usd + Agent::session_cost_usd — pricing data is consumed instead of decorative - ContextTracker drives compaction sizing in the loop: real provider usage calibrates the estimation-based budget (scaled when the char/4 estimate runs low, e.g. images), tracker re-baselines after compaction - ModelConfig.reasoning now warns when thinking is requested on a model not marked reasoning-capable - CLAUDE.md claims corrected (registry dispatch, openapi factories) Papercuts: - with_temperature on Agent and SubAgentTool (SubAgentTool previously hardcoded None) - Retry-After header parsed into RateLimited.retry_after_ms so server-directed backoff actually engages - thinking_level now logs a warning on the four providers that ignore it (Azure, Gemini, Vertex, Bedrock) instead of silently no-oping - panic contracts documented on prompt*/continue_loop* (Result variants planned for 0.10) CI/deps: - macOS added to the test matrix; Windows compile-check job; MSRV (1.85) check job - serde_yaml (archived upstream) replaced with serde_yaml_ng - library tokio features trimmed from "full" to the seven actually used Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The new MSRV CI job caught it on its first run: the icu/idna stack (pulled transitively via url) requires rustc 1.86, so 1.85 users could not build yoagent from a fresh resolution anyway. Declare the real floor. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Multi-agent review of the Phase A funnel/trust work surfaced defects in the newly wired features. Fixes, most severe first: - Compaction budget calibration (agent_loop.rs): the ratio scaling collapsed the budget toward zero because provider usage counts the system prompt and tool schemas while the message estimate does not — the ratio fired every session. Replace with additive overhead subtraction (measured overhead = hybrid − estimate), zero the now-double-counted system_prompt reserve, and floor the result at 10% of the configured budget so a mis-measured overhead can never wipe history. Adds a tracing::debug! line. - Missing-key resolution (registry.rs, agent.rs, sub_agent.rs): empty-string fallback erased "no credentials found". Add resolve_api_key_or_warn that tracing::warn!s the exact env var to set before falling back, and a debug-log of which var resolved. - Google/Vertex usage double-counted cached tokens: promptTokenCount already includes cachedContentTokenCount, so input + cache_read over-counted. Keep input as the uncached remainder (Vertex also now parses/reports cache_read). - Retry-After bypassed max_delay_ms: clamp server-provided delay so a bad header can't stall the loop uncancellably. - session_cost_usd returned Some(0.0) for unpriced models: add CostConfig::is_configured and return None when all rates are zero (can't price, not free). Doc corrections: restore with_openapi_file/url to CLAUDE.md (they exist, pub async); rewrite the # Panics sections (finish() cannot recover a dropped _with_sender future); scope the reasoning-warning doc to the Agent wrapper; fix lib.rs steering wording and drop the unused doctest import; tighten README provider caveats (OpenAI-family thinking is opt-in per ModelConfig; Bedrock has no automatic caching); add the sub-agent temperature caveat. Tests: parse_retry_after units + a wiremock 429 asserting retry_after_ms; calibration loop tests (overhead subtraction + floor guard) via a recording compaction strategy; session_cost_usd (None cases + assistant-only sum); explicit-vs-env key precedence; sub-agent temperature/env-key plumbing; a Google cached-token regression test. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Phase A of the roadmap (see
0_articles/yoagent/roadmap.md): every first-impression and grep-trust gap from the library audit, before the 0.10 ergonomics work.Funnel
//!docs with the quick-start example (compiles as a doctest);documentationpoints at docs.rs.0.6→0.9), per-provider capability caveats stated honestly, registry claim corrected.ANTHROPIC_API_KEYetc. resolved automatically per provider whenwith_api_keyisn't called (explicit key always wins;resolve_api_keydocuments the full table incl. the Bedrock composite and the Vertex OAuth exception).Trust — dead features wired
CostConfig→cost_usd()+Agent::session_cost_usd().ContextTracker→ drives loop compaction sizing (real usage calibrates the estimation budget; re-baselines after compaction).ModelConfig.reasoning→ warns when thinking is requested on a non-reasoning model.Papercuts
with_temperature(Agent + SubAgentTool, which silently dropped it before) ·Retry-Afterparsed intoRateLimited.retry_after_ms· warnings on the 4 providers that ignorethinking_level· documented panic contracts onprompt*/continue_loop*.CI/deps
macOS test matrix + Windows compile-check + MSRV(1.85) job ·
serde_yaml(archived) →serde_yaml_ng· tokio trimmed fromfullto the 7 features used.All 14 test suites pass; clippy
-Dwarnings --all-featuresclean;RUSTDOCFLAGS=-Dwarnings cargo docclean.🤖 Generated with Claude Code