Commit Graph

848 Commits

Author SHA1 Message Date
freemo 3d7f213527 fix(tdd): replace non-standard @tdd_bug tags with @tdd_issue per CONTRIBUTING.md
Reviewed and APPROVED. Closes #2779.
2026-04-05 21:12:14 +00:00
freemo 54285e0f33 fix(cli): correct session show rich output Session Summary panel field labels and fields
Reviewed and APPROVED. Closes #3040.
2026-04-05 21:12:13 +00:00
freemo 0b8152b9d0 fix(tui): show command descriptions in SlashCommandOverlay alongside command names
Reviewed and APPROVED. Closes #3437.
2026-04-05 21:12:09 +00:00
freemo b6959aeffe fix(actors): enforce --update flag in agents actor add to prevent silent overwrites
Reviewed and APPROVED. Closes #2609.
2026-04-05 21:11:55 +00:00
freemo c8b66c8294 fix(config): align Settings and alembic/env.py database_url defaults to spec-required ~/.cleveragents/cleveragents.db
Reviewed and APPROVED. Closes #2871.
2026-04-05 21:11:53 +00:00
freemo 6be538bd5c fix(resources): add overlay to ResourceTypeConfigSchema sandbox strategy validation
Reviewed and APPROVED. Closes #2827.
2026-04-05 21:11:50 +00:00
freemo 1e3390f228 fix(a2a): update A2aVersionNegotiator to support JSON-RPC 2.0
Reviewed and APPROVED. Closes #2747.
2026-04-05 21:11:40 +00:00
freemo 31b8294f2d fix(tool): wire 6-level execution environment precedence chain in ToolRunner
Reviewed and APPROVED. Closes #2592.
2026-04-05 21:11:38 +00:00
freemo 2a541bb1e1 fix(cli): add Name and Updated columns to agents plan list table output
Reviewed and APPROVED. Closes #2611.
2026-04-05 21:11:36 +00:00
freemo 4aaf865420 fix(acms): implement real retrieval logic in all 6 spec-required context strategies
Reviewed and APPROVED. Priority/Critical fix. Closes #3500.
2026-04-05 21:11:34 +00:00
freemo 869777bb86 fix(tui): add plain text format support to session export command
Reviewed and APPROVED. Closes #3036.
2026-04-05 21:10:16 +00:00
freemo ef557a31a9 fix(a2a): change A2aErrorDetail.code to int and map error constants to JSON-RPC 2.0 integer codes
Reviewed and APPROVED. Closes #2746.
2026-04-05 21:10:14 +00:00
freemo e749513704 fix(persistence): persist reversion_count, last_completed_step, and last_checkpoint_id on LifecyclePlanModel
Reviewed and APPROVED. Closes #2864.
2026-04-05 21:10:10 +00:00
freemo 660a194012 fix(ci): update nightly workflow coverage minimum to 97% per project requirements
Reviewed and APPROVED. Closes #2773.
2026-04-05 21:09:50 +00:00
freemo 86999ea959 fix(config): add server_url, server_token, format, and default_estimation_actor fields to Settings
Reviewed and APPROVED. Closes #2870.
2026-04-05 21:09:46 +00:00
freemo 920faa0dd8 fix(a2a): add A2A Python SDK as project dependency
Reviewed and APPROVED. Closes #2858.
2026-04-05 21:09:44 +00:00
freemo f4233fb3bd fix(config): correct Settings.data_dir default from Path("data") to Path.home() / ".cleveragents"
Reviewed and APPROVED. Closes #2851.
2026-04-05 21:09:36 +00:00
freemo 539f500abe fix(skills): add lowercase-only namespace/name pattern validation to SkillConfigSchema and ActionConfigSchema
Reviewed and APPROVED. Closes #3029.
2026-04-05 21:09:24 +00:00
freemo 2e2202e52f fix(tests): add missing Behave feature file for coverage threshold config
Reviewed and APPROVED. Closes #2767.
2026-04-05 21:09:17 +00:00
freemo eb4ccc819c fix(cli): add NAME positional argument to agents actor add command per spec
Reviewed and APPROVED. Closes #2905.
2026-04-05 21:09:13 +00:00
freemo e5380eabdf fix(acms): align DEFAULT_SKELETON_RATIO default value with spec
Reviewed and APPROVED.
2026-04-05 21:09:10 +00:00
freemo a145986df6 fix(cli): promote --format to global CLI callback option per spec
Reviewed and APPROVED.
2026-04-05 21:09:07 +00:00
freemo e1fbcf6345 fix(sandbox): use spec-required cleveragents/plan- branch naming in git worktree
Reviewed and APPROVED. Closes #2601.
2026-04-05 21:09:04 +00:00
freemo 5824e7c0aa fix(database): move get_all_for_project call outside loop in LegacyDataMigrator
Reviewed and APPROVED. Closes #3047.
2026-04-05 21:08:47 +00:00
freemo db61d66d80 fix(cli): remove --namespace/-n option from agents plan list command
Reviewed and APPROVED. Closes #2986.
2026-04-05 21:08:40 +00:00
freemo 62f90d4db2 fix(a2a): rename A2aErrorDetail.details to data per JSON-RPC 2.0 spec
Reviewed and APPROVED. Closes #2745.
2026-04-05 21:08:36 +00:00
freemo 6e168fe300 fix(skills): replace get_tool() calls with get() in SkillRegistry
Reviewed and APPROVED. Closes #2914.
2026-04-05 21:08:35 +00:00
freemo acb90b812c fix(exceptions): replace Any with str | os.PathLike | None for FileSystemError.path
Reviewed and APPROVED. Closes #3034.
2026-04-05 21:08:31 +00:00
freemo 5cc50f5ca1 fix(cli): build spec-required execute output dict with sandbox, worker, and progress fields
Reviewed and APPROVED. Closes #3435.
2026-04-05 21:08:27 +00:00
freemo cdc93dc3cd fix(resources): support multiple named devcontainer configurations
Reviewed and APPROVED. Closes #2615.
2026-04-05 21:07:42 +00:00
freemo 367a272b60 feat(cli): add devcontainer lifecycle state column to agents resource list output
Reviewed and APPROVED. Closes #2596.
2026-04-05 21:07:40 +00:00
freemo 6c4bea1ba1 fix(tool): implement tool_type filter in ToolRegistry.list_tools()
Reviewed and APPROVED. Closes #2974.
2026-04-05 21:07:33 +00:00
freemo 13eb2a7c8c refactor(cli): deduplicate session list summary logic in list_sessions
Reviewed and APPROVED. Closes #3046.
2026-04-05 21:07:23 +00:00
freemo 63f5269f39 fix(cli): replace manual DI wiring in _get_tool_registry_service with container resolution
Reviewed and APPROVED. Closes #3006.
2026-04-05 21:07:14 +00:00
freemo 096cd79fbf fix(resource-registry): use full inheritance chain in type compatibility check
Reviewed and APPROVED. Closes #2929.
2026-04-05 21:07:11 +00:00
freemo 9bf6b2d7b0 fix(invariant): add frozen=True to Invariant domain models
Reviewed and APPROVED. Closes #3116.
2026-04-05 21:07:09 +00:00
freemo 2a48c508d6 fix(providers): wire OpenAIChatProvider and AnthropicChatProvider into ProviderRegistry
Reviewed and APPROVED. Closes #3427.
2026-04-05 21:07:02 +00:00
freemo e9860e27ec fix(cli): wrap format_output() in spec-required JSON/YAML envelope
Reviewed and APPROVED. Closes #3431.
2026-04-05 21:06:58 +00:00
freemo 3b6e12d8e6 fix(cli): add spec-required Session Export, Contents, and Integrity panels to agents session export
Reviewed and APPROVED. Closes #3424.
2026-04-05 21:06:57 +00:00
freemo bc0852111b fix(cli): add checkpoint label, creation time, and side effects to rollback confirmation prompt
Reviewed and APPROVED. Closes #3443.
2026-04-05 21:06:55 +00:00
freemo 219470f548 fix(tui): synchronize HelpPanelOverlay keybinding display with actual app BINDINGS
Reviewed and APPROVED. Closes #3444.
2026-04-05 21:06:53 +00:00
freemo af9db5ea28 fix(acms): implement real retrieval logic in all 6 spec-required context strategies 2026-04-05 20:56:32 +00:00
freemo 8608584e99 fix(plan-executor): wire SubplanService and SubplanExecutionService into Execute phase
Implemented optional SubplanService and SubplanExecutionService wiring in PlanExecutor.__init__() (None = no-op).
- Added _spawn_subplans() helper:
  - Queries spawn decisions via SubplanService.get_spawn_decisions() and calls SubplanService.spawn() for each decision.
  - No-ops when there are no spawn decisions.
