Skip to content

feat: adoption funnel and trust fixes (roadmap phase A)#58

Merged
yuanhao merged 3 commits into
mainfrom
feat/adoption-funnel
Jul 5, 2026
Merged

feat: adoption funnel and trust fixes (roadmap phase A)#58
yuanhao merged 3 commits into
mainfrom
feat/adoption-funnel

Conversation

@yuanhao

@yuanhao yuanhao commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

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.rs landing page exists now — crate-level //! docs with the quick-start example (compiles as a doctest); documentation points at docs.rs.
  • README: install version fixed (0.60.9), per-provider capability caveats stated honestly, registry claim corrected.
  • Env-var API keys: ANTHROPIC_API_KEY etc. resolved automatically per provider when with_api_key isn't called (explicit key always wins; resolve_api_key documents the full table incl. the Bedrock composite and the Vertex OAuth exception).

Trust — dead features wired

  • CostConfigcost_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.
  • CLAUDE.md corrected where it described code that didn't exist.

Papercuts

with_temperature (Agent + SubAgentTool, which silently dropped it before) · Retry-After parsed into RateLimited.retry_after_ms · warnings on the 4 providers that ignore thinking_level · documented panic contracts on prompt*/continue_loop*.

CI/deps

macOS test matrix + Windows compile-check + MSRV(1.85) job · serde_yaml (archived) → serde_yaml_ng · tokio trimmed from full to the 7 features used.

All 14 test suites pass; clippy -Dwarnings --all-features clean; RUSTDOCFLAGS=-Dwarnings cargo doc clean.

🤖 Generated with Claude Code

yuanhao and others added 3 commits July 5, 2026 19:25
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>
@yuanhao yuanhao merged commit 2d6dbd6 into main Jul 5, 2026
4 checks passed
@yuanhao yuanhao deleted the feat/adoption-funnel branch July 5, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant