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
Implemented a rich output upgrade for the agents plan rollback in the CLI by replacing the previous plain-text output in rollback_plan() with a set of four spec-required Rich panels.
- Rollback Summary panel: includes Plan, Checkpoint, Label (only if available), and Files fields.
- Changes Reverted panel: a Rich table with File and Action columns; supports both dict entries and plain string paths for forward compatibility with issue #2454.
- Impact panel: shows Sandbox state and optional fields Child Plans Invalidated, Decisions After CP, Tool Calls After CP.
- Post-Rollback State panel: includes Phase, State, and optional Checkpoints Remaining fields.
- Confirmation line: "✓ OK Rollback complete" displayed after the panels.
- Tests updated: Updated BDD test assertions in features/plan_cli_coverage_r2.feature to align with new panel-based output.
Key design decisions:
- Used getattr(result, field, None) pattern for optional fields not yet present in RollbackResult model (fields: label, child_plans_invalidated, decisions_after_cp, tool_calls_after_cp, phase, state, checkpoints_remaining) to support forward-compatibility as fields get added.
- Handling mixed formats in changed_paths/changes_reverted: both dict-format entries and string-format paths are supported to remain compatible with issue #2454.
- Sandbox state defaults to "restored to {checkpoint_id}" when not explicitly provided.
Files changed:
- src/cleveragents/cli/commands/plan.py (rollback_plan rich output section)
- features/plan_cli_coverage_r2.feature (updated test assertions)
ISSUES CLOSED: #2591
Renames `plan lifecycle-list` to `plan list` and `plan lifecycle-apply` to `plan apply` to align with the specification's canonical command names. Removes legacy V2 plan commands that occupied those names.
- Renamed CLI command registrations from lifecycle-list/lifecycle-apply to list/apply
- Removed legacy V2 apply and list commands (~200 lines)
- Updated apply shortcut in main.py to delegate to v3 lifecycle
- Added defensive null check for plan existence in apply command
- Updated 63+ test, doc, and benchmark files for consistency
Closes#881
Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>