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

5 Commits

Author SHA1 Message Date
HAL9000 7f30f4f21a refactor(actor): remove dead code in v3 actor extraction (issue #11189)
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
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
2026-05-28 21:30:31 -04:00
HAL9000 aecbaa00f6 fix(actor): resolve CI failures for config-actor format PR
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
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
2026-05-28 20:47:07 -04:00
controller-ci-rerun 32a23f32a6 chore: re-trigger CI [controller]
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-28 20:25:17 -04:00
HAL9000 d8a42a6433 Cleanup: remove dev artifacts and fix typo in docstring 2026-05-28 20:25:17 -04:00
freemo 7b91b66b28 Fix actor add --config crash with combined-format config.actor (#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
2026-05-28 20:25:17 -04:00