[BUG] agents invariant add missing --non-overridable flag for global invariants #9065

Open
opened 2026-04-14 07:02:07 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Commit Message: fix(cli): add --non-overridable flag to agents invariant add command
  • Branch: fix/invariant-add-non-overridable-flag

Background and Context

The product specification (docs/specification.md §19749) defines a --non-overridable flag for global invariants:

"Non-overridable invariants are set via agents invariant add --global --non-overridable "<constraint>". The non_overridable flag is only meaningful on GLOBAL-scoped invariants; it is ignored on project, action, and plan invariants."

The Invariant domain model already has a non_overridable: bool field (line 86 of src/cleveragents/domain/models/core/invariant.py), and the InvariantReconciliationActor in src/cleveragents/actor/reconciliation.py correctly handles non_overridable global invariants. However, the CLI command agents invariant add in src/cleveragents/cli/commands/invariant.py does not expose a --non-overridable flag, making it impossible for users to set this field via the CLI.

Feature Area: Invariants & Plan Correction
Spec Reference: docs/specification.md — Invariants section (§19749)

Current Behavior

The add command in src/cleveragents/cli/commands/invariant.py (lines 112–147) accepts:

  • --global
  • --project PROJECT
  • --plan PLAN_ID
  • --action ACTION
  • --format

It does not accept --non-overridable. The InvariantService.add_invariant() method also does not accept a non_overridable parameter, so even if the CLI were updated, the service layer would need updating too.

Users cannot create non-overridable global invariants via the CLI, even though the domain model and reconciliation actor fully support them.

Expected Behavior

Per spec §19749:

agents invariant add --global --non-overridable "Never commit secrets to version control"

Should create a global invariant with non_overridable=True. This invariant will then take absolute precedence over all lower-scope invariants (including plan-level) during reconciliation.

Steps to Reproduce

  1. Run: agents invariant add --global --non-overridable "Never commit secrets"
  2. Observe: Error: No such option: --non-overridable

Acceptance Criteria

  • agents invariant add accepts --non-overridable / --no-non-overridable flag (default: False)
  • --non-overridable is only meaningful with --global; a warning is shown if used with other scopes
  • InvariantService.add_invariant() accepts non_overridable: bool = False parameter
  • The created Invariant has non_overridable=True when flag is set
  • agents invariant list output shows non_overridable status for global invariants
  • BDD scenarios added for --non-overridable flag behavior

Subtasks

  • Add --non-overridable option to add command in src/cleveragents/cli/commands/invariant.py
  • Add warning when --non-overridable is used with non-global scope
  • Update InvariantService.add_invariant() to accept and pass non_overridable parameter
  • Update _invariant_dict() helper to include non_overridable in serialized output
  • Update agents invariant list rich table to show non_overridable column for global invariants
  • Add BDD scenarios in features/invariant_cli_new_coverage.feature for --non-overridable flag
  • Verify coverage ≥ 97% via nox -s coverage_report
  • 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.

Automated by CleverAgents Bot
Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor
Worker: [AUTO-UAT-2]


Automated by CleverAgents Bot
Agent: new-issue-creator

## Metadata - **Commit Message**: `fix(cli): add --non-overridable flag to agents invariant add command` - **Branch**: `fix/invariant-add-non-overridable-flag` ## Background and Context The product specification (docs/specification.md §19749) defines a `--non-overridable` flag for global invariants: > "Non-overridable invariants are set via `agents invariant add --global --non-overridable "<constraint>"`. The `non_overridable` flag is only meaningful on `GLOBAL`-scoped invariants; it is ignored on project, action, and plan invariants." The `Invariant` domain model already has a `non_overridable: bool` field (line 86 of `src/cleveragents/domain/models/core/invariant.py`), and the `InvariantReconciliationActor` in `src/cleveragents/actor/reconciliation.py` correctly handles `non_overridable` global invariants. However, the CLI command `agents invariant add` in `src/cleveragents/cli/commands/invariant.py` does not expose a `--non-overridable` flag, making it impossible for users to set this field via the CLI. **Feature Area:** Invariants & Plan Correction **Spec Reference:** docs/specification.md — Invariants section (§19749) ## Current Behavior The `add` command in `src/cleveragents/cli/commands/invariant.py` (lines 112–147) accepts: - `--global` - `--project PROJECT` - `--plan PLAN_ID` - `--action ACTION` - `--format` It does **not** accept `--non-overridable`. The `InvariantService.add_invariant()` method also does not accept a `non_overridable` parameter, so even if the CLI were updated, the service layer would need updating too. Users cannot create non-overridable global invariants via the CLI, even though the domain model and reconciliation actor fully support them. ## Expected Behavior Per spec §19749: ``` agents invariant add --global --non-overridable "Never commit secrets to version control" ``` Should create a global invariant with `non_overridable=True`. This invariant will then take absolute precedence over all lower-scope invariants (including plan-level) during reconciliation. ## Steps to Reproduce 1. Run: `agents invariant add --global --non-overridable "Never commit secrets"` 2. Observe: `Error: No such option: --non-overridable` ## Acceptance Criteria - [ ] `agents invariant add` accepts `--non-overridable` / `--no-non-overridable` flag (default: False) - [ ] `--non-overridable` is only meaningful with `--global`; a warning is shown if used with other scopes - [ ] `InvariantService.add_invariant()` accepts `non_overridable: bool = False` parameter - [ ] The created `Invariant` has `non_overridable=True` when flag is set - [ ] `agents invariant list` output shows `non_overridable` status for global invariants - [ ] BDD scenarios added for `--non-overridable` flag behavior ## Subtasks - [ ] Add `--non-overridable` option to `add` command in `src/cleveragents/cli/commands/invariant.py` - [ ] Add warning when `--non-overridable` is used with non-global scope - [ ] Update `InvariantService.add_invariant()` to accept and pass `non_overridable` parameter - [ ] Update `_invariant_dict()` helper to include `non_overridable` in serialized output - [ ] Update `agents invariant list` rich table to show `non_overridable` column for global invariants - [ ] Add BDD scenarios in `features/invariant_cli_new_coverage.feature` for `--non-overridable` flag - [ ] Verify coverage ≥ 97% via `nox -s coverage_report` - [ ] 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. --- **Automated by CleverAgents Bot** Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor Worker: [AUTO-UAT-2] --- **Automated by CleverAgents Bot** Agent: new-issue-creator
HAL9000 added this to the v3.2.0 milestone 2026-04-14 07:22:25 +00:00
Author
Owner

🔍 Triage Decision

Status: VERIFIED

MoSCoW: Must have
Priority: High
Milestone: v3.2.0

Reasoning: The agents invariant add command is missing the required --non-overridable flag for global invariants, which is a missing required CLI feature per spec; must be fixed in v3.2.0.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

## 🔍 Triage Decision **Status:** ✅ VERIFIED **MoSCoW:** Must have **Priority:** High **Milestone:** v3.2.0 **Reasoning:** The `agents invariant add` command is missing the required `--non-overridable` flag for global invariants, which is a missing required CLI feature per spec; must be fixed in v3.2.0. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#9065
No description provided.