fix(cli): implement spec-required structured panels in agents plan explain rich output #3289

Open
freemo wants to merge 3 commits from fix/plan-explain-rich-output-panels into master

3 Commits

Author SHA1 Message Date
HAL9000 04263afbad fix(plan): restore _apply_output_dict and fix explain_decision_cmd plan_id fallback
CI / load-versions (pull_request) Successful in 9s
CI / push-validation (pull_request) Successful in 24s
CI / lint (pull_request) Successful in 24s
CI / typecheck (pull_request) Successful in 1m10s
CI / build (pull_request) Successful in 3m21s
CI / helm (pull_request) Successful in 3m25s
CI / quality (pull_request) Successful in 3m43s
CI / security (pull_request) Successful in 4m33s
CI / unit_tests (pull_request) Failing after 5m24s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 8m29s
CI / status-check (pull_request) Failing after 1s
- Restore deleted _apply_output_dict function (104 lines) that builds the
  spec-required JSON envelope for plan apply output; used by robot integration
  tests via direct import in helper_plan_apply_json_envelope.py
- Restore lifecycle_apply_plan to use _apply_output_dict with full envelope
  format_output call for non-RICH output formats
- Remove re-introduced plan_id fallback from explain_decision_cmd that violated
  the explicit guard from issue #6325 (TDD regression test
  tdd_plan_explain_plan_id.feature); restore strict DecisionNotFoundError
  handling with typer.Exit(1)

ISSUES CLOSED: #6325
2026-06-19 03:31:47 -04:00
controller-ci-rerun 51cae21a97 chore: re-trigger CI [controller]
CI / push-validation (pull_request) Successful in 9s
CI / load-versions (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 48s
CI / security (pull_request) Successful in 1m18s
CI / unit_tests (pull_request) Failing after 1m59s
CI / docker (pull_request) Has been skipped
CI / build (pull_request) Successful in 3m16s
CI / helm (pull_request) Successful in 3m17s
CI / typecheck (pull_request) Successful in 3m38s
CI / lint (pull_request) Successful in 6m35s
CI / coverage (pull_request) Has been skipped
CI / integration_tests (pull_request) Failing after 10m33s
CI / status-check (pull_request) Failing after 3s
2026-06-19 01:57:19 -04:00
freemo 56164b7937 fix(cli): implement spec-required structured panels in agents plan explain rich output
Replace the single flat 'Decision Details' table in explain_decision_cmd()
with six structured Rich panels matching the spec exactly:

- Decision panel: ID, Type, Question, Chosen, Confidence, Plan, Sequence, Created
- Alternatives Considered panel: numbered list with '(chosen)' marker
- Impact panel: Downstream Decisions, Downstream Child Plans, Artifacts Produced,
  Correction Impact (derived from downstream_decision_ids count)
- Context Snapshot panel (--show-context): resource paths + hot context hash
- Rationale panel (--show-reasoning): rationale text
- Correction panel: 'agents plan correct <ID> --mode revert --guidance "..."' hint

Also adds the missing success message '✓ OK Decision explained'.

Updates _build_explain_dict() to:
- Accept total_decisions parameter for 'X of Y' sequence format
- Return structured alternatives list [{index, description, chosen}] instead
  of flat string list
- Include impact dict with downstream_decisions, downstream_child_plans,
  artifacts_produced, correction_impact
- Include correction_hint field

Updates feature files and step definitions to test the new output structure.

ISSUES CLOSED: #2815
2026-06-19 01:57:19 -04:00