- Added _execute_subplans() helper:
  - Delegates to SubplanExecutionService.execute_all() to run spawned subplans, handling both sequential and parallel groups as dictated by decisions.
- Added _apply_subplan_results_to_plan() helper:
  - Updates parent plan status tracking when child subplans fail.
  - Annotates error_details with failed_subplan_ids when appropriate.
- Integrated spawning and execution into existing flow:
  - Called _spawn_subplans() and _execute_subplans() from both _run_execute_with_runtime() and _run_execute_with_stub() after actor completion.
- Introduced PlanExecutor properties:
  - subplan_service and subplan_execution_service for external wiring and testability.
- Added tests and scenarios:
  - Behave feature file with 6 scenarios covering subplan_spawn, subplan_parallel_spawn, no-op, and failure tracking.
  - Robot Framework integration test suite with 6 end-to-end subplan spawning test cases.

Key design decisions
- Optional services (None = no-op) to maintain backward compatibility with existing deployments.
- Subplan spawning is a no-op when no spawn decisions exist, avoiding unnecessary work.
- Parent plan error_details is annotated with failed_subplan_ids when a child subplan fails to aid debugging and traceability.
- Both runtime and stub execute paths share the same spawning logic to ensure consistent behavior across execution modes.

ISSUES CLOSED: #3561
2026-04-05 20:46:24 +00:00
freemo a0df5a4cd0 fix(cli): wrap format_output() in spec-required JSON/YAML envelope across all CLI commands
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
2026-04-05 19:48:40 +00:00
freemo 631e847497 fix(cli): add checkpoint label, creation time, and side effects to rollback confirmation prompt
Resolves issue #3443: the `agents plan rollback` confirmation prompt was
missing the checkpoint's descriptive label, relative creation time, and
side-effects count (decisions invalidated / child plans cancelled).

