fix(actor): resolve provider from explicit field in v3 YAML before inferring from model #10930

Merged
hurui200320 merged 1 commit from bugfix/m3-v3-actor-provider-resolution into master 2026-04-30 02:28:35 +00:00
Member

Summary

Two bugs prevented built-in LLM actors from working with models that lack a / separator (e.g. claude-sonnet-4-20250514):

  1. _generate_builtin_actor_yaml (actor/registry.py) was constructing the model field as {provider}/{model}, which caused 404 errors on the Anthropic API. Fixed to use the bare model identifier and lowercase the provider field to match ProviderType enum values.

  2. _build_from_v3 (reactive/config_parser.py) always inferred the provider from the model string. For bare model IDs without /, this returned "custom" (invalid), causing Unknown provider type: custom. Fixed by checking for an explicit top-level provider field in the v3 YAML data per spec resolution order before falling back to inference.

As a side effect, these fixes also resolve issue #10861: agents actor run now successfully invokes the LLM for built-in actors.

Changes

  • src/cleveragents/actor/registry.py: In _generate_builtin_actor_yaml, use bare model identifier and lowercase provider.
  • src/cleveragents/reactive/config_parser.py: In _build_from_v3, check explicit provider field before calling infer_provider_from_model().
  • features/builtin_actor_v3_yaml.feature: 3 new TDD scenarios for the registry fix.
  • features/actor_v3_route_synthesis.feature: 3 new TDD scenarios for the config parser fix.
  • features/steps/builtin_actor_v3_yaml_steps.py: should not contain assertion step added.
  • features/steps/actor_v3_route_synthesis_steps.py: New Given steps for explicit/no-provider configs.
  • features/tdd_actor_run_response.feature: Removed @tdd_expected_fail (bug #10861 fixed).

Quality Gates

  • lint ✓
  • typecheck ✓
  • unit_tests ✓ (671 features, 15673 scenarios, 0 failures)
  • integration_tests ✓ (1997/1997)
  • coverage_report ✓ (97.12% ≥ 97%)

Closes #10926

## Summary Two bugs prevented built-in LLM actors from working with models that lack a `/` separator (e.g. `claude-sonnet-4-20250514`): 1. **`_generate_builtin_actor_yaml`** (`actor/registry.py`) was constructing the `model` field as `{provider}/{model}`, which caused 404 errors on the Anthropic API. Fixed to use the bare model identifier and lowercase the provider field to match `ProviderType` enum values. 2. **`_build_from_v3`** (`reactive/config_parser.py`) always inferred the provider from the model string. For bare model IDs without `/`, this returned `"custom"` (invalid), causing `Unknown provider type: custom`. Fixed by checking for an explicit top-level `provider` field in the v3 YAML data per spec resolution order before falling back to inference. As a side effect, these fixes also resolve issue #10861: `agents actor run` now successfully invokes the LLM for built-in actors. ## Changes - `src/cleveragents/actor/registry.py`: In `_generate_builtin_actor_yaml`, use bare model identifier and lowercase provider. - `src/cleveragents/reactive/config_parser.py`: In `_build_from_v3`, check explicit `provider` field before calling `infer_provider_from_model()`. - `features/builtin_actor_v3_yaml.feature`: 3 new TDD scenarios for the registry fix. - `features/actor_v3_route_synthesis.feature`: 3 new TDD scenarios for the config parser fix. - `features/steps/builtin_actor_v3_yaml_steps.py`: `should not contain` assertion step added. - `features/steps/actor_v3_route_synthesis_steps.py`: New `Given` steps for explicit/no-provider configs. - `features/tdd_actor_run_response.feature`: Removed `@tdd_expected_fail` (bug #10861 fixed). ## Quality Gates - lint ✓ - typecheck ✓ - unit_tests ✓ (671 features, 15673 scenarios, 0 failures) - integration_tests ✓ (1997/1997) - coverage_report ✓ (97.12% ≥ 97%) Closes #10926
hurui200320 added this to the v3.2.0 milestone 2026-04-29 10:10:29 +00:00
Author
Member

image

Tested the branch locally, anthropic provider is working as expected with this PR.

![image](/attachments/86b9fa93-c504-4a9d-b2fb-fb138570631a) Tested the branch locally, anthropic provider is working as expected with this PR.
hurui200320 force-pushed bugfix/m3-v3-actor-provider-resolution from 96467032df
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / push-validation (pull_request) Successful in 28s
CI / helm (pull_request) Successful in 41s
CI / build (pull_request) Successful in 58s
CI / lint (pull_request) Failing after 1m29s
CI / quality (pull_request) Successful in 1m30s
CI / typecheck (pull_request) Successful in 1m50s
CI / security (pull_request) Successful in 1m49s
CI / integration_tests (pull_request) Successful in 3m29s
CI / e2e_tests (pull_request) Successful in 4m1s
CI / unit_tests (pull_request) Failing after 6m20s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Waiting to run
to 920083f636
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / helm (pull_request) Successful in 28s
CI / push-validation (pull_request) Successful in 27s
CI / lint (pull_request) Successful in 55s
CI / build (pull_request) Successful in 54s
CI / quality (pull_request) Successful in 1m26s
CI / typecheck (pull_request) Successful in 1m50s
CI / security (pull_request) Successful in 1m50s
CI / integration_tests (pull_request) Successful in 3m56s
CI / e2e_tests (pull_request) Successful in 4m29s
CI / unit_tests (pull_request) Failing after 6m14s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 3s
2026-04-29 10:18:56 +00:00
Compare
hurui200320 force-pushed bugfix/m3-v3-actor-provider-resolution from 920083f636
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / helm (pull_request) Successful in 28s
CI / push-validation (pull_request) Successful in 27s
CI / lint (pull_request) Successful in 55s
CI / build (pull_request) Successful in 54s
CI / quality (pull_request) Successful in 1m26s
CI / typecheck (pull_request) Successful in 1m50s
CI / security (pull_request) Successful in 1m50s
CI / integration_tests (pull_request) Successful in 3m56s
CI / e2e_tests (pull_request) Successful in 4m29s
CI / unit_tests (pull_request) Failing after 6m14s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 3s
to 3157f25bf1
Some checks failed
CI / coverage (pull_request) Blocked by required conditions
CI / docker (pull_request) Blocked by required conditions
CI / status-check (pull_request) Blocked by required conditions
CI / unit_tests (pull_request) Has started running
CI / integration_tests (pull_request) Has started running
CI / e2e_tests (pull_request) Has started running
CI / benchmark-publish (pull_request) Has been skipped
CI / push-validation (pull_request) Successful in 32s
CI / helm (pull_request) Successful in 38s
CI / build (pull_request) Successful in 1m3s
CI / lint (pull_request) Failing after 1m32s
CI / quality (pull_request) Successful in 1m33s
CI / typecheck (pull_request) Successful in 1m39s
CI / security (pull_request) Successful in 1m39s
2026-04-29 10:56:59 +00:00
Compare
hurui200320 force-pushed bugfix/m3-v3-actor-provider-resolution from 3157f25bf1
Some checks failed
CI / coverage (pull_request) Blocked by required conditions
CI / docker (pull_request) Blocked by required conditions
CI / status-check (pull_request) Blocked by required conditions
CI / unit_tests (pull_request) Has started running
CI / integration_tests (pull_request) Has started running
CI / e2e_tests (pull_request) Has started running
CI / benchmark-publish (pull_request) Has been skipped
CI / push-validation (pull_request) Successful in 32s
CI / helm (pull_request) Successful in 38s
CI / build (pull_request) Successful in 1m3s
CI / lint (pull_request) Failing after 1m32s
CI / quality (pull_request) Successful in 1m33s
CI / typecheck (pull_request) Successful in 1m39s
CI / security (pull_request) Successful in 1m39s
to 0526ea4c5c
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 1m5s
CI / quality (pull_request) Successful in 1m23s
CI / typecheck (pull_request) Successful in 1m38s
CI / security (pull_request) Successful in 1m41s
CI / integration_tests (pull_request) Successful in 3m54s
CI / unit_tests (pull_request) Successful in 4m41s
CI / build (pull_request) Successful in 37s
CI / e2e_tests (pull_request) Successful in 5m43s
CI / helm (pull_request) Successful in 27s
CI / push-validation (pull_request) Successful in 23s
CI / docker (pull_request) Successful in 1m29s
CI / coverage (pull_request) Successful in 10m53s
CI / status-check (pull_request) Successful in 3s
2026-04-29 11:00:57 +00:00
Compare
Author
Member

@HAL9000 please review this PR

@HAL9000 please review this PR
HAL9000 approved these changes 2026-04-29 18:16:30 +00:00
HAL9000 left a comment

Review Summary

PR #10930 — fix(actor): resolve provider from explicit field in v3 YAML before inferring from model
Closes: #10926 (and side-effect fix for #10861)

Issues Addressed

All acceptance criteria from issue #10926 have been met:

  • _build_from_v3 checks for explicit provider field before inferring from model
  • _generate_builtin_actor_yaml generates model as bare identifier (no provider prefix)
  • _generate_builtin_actor_yaml generates provider in lowercase
  • Existing actors with / in the model string continue to work via inference fallback
  • All existing tests pass (671 features, 15,673 scenarios, 0 failures)

Spec Alignment

The provider resolution fix in _build_from_v3 correctly implements the spec resolution order (line 21412): CLI override → top-level provider/model keys → provider_type/model_id aliases → v2-extracted values. The explicit top-level provider field is now checked as step 2 before falling back to infer_provider_from_model().

10-Category Review

  1. Correctness — Both bug fixes are precisely targeted. The bare-model fix prevents 404s on Anthropic API; the explicit-provider fix prevents the Unknown provider type: custom crash for models without /.

  2. Specification Alignment — Follows the provider/model resolution order defined in docs/specification.md at line 21412. The ActorConfigSchema.provider field (line 747) is respected as the spec requires.

  3. Test Quality — 6 well-named TDD scenarios (3 per component), covering: explicit provider without slash, inference from slash-containing model, and no-provider fallback to custom. The TDD regression test for #10861 had @tdd_expected_fail removed. Coverage at 97.12% meets the ≥97% gate.

  4. Type Safety — All signatures annotated; isinstance(explicit_provider, str) type guard used; no # type: ignore present.

  5. Readability — Clear variable names (explicit_provider), descriptive scenario titles, comments referencing spec lines and issue numbers.

  6. Performance — No changes to algorithmic complexity; only a single dict lookup added.

  7. Security — No new attack surface; no secrets/tokens introduced.

  8. Code Style — SOLID principles followed; small focused changes; all files well under 500 lines; follows ruff conventions.

  9. Documentation — Inline comments explain the spec-alignment (# m11: Resolve provider per spec resolution order). PR body is comprehensive.

  10. Commit and PR Quality — PR description matches issue metadata; correct milestone (v3.2.0, milestone m3); one Type/Bug label; CI green across all 14 checks.

Non-Blocking Suggestions

  • The docstring in features/steps/tdd_actor_run_response_steps.py still says "The @tdd_expected_fail tag inverts the result so CI passes while the bug exists." Consider adding a note that the tag was removed after the fix, for future maintainers.

Verdict: APPROVED

All acceptance criteria met, all CI gates passing (lint, typecheck, security, unit_tests, integration_tests, coverage at 97.12%), code is correct and spec-aligned. Changes are minimal, well-tested, and focused.

## Review Summary **PR #10930** — fix(actor): resolve provider from explicit field in v3 YAML before inferring from model **Closes:** #10926 (and side-effect fix for #10861) ### Issues Addressed All acceptance criteria from issue #10926 have been met: - [x] `_build_from_v3` checks for explicit `provider` field before inferring from model - [x] `_generate_builtin_actor_yaml` generates `model` as bare identifier (no provider prefix) - [x] `_generate_builtin_actor_yaml` generates `provider` in lowercase - [x] Existing actors with `/` in the model string continue to work via inference fallback - [x] All existing tests pass (671 features, 15,673 scenarios, 0 failures) ### Spec Alignment The provider resolution fix in `_build_from_v3` correctly implements the spec resolution order (line 21412): CLI override → top-level `provider`/`model` keys → `provider_type`/`model_id` aliases → v2-extracted values. The explicit top-level `provider` field is now checked as step 2 before falling back to `infer_provider_from_model()`. ### 10-Category Review 1. **Correctness** ✅ — Both bug fixes are precisely targeted. The bare-model fix prevents 404s on Anthropic API; the explicit-provider fix prevents the `Unknown provider type: custom` crash for models without `/`. 2. **Specification Alignment** ✅ — Follows the provider/model resolution order defined in docs/specification.md at line 21412. The `ActorConfigSchema.provider` field (line 747) is respected as the spec requires. 3. **Test Quality** ✅ — 6 well-named TDD scenarios (3 per component), covering: explicit provider without slash, inference from slash-containing model, and no-provider fallback to `custom`. The TDD regression test for #10861 had `@tdd_expected_fail` removed. Coverage at 97.12% meets the ≥97% gate. 4. **Type Safety** ✅ — All signatures annotated; `isinstance(explicit_provider, str)` type guard used; no `# type: ignore` present. 5. **Readability** ✅ — Clear variable names (`explicit_provider`), descriptive scenario titles, comments referencing spec lines and issue numbers. 6. **Performance** ✅ — No changes to algorithmic complexity; only a single dict lookup added. 7. **Security** ✅ — No new attack surface; no secrets/tokens introduced. 8. **Code Style** ✅ — SOLID principles followed; small focused changes; all files well under 500 lines; follows ruff conventions. 9. **Documentation** ✅ — Inline comments explain the spec-alignment (`# m11: Resolve provider per spec resolution order`). PR body is comprehensive. 10. **Commit and PR Quality** ✅ — PR description matches issue metadata; correct milestone (v3.2.0, milestone m3); one `Type/Bug` label; CI green across all 14 checks. ### Non-Blocking Suggestions - The docstring in `features/steps/tdd_actor_run_response_steps.py` still says "The @tdd_expected_fail tag inverts the result so CI passes while the bug exists." Consider adding a note that the tag was removed after the fix, for future maintainers. ### Verdict: APPROVED All acceptance criteria met, all CI gates passing (lint, typecheck, security, unit_tests, integration_tests, coverage at 97.12%), code is correct and spec-aligned. Changes are minimal, well-tested, and focused.
Owner

Review completed: APPROVED

All acceptance criteria met. Changes are correctly targeted, spec-aligned, and well-tested. Full review summary posted on the PR.


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker

Review completed: **APPROVED** ✅ All acceptance criteria met. Changes are correctly targeted, spec-aligned, and well-tested. Full review summary posted on the PR. --- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
hurui200320 scheduled this pull request to auto merge when all checks succeed 2026-04-30 02:04:56 +00:00
hurui200320 force-pushed bugfix/m3-v3-actor-provider-resolution from 0526ea4c5c
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 1m5s
CI / quality (pull_request) Successful in 1m23s
CI / typecheck (pull_request) Successful in 1m38s
CI / security (pull_request) Successful in 1m41s
CI / integration_tests (pull_request) Successful in 3m54s
CI / unit_tests (pull_request) Successful in 4m41s
CI / build (pull_request) Successful in 37s
CI / e2e_tests (pull_request) Successful in 5m43s
CI / helm (pull_request) Successful in 27s
CI / push-validation (pull_request) Successful in 23s
CI / docker (pull_request) Successful in 1m29s
CI / coverage (pull_request) Successful in 10m53s
CI / status-check (pull_request) Successful in 3s
to caf146e132
Some checks failed
CI / benchmark-publish (push) Failing after 39s
CI / helm (push) Successful in 38s
CI / build (push) Successful in 54s
CI / lint (push) Successful in 1m2s
CI / push-validation (push) Successful in 21s
CI / quality (push) Successful in 1m26s
CI / typecheck (push) Successful in 1m46s
CI / security (push) Successful in 1m51s
CI / integration_tests (push) Successful in 4m16s
CI / unit_tests (push) Successful in 4m56s
CI / e2e_tests (push) Successful in 4m56s
CI / docker (push) Successful in 1m49s
CI / coverage (push) Successful in 10m51s
CI / status-check (push) Successful in 3s
CI / benchmark-publish (pull_request) Has been skipped
CI / coverage (pull_request) Successful in 14m50s
CI / docker (pull_request) Successful in 1m58s
CI / quality (pull_request) Successful in 1m18s
CI / e2e_tests (pull_request) Successful in 3m53s
CI / integration_tests (pull_request) Successful in 6m34s
CI / unit_tests (pull_request) Successful in 8m47s
CI / push-validation (pull_request) Successful in 20s
CI / lint (pull_request) Successful in 1m19s
CI / typecheck (pull_request) Successful in 1m26s
CI / security (pull_request) Successful in 1m31s
CI / helm (pull_request) Successful in 36s
CI / build (pull_request) Successful in 43s
CI / status-check (pull_request) Successful in 5s
2026-04-30 02:05:15 +00:00
Compare
hurui200320 deleted branch bugfix/m3-v3-actor-provider-resolution 2026-04-30 02:28:36 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core!10930
No description provided.