fix(cli): make plan correct accept plan_id as primary identifier #1055

Merged
brent.edwards merged 3 commits from bugfix/m3-plan-correct-plan-id into master 2026-03-21 18:45:18 +00:00
Member

Summary

  • plan correct now accepts a plan_id as its positional argument (in addition to decision_id). When a plan_id is given, the root decision is automatically selected as the correction target.
  • The positional parameter is renamed from decision_id to identifier with updated help text reflecting dual use.
  • Backward compatibility is fully preserved: decision_id inputs continue to work exactly as before.

How it works

  1. Try container.plan_lifecycle_service().get_plan(identifier) to check if the identifier is a plan_id
  2. If it resolves to a real Plan object, use it as resolved_plan_id and auto-select the root decision (parent_decision_id is None)
  3. If lookup fails (ResourceNotFoundError) or the result is not a Plan instance, fall back to treating the identifier as a decision_id (original behavior)

Verification

  • nox -s lint — All checks passed
  • nox -s typecheck — 0 errors, 1 pre-existing warning
  • nox -s unit_tests (correction features) — 150 scenarios passed, 683 steps passed, 0 failures

ISSUES CLOSED: #969

## Summary - **`plan correct` now accepts a plan_id** as its positional argument (in addition to decision_id). When a plan_id is given, the root decision is automatically selected as the correction target. - The positional parameter is renamed from `decision_id` to `identifier` with updated help text reflecting dual use. - Backward compatibility is fully preserved: decision_id inputs continue to work exactly as before. ## How it works 1. Try `container.plan_lifecycle_service().get_plan(identifier)` to check if the identifier is a plan_id 2. If it resolves to a real `Plan` object, use it as `resolved_plan_id` and auto-select the root decision (`parent_decision_id is None`) 3. If lookup fails (`ResourceNotFoundError`) or the result is not a `Plan` instance, fall back to treating the identifier as a decision_id (original behavior) ## Verification - `nox -s lint` — All checks passed - `nox -s typecheck` — 0 errors, 1 pre-existing warning - `nox -s unit_tests` (correction features) — 150 scenarios passed, 683 steps passed, 0 failures ISSUES CLOSED: #969
brent.edwards added the
Type
Bug
label 2026-03-18 19:41:33 +00:00
brent.edwards added this to the v3.2.0 milestone 2026-03-18 19:41:35 +00:00
freemo approved these changes 2026-03-19 04:55:19 +00:00
Dismissed
freemo left a comment
Owner

Code Review — PR #1055 fix(cli): make plan correct accept plan_id as primary identifier

Well-scoped fix. The resolution logic (try get_plan(identifier) → auto-select root decision → fall back to decision_id) is clean and backward-compatible. The parameter rename from decision_id to identifier with updated help text accurately reflects the dual-use behavior. The docstring and examples are properly updated.

Approved. No issues found.

## Code Review — PR #1055 `fix(cli): make plan correct accept plan_id as primary identifier` Well-scoped fix. The resolution logic (try `get_plan(identifier)` → auto-select root decision → fall back to decision_id) is clean and backward-compatible. The parameter rename from `decision_id` to `identifier` with updated help text accurately reflects the dual-use behavior. The docstring and examples are properly updated. **Approved.** No issues found.
freemo requested review from freemo 2026-03-19 05:16:22 +00:00
freemo requested review from hamza.khyari 2026-03-19 05:16:22 +00:00
brent.edwards force-pushed bugfix/m3-plan-correct-plan-id from ed2f6ee63a to f5eda6f846 2026-03-19 22:12:39 +00:00 Compare
brent.edwards dismissed freemo's review 2026-03-19 22:12:39 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

brent.edwards force-pushed bugfix/m3-plan-correct-plan-id from f5eda6f846 to 14a7cdc2db 2026-03-19 22:33:53 +00:00 Compare
brent.edwards force-pushed bugfix/m3-plan-correct-plan-id from 14a7cdc2db to a449989730 2026-03-19 22:52:56 +00:00 Compare
brent.edwards added 1 commit 2026-03-19 23:43:25 +00:00
Merge branch 'master' into bugfix/m3-plan-correct-plan-id
CI / lint (pull_request) Successful in 23s
CI / typecheck (pull_request) Successful in 50s
CI / quality (pull_request) Successful in 32s
CI / security (pull_request) Successful in 44s
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 28s
CI / integration_tests (pull_request) Successful in 4m17s
CI / coverage (pull_request) Successful in 6m39s
CI / e2e_tests (pull_request) Failing after 12m29s
CI / unit_tests (pull_request) Failing after 12m55s
CI / benchmark-regression (pull_request) Failing after 22m24s
CI / docker (pull_request) Has been cancelled
dc817fe53e
brent.edwards force-pushed bugfix/m3-plan-correct-plan-id from 6767fadfdd to 9db59c3965 2026-03-21 14:48:29 +00:00 Compare
Author
Member

Fixed all CI failures. Single root cause: a leftover duplicate code block in plan.py (lines 2809-2818) that referenced the old decision_id variable after it was renamed to identifier. This duplicate block was from an earlier iteration of the plan_id resolution logic that already exists above (lines 2778-2804). Removed the duplicate.

Locally verified all nox quality gates:

  • nox -s lint — PASS (0 errors)
  • nox -s typecheck — PASS (0 errors, 1 pre-existing warning)
  • nox -s unit_tests — PASS (12,214 scenarios, 0 failures)
  • nox -s integration_tests — PASS (1,672 tests, 0 failures)
  • nox -s e2e_tests — PASS (37 tests, 0 failures)
  • nox -s coverage_report — PASS (98% >= 97%)
Fixed all CI failures. Single root cause: a leftover duplicate code block in `plan.py` (lines 2809-2818) that referenced the old `decision_id` variable after it was renamed to `identifier`. This duplicate block was from an earlier iteration of the plan_id resolution logic that already exists above (lines 2778-2804). Removed the duplicate. **Locally verified all nox quality gates:** - `nox -s lint` — PASS (0 errors) - `nox -s typecheck` — PASS (0 errors, 1 pre-existing warning) - `nox -s unit_tests` — PASS (12,214 scenarios, 0 failures) - `nox -s integration_tests` — PASS (1,672 tests, 0 failures) - `nox -s e2e_tests` — PASS (37 tests, 0 failures) - `nox -s coverage_report` — PASS (98% >= 97%)
brent.edwards merged commit c2a2c5c4bf into master 2026-03-21 18:45:18 +00:00
brent.edwards deleted branch bugfix/m3-plan-correct-plan-id 2026-03-21 18:45:18 +00:00
Sign in to join this conversation.
No Reviewers
No Label
Type
Bug
2 Participants
Notifications
Due Date
No due date set.
Reference: cleveragents/cleveragents-core#1055