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
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
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