Changes:
- Added `_format_relative_time(dt)` helper to produce human-readable
  relative timestamps (e.g. "42 minutes ago", "2 hours ago").
- In `rollback_plan`, moved `get_container()` / `checkpoint_service()`
  before the confirmation block so checkpoint metadata is available.
- When `--yes` is not passed, `svc.get_checkpoint()` is called to fetch
  the checkpoint label (`metadata.reason`) and creation time.
- Decisions created after the checkpoint are counted via
  `decision_service.list_decisions()`; `subplan_spawn` /
  `subplan_parallel_spawn` decisions are counted as child plans.
- Side-effects line is printed before the prompt when counts > 0.
- Falls back to the original simple prompt if checkpoint metadata
  cannot be fetched (e.g. checkpoint not found).
- Updated existing rollback mock helpers to wire `get_checkpoint` and
  `decision_service` properly.
- Added 3 new Behave scenarios covering label display, side-effects
  display, and fallback behaviour.

Closes #3443
2026-04-05 19:46:23 +00:00
freemo a0275f2401 fix(cli): build spec-required execute output dict with sandbox, worker, progress fields in plan execute
Implements the spec-required JSON envelope for `agents plan execute --format json`.

Previously, the command returned the raw plan domain model dict via
`_plan_spec_dict()`, which was missing the sandbox, worker, started,
attempt, strategy_summary, and progress fields required by the spec.

