Route the 'agents actor add' CLI command through ActorRegistry.add() instead
of the legacy registry.upsert_actor() path. This ensures the original YAML
text, schema_version, and compiled_metadata are preserved in the database.
Changes:
- src/cleveragents/cli/commands/actor.py: Add _load_config_text() helper that
returns both raw text and parsed dict. Refactor add() to call registry.add()
with the raw yaml_text and update=update_existing flag when a registry is
available. The service fallback path (no registry) is unchanged.
- features/steps/actor_cli_steps.py: Update add command step definitions to
mock registry.add() instead of registry.upsert_actor(). Update 'the actor
add should pass the loaded config' assertion to verify registry.add() is
called with a non-empty yaml_text string.
- features/steps/actor_cli_yaml_steps.py: Update add command steps to mock
registry.add() instead of registry.upsert_actor().
- features/steps/actor_add_rich_output_steps.py: Update add command steps to
mock registry.add() instead of registry.upsert_actor().
- robot/helper_actor_add_rich_output.py: Update helper to mock registry.add()
instead of registry.upsert_actor().
- features/actor_add_yaml_first_path.feature: New Behave feature verifying
the YAML-first persistence path is used by actor add.
- features/steps/actor_add_yaml_first_path_steps.py: Step definitions for
the new YAML-first path feature.
- robot/actor_add_yaml_first_path.robot: New Robot integration tests verifying
yaml_text is preserved and upsert_actor is not called.
- robot/helper_actor_add_yaml_first_path.py: Helper script for Robot tests.
Fixes#3426
ISSUES CLOSED: #3426
Implements the spec-required JSON/YAML output envelope for all CLI commands
that use format_output(). The envelope structure is:
{
"command": "<command that was run>",
"status": "ok" | "warn" | "error",
"exit_code": 0,
"data": { ... command-specific payload ... },
"timing": { "duration_ms": 123 },
"messages": [{ "level": "ok", "text": "..." }]
}
Changes:
- Add _build_envelope() helper to construct the spec-required envelope
- Add optional command, status, exit_code, messages parameters to format_output()
- Wrap json/yaml output in the envelope; plain/table/rich/color unchanged
- Add timing measurement (duration_ms) to all json/yaml outputs
- Add new BDD feature file (cli_json_envelope.feature) with 14 scenarios
testing envelope field presence, values, and data payload
- Update 14 existing step files to unwrap the envelope when checking
specific data keys (backward-compatible via _unwrap_envelope() helper)
Closes#3431
Replaces hardcoded 0 values in the Impact panel of `agents actor remove` with real DB-backed counts for sessions, active plans, and actions referencing the removed actor.
ISSUES CLOSED: #3420
Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
The spec (docs/reference/actor_cli.md) defines the synopsis for
`agents actor add` as:
agents actor add <NAME> --config <FILE> [--update] [--unsafe]
[--set-default] [--option key=value] [--format FORMAT]
The implementation was missing the required <NAME> positional argument,
silently reading the actor name from the config file's `name` field
instead. This deviates from the spec and breaks the expected CLI UX.
Changes:
- Add `name` as a required positional Argument to the `add` command
- Update docstring to match spec synopsis exactly
- The positional NAME takes precedence over any `name` field in config
- Remove the now-redundant config-file name validation (name comes from CLI)
- Add Behave BDD feature + steps for the NAME positional argument (TDD)
- Update all existing Behave step invocations to pass NAME positional arg
- Update Robot Framework helpers to pass NAME positional arg
ISSUES CLOSED: #2905
Fix all failing CI quality gates (lint, unit_tests, format) without
suppressing any quality enforcement.
Root causes and fixes:
1. Format: features/steps/plan_namespaced_name_tdd_steps.py had trailing
whitespace; fixed by running ruff format.
2. Unit tests - A2A JSON-RPC 2.0 migration (commit 9c6d6915) renamed
A2aRequest fields (operation→method, request_id→id, a2a_version→jsonrpc)
and A2aResponse fields (status+data→result, request_id→id) but did not
update all step files and feature files:
- a2a_jsonrpc_wire_format_steps.py: added use_step_matcher('re') and
reset to 'parse' at end to prevent parallel test interference
- a2a_facade_wiring_steps.py: updated operation= to method=, .status/.data
to .result
- a2a_facade_steps.py: updated request_id→id, a2a_version→jsonrpc,
A2aResponse(request_id=..., status=...) to new API
- m6_facade_steps.py: updated all old API usage
- devcontainer_cleanup_steps.py: updated A2aRequest(operation=...)
- plan_prompt_command_steps.py: updated A2aRequest(operation=...)
- wf03_plan_prompt_confidence_steps.py: updated A2aRequest(operation=...)
- consolidated_misc.feature: updated old A2aRequest/A2aResponse scenarios
3. Unit tests - Session CLI output changed (commit 0d5d9cf0 and others):
- 'Session Created' → 'Session created' (lowercase)
- 'Session Details' → 'Session Summary'
- 'Sessions (N total)' → 'Sessions'
- session list JSON: top-level 'total' → nested 'summary.total'
- Fixed in: session_cli.feature, session_cli_coverage_boost.feature,
session_cli_uncovered_branches.feature, session_list_error.feature,
tdd_session_create_persist_steps.py
4. Unit tests - Plan list output changed (commit 1a07a891):
- 'V3 Lifecycle Plans' → 'Plans'
- 'Lifecycle Plans' → 'Plans'
- Name column removed (restored in source)
- Invariants column removed (restored in source)
- Project truncation removed (restored in source)
- Fixed in: plan_cli_cancel_revert_coverage.feature,
plan_lifecycle_cli_coverage.feature, plan_cli_coverage_boost_steps.py,
plan.py (source code restored)
5. Unit tests - Plan apply command now requires ULID (commit 300a5d6d):
- plan_cli_coverage_r3.feature: updated 'PLAN-001' to valid ULID
- plan_cli_coverage_r3_steps.py: added --yes flag, added new step for
no-eligible-plans path
6. Unit tests - Various source code bugs:
- ThoughtBlock: converted from @dataclass to Pydantic BaseModel
(architecture test requires all dataclasses to use Pydantic)
- session.py: added DatabaseError handling to export, import, tell commands
- database.py: fixed rollback_to() to reuse checkpoint connection for writes
- database.py: added _get_checkpoint_conn() helper
- check-tls-cert.py: fixed SSLCertVerificationError.reason AttributeError
7. Unit tests - Test step bugs:
- error_recovery_coverage_boost_steps.py: fixed invalid ULID _PLAN_ID
- session_service_coverage_steps.py: fixed 'sha256:' prefix bug in checksum
- database_models_new_coverage_steps.py: added 'name' field to session mock
- async_audit_recording_steps.py: fixed Settings(audit_async=False) via env var
- coverage_threshold_config_steps.py: added --coverage-min pattern support
- m5_acms_smoke_steps.py: updated usage hint text
- actor_cli_yaml_steps.py: updated 'Removed actor' → 'Actor removed'
- aimodelscredentials_steps.py: set context.imported_class in import step
- domain_base_model.feature: added missing 'When I examine model_config' step
- tui_first_run_steps.py: fixed module reload to restore cleveragents.tui.*
modules after test (prevented patch interference in subsequent tests)
- tui_first_run_steps.py: added set_search('') step for empty string
- resource_handler_base_coverage_r3_steps.py: use _MinimalHandler instead
of DatabaseResourceHandler for NotImplementedError tests
- resource_handler_crud.feature: updated to test new DatabaseHandler behavior
- resource_handler_sandbox.feature: updated to test new DatabaseHandler behavior
- tdd_json_decode_crash_persistence.feature: fixed @tdd_bug → @tdd_issue tags
8. Parallel test interference:
- All step files using use_step_matcher('re') now reset to 'parse' at end
to prevent global matcher state leaking to subsequent step files
Remove the <NAME> positional argument from `actor add` command. The actor
name is now derived from the `name` field inside the config YAML file, per
the specification: `agents actor add (--config|-c) <FILE> [--update]`.
Updated all BDD and integration tests to pass name via config file.
ISSUES CLOSED: #914
Align actor add/remove/list/show commands to YAML-first configs,
namespaced names, and --format json|yaml|plain output support.
Changes:
- Add --format option to list, show, add, and update commands
- Add --update flag to add command for updating existing actors
- Add _actor_spec_dict helper for structured output serialization
- Update _print_actor to support format_output rendering
- Add Behave feature tests for CLI format scenarios (11 scenarios)
- Add Robot Framework integration test for show output fields
- Add ASV benchmark for actor CLI parsing overhead
- Add CLI reference documentation for actor commands
ISSUES CLOSED: #288