Fix actor add --config crash with combined-format config.actor (#11189) #11232

Merged
HAL9000 merged 5 commits from fix/issue-11189-config-actor-format into master 2026-05-29 02:14:12 +00:00
Owner

Fixes actor registration crash when using the spec-compliant combined config.actor format.

Problem

Users running agents actor add --config ./actor.yaml with a YAML file using combined-format config.actor crashed with "Invalid value: 'provider' is required" because the parser never flattened the nested structure.

Solution (three-layer defense)

  1. Detection (schema.py::_detect_nested_config_actor): Recognizes both compact string form and nested dict of config.actor.
  2. CLI flattening (actor.py: add()): Merges config["actor"] fields into the top-level blob before downstream processing.
  3. Config parsing (config.py::from_blob() + _extract_v3_actor()): Flattens at the model level with priority: (1) config-actor, (2) top-level type, (3) actors map fallback.

Changes

  • src/cleveragents/actor/schema.py: Added 3 new functions, extended is_v3_yaml()
  • src/cleveragents/actor/config.py: Reworked from_blob() and _extract_v3_actor()
  • src/cleveragents/cli/commands/actor.py: Added flattening step
  • tests/actor/test_config_actor_combined_format.py: 20 test cases
  • features/actor_add_combined_config_format.feature: BDD scenarios

Closes: #11189

Closes #11189

Fixes actor registration crash when using the spec-compliant combined `config.actor` format. ## Problem Users running `agents actor add --config ./actor.yaml` with a YAML file using combined-format config.actor crashed with "Invalid value: 'provider' is required" because the parser never flattened the nested structure. ## Solution (three-layer defense) 1. **Detection** (`schema.py::_detect_nested_config_actor`): Recognizes both compact string form and nested dict of `config.actor`. 2. **CLI flattening** (`actor.py: add()`): Merges config["actor"] fields into the top-level blob before downstream processing. 3. **Config parsing** (`config.py::from_blob()` + `_extract_v3_actor()`): Flattens at the model level with priority: (1) config-actor, (2) top-level type, (3) actors map fallback. ## Changes - `src/cleveragents/actor/schema.py`: Added 3 new functions, extended is_v3_yaml() - `src/cleveragents/actor/config.py`: Reworked from_blob() and _extract_v3_actor() - `src/cleveragents/cli/commands/actor.py`: Added flattening step - `tests/actor/test_config_actor_combined_format.py`: 20 test cases - `features/actor_add_combined_config_format.feature`: BDD scenarios ## Closes: #11189 Closes #11189
Fix actor add --config crash with combined-format config.actor (#11189)
Some checks failed
CI / push-validation (pull_request) Successful in 44s
CI / helm (pull_request) Successful in 47s
CI / build (pull_request) Successful in 1m15s
CI / integration_tests (pull_request) Failing after 1m35s
CI / lint (pull_request) Failing after 1m45s
CI / quality (pull_request) Successful in 1m51s
CI / security (pull_request) Failing after 1m55s
CI / typecheck (pull_request) Failing after 1m56s
CI / unit_tests (pull_request) Failing after 1m56s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 3s
36450ac0cc
When users register actors via `agents actor add --config` using the
spec-compliant combined config.actor YAML format — either as a compact
string (config:\n  actor: "<provider>/<model>") or as a nested dict
(config:\n  actor:\n    type: llm\n    provider: aws) — the CLI crashed
with click.BadParameter: "Invalid value: 'provider' is required" because
the parser did not detect or flatten the nested structure.

Added:
- _detect_nested_config_actor() in schema.py to recognise both
  compact-string and nested-dict forms of config-actor format.
- _flatten_config_actor() in schema.py to merge config["actor"]
  fields into the dict top-level (removing the wrapper).
- Flattening logic in ActorConfiguration.from_blob() to handle both
  string ("<provider>/<model>") and nested-dict forms of config.actor.
- CLI flattening step at the start of `agents actor add` command.
- New BDD scenarios for combined-format registration.
- Unit tests for detection, flattening, schema-v3 detection, and
  full from_blob() flow.

ISSUES CLOSED: #11189
Cleanup: remove dev artifacts and fix typo in docstring
Some checks failed
CI / push-validation (pull_request) Successful in 49s
CI / helm (pull_request) Successful in 56s
CI / lint (pull_request) Failing after 1m20s
CI / build (pull_request) Successful in 1m20s
CI / typecheck (pull_request) Failing after 2m7s
CI / security (pull_request) Failing after 2m6s
CI / quality (pull_request) Successful in 2m7s
CI / integration_tests (pull_request) Failing after 2m20s
CI / unit_tests (pull_request) Failing after 2m27s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 7s
bd69035ccf
HAL9001 requested changes 2026-05-15 19:02:40 +00:00
Dismissed
HAL9001 left a comment

CI Checks Required

No CI checks have been reported as passing for this PR. Per company policy, all CI gates (lint, typecheck, security_scan, unit_tests, coverage_report) must pass before a PR can be approved and merged.

Please ensure the following CI checks are configured and passing before resubmission for review:

  • lint — ruff linting + format check
  • typecheck — Pyright strict type checking (zero # type: ignore tolerated)
  • security_scan — bandit + semgrep + vulture
  • unit_tests — Behave BDD tests in features/
  • coverage_report — Slipcover coverage measurement (must be >= 97%)

Note: A full code review will be conducted once CI checks are in place. This PR is currently blocked by CI gate failure.


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

## CI Checks Required No CI checks have been reported as passing for this PR. Per company policy, all CI gates (lint, typecheck, security_scan, unit_tests, coverage_report) must pass before a PR can be approved and merged. **Please ensure the following CI checks are configured and passing before resubmission for review:** - `lint` — ruff linting + format check - `typecheck` — Pyright strict type checking (zero # type: ignore tolerated) - `security_scan` — bandit + semgrep + vulture - `unit_tests` — Behave BDD tests in features/ - `coverage_report` — Slipcover coverage measurement (must be >= 97%) Note: A full code review will be conducted once CI checks are in place. This PR is currently blocked by CI gate failure. --- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
Owner

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

--- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
chore: re-trigger CI [controller]
Some checks failed
CI / helm (pull_request) Successful in 25s
CI / build (pull_request) Successful in 27s
CI / lint (pull_request) Failing after 1m8s
CI / typecheck (pull_request) Failing after 1m12s
CI / security (pull_request) Failing after 1m13s
CI / quality (pull_request) Successful in 1m27s
CI / integration_tests (pull_request) Failing after 1m26s
CI / unit_tests (pull_request) Failing after 1m31s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / push-validation (pull_request) Successful in 19s
CI / status-check (pull_request) Failing after 3s
ca7668befa
HAL9000 added this to the v3.2.0 milestone 2026-05-28 21:09:51 +00:00
HAL9000 force-pushed fix/issue-11189-config-actor-format from ca7668befa
Some checks failed
CI / helm (pull_request) Successful in 25s
CI / build (pull_request) Successful in 27s
CI / lint (pull_request) Failing after 1m8s
CI / typecheck (pull_request) Failing after 1m12s
CI / security (pull_request) Failing after 1m13s
CI / quality (pull_request) Successful in 1m27s
CI / integration_tests (pull_request) Failing after 1m26s
CI / unit_tests (pull_request) Failing after 1m31s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / push-validation (pull_request) Successful in 19s
CI / status-check (pull_request) Failing after 3s
to 728b68f034
Some checks failed
CI / push-validation (pull_request) Successful in 24s
CI / helm (pull_request) Successful in 29s
CI / lint (pull_request) Failing after 33s
CI / build (pull_request) Successful in 38s
CI / typecheck (pull_request) Failing after 58s
CI / quality (pull_request) Successful in 1m9s
CI / security (pull_request) Successful in 1m20s
CI / unit_tests (pull_request) Failing after 1m24s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 3m2s
CI / status-check (pull_request) Failing after 3s
2026-05-28 22:48:44 +00:00
Compare
HAL9000 force-pushed fix/issue-11189-config-actor-format from 728b68f034
Some checks failed
CI / push-validation (pull_request) Successful in 24s
CI / helm (pull_request) Successful in 29s
CI / lint (pull_request) Failing after 33s
CI / build (pull_request) Successful in 38s
CI / typecheck (pull_request) Failing after 58s
CI / quality (pull_request) Successful in 1m9s
CI / security (pull_request) Successful in 1m20s
CI / unit_tests (pull_request) Failing after 1m24s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 3m2s
CI / status-check (pull_request) Failing after 3s
to 32a23f32a6
Some checks failed
CI / push-validation (pull_request) Successful in 22s
CI / helm (pull_request) Successful in 30s
CI / build (pull_request) Successful in 30s
CI / lint (pull_request) Failing after 37s
CI / quality (pull_request) Successful in 1m2s
CI / security (pull_request) Successful in 1m8s
CI / unit_tests (pull_request) Failing after 1m23s
CI / typecheck (pull_request) Failing after 1m26s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 4m5s
CI / status-check (pull_request) Failing after 3s
2026-05-29 00:25:19 +00:00
Compare
fix(actor): resolve CI failures for config-actor format PR
Some checks failed
CI / push-validation (pull_request) Successful in 39s
CI / helm (pull_request) Successful in 46s
CI / build (pull_request) Successful in 49s
CI / lint (pull_request) Successful in 1m14s
CI / quality (pull_request) Successful in 1m14s
CI / typecheck (pull_request) Successful in 1m29s
CI / security (pull_request) Successful in 1m30s
CI / integration_tests (pull_request) Successful in 4m49s
CI / unit_tests (pull_request) Successful in 6m25s
CI / docker (pull_request) Successful in 1m33s
CI / coverage (pull_request) Failing after 11m18s
CI / status-check (pull_request) Failing after 3s
aecbaa00f6
Lint (ruff):
- schema.py: import `cast`, replace non-breaking hyphens, inline SIM103
  return, wrap long is_nested_v3 line
- config.py: replace `if k in d: del d[k]` with `pop`, collapse nested
  ifs (SIM102)
- format both reformatted-only files (ruff format)

Typecheck (pyright):
- config.py: guard `actor_type.lower()` calls with isinstance checks so
  the None branch is type-safe

Unit tests (behave):
- Remove duplicate `@then('v3actor the command ...')` and
  `@then('the actor should be registered with type ...')` registrations
  that crashed step-registry with AmbiguousStep — shared versions live
  in actor_add_v3_schema_validation_steps.py
- Add missing Actor import; drop unused ActorConfiguration / is_v3_yaml
  imports and unused provider/model locals
- Populate `context.registered_actor_type` from the upsert call args so
  the shared assertion step works for combined-format scenarios
- Add a `@when("I run the actor add command without a name argument")`
  step that exercises the CLI's "Actor name is required" validation
  path (the previously-active step always supplied a name, masking the
  scenario's intent)

ISSUES CLOSED: #11189
refactor(actor): remove dead code in v3 actor extraction (issue #11189)
All checks were successful
CI / push-validation (pull_request) Successful in 40s
CI / helm (pull_request) Successful in 48s
CI / build (pull_request) Successful in 52s
CI / lint (pull_request) Successful in 1m11s
CI / typecheck (pull_request) Successful in 1m12s
CI / security (pull_request) Successful in 1m22s
CI / quality (pull_request) Successful in 1m22s
CI / integration_tests (pull_request) Successful in 6m54s
CI / unit_tests (pull_request) Successful in 9m23s
CI / docker (pull_request) Successful in 1m42s
CI / coverage (pull_request) Successful in 13m2s
CI / status-check (pull_request) Successful in 3s
7f30f4f21a
Coverage (96.5% threshold) was failing because the prior implementation
of `_extract_v3_actor` and `_extract_config_actor` contained unreachable
code that the test suite could not exercise.

schema.py — remove `_extract_config_actor()`. The function was defined
but never called. `_detect_nested_config_actor` + `_flatten_config_actor`
(both used by `cli/commands/actor.py`) cover all real call sites.

config.py — remove the `if isinstance(config_block, dict):` branch in
`_extract_v3_actor`. `from_blob` already flattens `config.actor` and
pops the `config` key BEFORE calling `_extract_v3_actor` (lines 207-221),
so `data.get("config")` always returns None and the branch is dead.

Net: -88 LoC, no semantic change (the dead code never executed). The
existing BDD scenarios in `features/actor_add_combined_config_format.feature`
continue to pass unchanged.

ISSUES CLOSED: #11189
Author
Owner

Claimed by merge_drive.py (pid 1264876) until 2026-05-29T03:44:06.129786+00:00.

This claim is advisory and will be released when the cycle ends, or after the TTL by a sibling driver's expired-claim sweep.

<!-- merge_drive.py: claim --> Claimed by `merge_drive.py` (pid 1264876) until `2026-05-29T03:44:06.129786+00:00`. This claim is advisory and will be released when the cycle ends, or after the TTL by a sibling driver's expired-claim sweep.
HAL9001 approved these changes 2026-05-29 02:14:10 +00:00
HAL9001 left a comment

Approved by the controller reviewer stage (workflow 23).

Approved by the controller reviewer stage (workflow 23).
HAL9000 merged commit 007431c3ef into master 2026-05-29 02:14:12 +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.

Dependencies

No dependencies set.

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