bug(cli): strategize path does not surface invariant enforcement in decision tree output #1245

Open
opened 2026-04-01 19:15:48 +00:00 by hamza.khyari · 1 comment
Member

Metadata

  • Commit Message: fix(cli): surface invariant_enforced decisions in strategize output
  • Branch: bugfix/m3-invariant-enforced-cli-signal

Background

M3 issue #743 requires the E2E acceptance test to verify that invariants are enforced during strategize. The strongest structured signal for that behavior is an invariant_enforced decision in plan tree --format json.

However, the current CLI strategize path uses LLMStrategizeActor, which builds internal invariant_records but does not persist or surface invariant_enforced decisions via plan tree, plan explain, or plan status.

This was identified while hardening PR #799 to make AC-5 a real assertion rather than a diagnostic log.

Current Behavior

  • invariant add and invariant list work
  • plan execute (strategize) runs with invariants available
  • plan tree --format json does not reliably contain type: invariant_enforced
  • There is no structured CLI surface that proves invariant enforcement occurred

Expected Behavior

When invariants are present during strategize, the CLI should expose invariant enforcement in a structured way so E2E tests can assert it without relying on LLM wording.

Acceptance Criteria

  • Strategize path persists or surfaces invariant enforcement in a structured form
  • plan tree --format json includes type: invariant_enforced for enforced invariants, OR another documented structured CLI field exposes the same signal
  • M3 E2E test in PR #799 can assert AC-5 using a hard structured assertion (not a heuristic text search)
  • Verification via nox -s e2e_tests after removing/adjusting tdd_expected_fail dependencies as needed

Subtasks

  • Trace current CLI strategize path and identify where invariant enforcement is lost or hidden
  • Persist or expose invariant_enforced decisions/metadata in the CLI path
  • Update plan tree / plan explain / plan status output as needed
  • Update M3 E2E test (#743 / PR #799) to assert the structured signal
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
## Metadata - **Commit Message**: `fix(cli): surface invariant_enforced decisions in strategize output` - **Branch**: `bugfix/m3-invariant-enforced-cli-signal` ## Background M3 issue #743 requires the E2E acceptance test to verify that invariants are **enforced during strategize**. The strongest structured signal for that behavior is an `invariant_enforced` decision in `plan tree --format json`. However, the current CLI strategize path uses `LLMStrategizeActor`, which builds internal `invariant_records` but does **not** persist or surface `invariant_enforced` decisions via `plan tree`, `plan explain`, or `plan status`. This was identified while hardening PR #799 to make AC-5 a real assertion rather than a diagnostic log. ## Current Behavior - `invariant add` and `invariant list` work - `plan execute` (strategize) runs with invariants available - `plan tree --format json` does **not** reliably contain `type: invariant_enforced` - There is no structured CLI surface that proves invariant enforcement occurred ## Expected Behavior When invariants are present during strategize, the CLI should expose invariant enforcement in a structured way so E2E tests can assert it without relying on LLM wording. ## Acceptance Criteria - [ ] Strategize path persists or surfaces invariant enforcement in a structured form - [ ] `plan tree --format json` includes `type: invariant_enforced` for enforced invariants, OR another documented structured CLI field exposes the same signal - [ ] M3 E2E test in PR #799 can assert AC-5 using a hard structured assertion (not a heuristic text search) - [ ] Verification via `nox -s e2e_tests` after removing/adjusting `tdd_expected_fail` dependencies as needed ## Subtasks - [ ] Trace current CLI strategize path and identify where invariant enforcement is lost or hidden - [ ] Persist or expose `invariant_enforced` decisions/metadata in the CLI path - [ ] Update `plan tree` / `plan explain` / `plan status` output as needed - [ ] Update M3 E2E test (#743 / PR #799) to assert the structured signal - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done.
hamza.khyari added this to the v3.1.0 milestone 2026-04-01 19:15:48 +00:00
Owner

Triage: Verified

This is a well-documented bug filed by @hamza.khyari, identified while hardening PR #799 for M3 E2E acceptance testing. The issue clearly describes the gap: LLMStrategizeActor builds invariant_records internally but does not persist or surface invariant_enforced decisions via the CLI output (plan tree, plan explain, plan status).

Assessment:

  • Priority: Critical — confirmed. Without a structured CLI signal for invariant enforcement, M3 E2E tests cannot assert AC-5 reliably.
  • Milestone: Correcting from v3.1.0 (closed) to v3.6.0 — this is an M3 bug that affects the validation/quality gating pipeline, which falls under the v3.6.0 Advanced Concepts scope.
  • Completeness: The issue has all required sections per CONTRIBUTING.md — Metadata, Background, Current/Expected Behavior, Acceptance Criteria, Subtasks, and Definition of Done. Well-formed and actionable.

Note on milestone: The issue was originally assigned to v3.1.0, which is already closed. The correct milestone is v3.6.0 since this relates to the M3 invariant enforcement pipeline and the fix is needed for E2E test hardening.

Next step: This issue is now verified and ready for implementation.

## Triage: Verified This is a well-documented bug filed by @hamza.khyari, identified while hardening PR #799 for M3 E2E acceptance testing. The issue clearly describes the gap: `LLMStrategizeActor` builds `invariant_records` internally but does not persist or surface `invariant_enforced` decisions via the CLI output (`plan tree`, `plan explain`, `plan status`). **Assessment:** - **Priority**: Critical — confirmed. Without a structured CLI signal for invariant enforcement, M3 E2E tests cannot assert AC-5 reliably. - **Milestone**: Correcting from v3.1.0 (closed) to **v3.6.0** — this is an M3 bug that affects the validation/quality gating pipeline, which falls under the v3.6.0 Advanced Concepts scope. - **Completeness**: The issue has all required sections per CONTRIBUTING.md — Metadata, Background, Current/Expected Behavior, Acceptance Criteria, Subtasks, and Definition of Done. Well-formed and actionable. **Note on milestone**: The issue was originally assigned to v3.1.0, which is already closed. The correct milestone is v3.6.0 since this relates to the M3 invariant enforcement pipeline and the fix is needed for E2E test hardening. **Next step**: This issue is now verified and ready for implementation.
freemo modified the milestone from v3.1.0 to v3.6.0 2026-04-02 16:49:03 +00:00
freemo self-assigned this 2026-04-02 18:45:28 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#1245
No description provided.