Changes:
- Add `_execute_output_dict(plan, started_at, duration_ms)` function that
  builds the spec-required execute output envelope with:
  - Top-level envelope: command, status, exit_code, data, timing, messages
  - data.sandbox: strategy, path, branch, status (derived from sandbox_refs)
  - data.worker: execution_actor or 'local/executor' fallback
  - data.started: HH:MM:SS from execute_started_at timestamp
  - data.attempt: from plan.identity.attempt
  - data.strategy_summary: decisions, invariants, planned_child_plans,
    estimated_files, risk (from estimation_result when available)
  - data.progress: 4-step list with label/status derived from plan state
- Update `execute_plan()` to track wall-clock start time and use
  `_execute_output_dict()` instead of `_plan_spec_dict()` for non-rich output
- Add BDD tests verifying the spec-required envelope structure, sandbox
  strategy field, and progress list label/status fields

ISSUES CLOSED: #3435
2026-04-05 19:44:17 +00:00
freemo e4493e8978 fix(cli): correct session show rich output Session Summary panel field labels and fields
Fixes three deviations from docs/specification.md in the agents session show
rich output Session Summary panel:

1. Renamed 'Session ID:' label to 'ID:' to match spec exactly.
2. Removed 'Namespace:' field which is not part of the spec.
3. Added 'Automation:' field sourced from session.metadata['automation_profile'],
   defaulting to '(none)' when not set.
4. Field order now matches spec: ID → Actor → Messages → Created → Updated → Automation.

Updated features/session_cli.feature to assert the corrected field labels are
present ('ID:', 'Actor:', 'Messages:', 'Created:', 'Updated:', 'Automation:')
and that the removed fields ('Session ID:', 'Namespace:') are absent.

Added 'the session CLI output should not contain' step definition to
features/steps/session_cli_steps.py to support the new negative assertions.

ISSUES CLOSED: #3040
2026-04-05 19:44:08 +00:00
freemo f510c7b5a3 fix(invariant): add frozen=True to Invariant model config and redesign soft-delete pattern
Replace validate_assignment=True with frozen=True on Invariant,
InvariantViolation, InvariantEnforcementRecord, and InvariantSet models
to enforce the value-object immutability contract required by the spec.

Redesign InvariantService.remove_invariant() to use model_copy(update=
{'active': False}) instead of direct field mutation, since frozen models
raise ValidationError on assignment.

Fix invariant_reconciliation_actor_steps.py step that mutated
inv.non_overridable = True to construct the Invariant directly with
non_overridable=True at creation time.

Add BDD scenarios covering:
- Immutability contract: mutation raises error on all three models
- Hashability: frozen Pydantic v2 models are hashable
- Soft-delete copy-and-replace: removed invariant is a new object

All 266 scenarios pass. Lint and typecheck pass.

ISSUES CLOSED: #3116
2026-04-05 18:20:15 +00:00
freemo 4d32281351 fix(session): correct field names and data types in Session.as_cli_dict() for spec compliance
Fixes issue #3440: agents session show JSON output uses wrong field names and wrong data types.

- Add LinkedPlan value object with plan_id, phase, state fields
- Add automation field to Session domain model
- Rewrite as_cli_dict() with spec-compliant field names in session_summary wrapper
- Use 'text' key in recent_messages items
- Replace linked_plan_ids with linked_plans objects
- Format estimated_cost as string (e.g. '$0.0184')
- Update session show rich output with spec-compliant labels
- Update tests to assert new field names

ISSUES CLOSED: #3440

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-05 18:19:19 +00:00
freemo a804506c89 fix(cli): compute real impact counts in agents actor remove command
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>
2026-04-05 18:18:08 +00:00