4 Commits

Author SHA1 Message Date
CleverAgents Bot 641a8ed67d test(acms): cover context policy edge cases 2026-06-17 23:15:50 -04:00
HAL9000 9a9214dcf1 fix(acms): resolve AmbiguousStep regression, lint violations, and type safety issues
Resolve blocking issues identified in final review (ID 7998) for PR #9671:

1. AmbiguousStep fix: Renamed duplicate step '@then("the policy should not be applied")'
   to '@then("the policy should not be applied to the LLM context")' in
   acms_plan_execution_integration_steps.py and updated corresponding scenario in
   features/acms_plan_execution_integration.feature

2. lint fix (SIM102): Combined nested if statements into single compound condition in
   step_set_policy_priority() to remove ruff SIM102 violation

3. Type safety fix: Changed 'policy: Any' to 'policy: ContextPolicyConfig' in
   ACMSContextAssembler._apply_policy() for proper Pyright type safety, added
   ContextPolicyConfig to module imports

This resolves the unit_tests CI failure caused by AmbiguousStep and fixes
the lint CI failure introduced by commit 3457fc61.

ISSUES CLOSED: #9584
2026-06-17 23:15:50 -04:00
HAL9000 7ab95a8641 fix(acms): wire PlanExecutionACMSIntegration into plan execution engine
Wire PlanExecutionACMSIntegration into PlanExecutor and RuntimeExecuteActor
via dependency injection. PlanExecutor now accepts an optional acms_integration
parameter and passes it to RuntimeExecuteActor, which uses it to assemble
context via ACMS policies before LLM calls instead of passing raw file dumps.

Added BDD tests verifying the DI wiring and context assembly integration.
Updated CHANGELOG to document the plan execution engine integration.

ISSUES CLOSED: #9584
2026-06-17 23:15:50 -04:00
HAL9000 8a5567f5d8 feat(acms): implement context policy configuration loader and plan execution ACMS integration
Implemented a new context policy configuration loader and integrated plan execution context assembly for ACMS. Key additions include:

- New module: src/cleveragents/acms/context_policy_loader.py
  - ContextPolicyConfigurationLoader class for loading YAML/TOML configurations
  - Data models: PolicyScope and ContextPolicyConfig dataclasses
  - ViewPolicyConfiguration for per-view policy management
  - Schema validation to ensure policy configurations adhere to expected structure and constraints
  - Supports loading configurations from both files and strings, with robust error reporting

- New module: src/cleveragents/acms/plan_execution_integration.py
  - ACMSContextAssembler for assembling runtime context based on policy-driven decisions
  - PlanExecutionACMSIntegration to connect with the plan execution engine
  - Flexible policy loading from files or strings, allowing runtime configurability

- BDD tests
  - features/acms_context_policy_loader.feature (20 scenarios) validating loader behavior and policy scoping
  - features/acms_plan_execution_integration.feature (8 scenarios) validating end-to-end plan-context integration
  - features/steps/acms_context_policy_loader_steps.py (step definitions)
  - features/steps/acms_plan_execution_integration_steps.py (step definitions)
  - Tests cover YAML/TOML parsing, validation errors, per-view policy application, and plan integration flows

- Updated exports
  - Updated src/cleveragents/acms/__init__.py to export the two new modules, enabling easier imports and usage

ISSUES CLOSED: #9584
2026-06-17 23:15:50 -04:00