UAT: InvariantService.get_effective_invariants() missing ACTION tier — action-scoped invariants excluded from agents invariant list --effective #6496

Open
opened 2026-04-09 21:10:12 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Feature Area

Invariants & Automation Profiles

Spec Reference

docs/specification.md line 92:

The runtime precedence chain is four-tier: plan > action > project > global.

docs/specification.md line 18074:

Use --effective with --plan to show the final reconciled view of invariants (after precedence resolution) rather than just the invariants directly attached at that scope.

Expected Behavior

InvariantService.get_effective_invariants() should collect invariants from all four tiers (plan, action, project, global) and merge them using the spec's 4-tier precedence. When a user runs agents invariant list --effective --plan <ID>, action-scoped invariants should appear in the output.

Actual Behavior

InvariantService.get_effective_invariants() only collects from three tiers:

def get_effective_invariants(
    self,
    plan_id: str | None = None,
    project_name: str | None = None,
) -> list[Invariant]:
    # ...
    plan_invs = [...]  # plan scope
    project_invs = [...]  # project scope
    global_invs = [...]  # global scope
    # ACTION scope is completely missing!
    return merge_invariants(plan_invs, project_invs, global_invs)

Action-scoped invariants are never collected and never returned.

Runtime Verification

from cleveragents.application.services.invariant_service import InvariantService
from cleveragents.domain.models.core.invariant import InvariantScope

svc = InvariantService()
svc.add_invariant('Global inv', InvariantScope.GLOBAL, 'system')
svc.add_invariant('Action inv', InvariantScope.ACTION, 'my-action')
svc.add_invariant('Plan inv', InvariantScope.PLAN, 'plan1')
svc.add_invariant('Project inv', InvariantScope.PROJECT, 'proj1')

effective = svc.get_effective_invariants(plan_id='plan1', project_name='proj1')
# Result: [('plan', 'Plan inv'), ('project', 'Project inv'), ('global', 'Global inv')]
# ACTION MISSING: 'Action inv' is not in the effective set

Code Location

  • src/cleveragents/application/services/invariant_service.pyget_effective_invariants() method (line ~155)

Impact

  • agents invariant list --effective --plan <ID> never shows action-scoped invariants
  • Action invariants defined via agents invariant add --action <NAME> are silently excluded from the effective view
  • This is the primary user-facing path for viewing the reconciled invariant set

Severity

Critical — The --effective flag is the primary way users inspect the reconciled invariant set. Missing the ACTION tier means users get an incomplete and incorrect view.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Bug Report ### Feature Area Invariants & Automation Profiles ### Spec Reference `docs/specification.md` line 92: > The runtime precedence chain is four-tier: **plan > action > project > global**. `docs/specification.md` line 18074: > Use `--effective` with `--plan` to show the final reconciled view of invariants (after precedence resolution) rather than just the invariants directly attached at that scope. ### Expected Behavior `InvariantService.get_effective_invariants()` should collect invariants from all four tiers (plan, action, project, global) and merge them using the spec's 4-tier precedence. When a user runs `agents invariant list --effective --plan <ID>`, action-scoped invariants should appear in the output. ### Actual Behavior `InvariantService.get_effective_invariants()` only collects from **three** tiers: ```python def get_effective_invariants( self, plan_id: str | None = None, project_name: str | None = None, ) -> list[Invariant]: # ... plan_invs = [...] # plan scope project_invs = [...] # project scope global_invs = [...] # global scope # ACTION scope is completely missing! return merge_invariants(plan_invs, project_invs, global_invs) ``` Action-scoped invariants are never collected and never returned. ### Runtime Verification ```python from cleveragents.application.services.invariant_service import InvariantService from cleveragents.domain.models.core.invariant import InvariantScope svc = InvariantService() svc.add_invariant('Global inv', InvariantScope.GLOBAL, 'system') svc.add_invariant('Action inv', InvariantScope.ACTION, 'my-action') svc.add_invariant('Plan inv', InvariantScope.PLAN, 'plan1') svc.add_invariant('Project inv', InvariantScope.PROJECT, 'proj1') effective = svc.get_effective_invariants(plan_id='plan1', project_name='proj1') # Result: [('plan', 'Plan inv'), ('project', 'Project inv'), ('global', 'Global inv')] # ACTION MISSING: 'Action inv' is not in the effective set ``` ### Code Location - `src/cleveragents/application/services/invariant_service.py` — `get_effective_invariants()` method (line ~155) ### Impact - `agents invariant list --effective --plan <ID>` never shows action-scoped invariants - Action invariants defined via `agents invariant add --action <NAME>` are silently excluded from the effective view - This is the primary user-facing path for viewing the reconciled invariant set ### Severity **Critical** — The `--effective` flag is the primary way users inspect the reconciled invariant set. Missing the ACTION tier means users get an incomplete and incorrect view. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.2.0 milestone 2026-04-09 21:10:21 +00:00
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#6496
No description provided.