Commit Graph

422 Commits

Author SHA1 Message Date
HAL9000 809ccc624a fix(test): move advanced context strategy test doubles to features/mocks
- Extract FakeEmbeddings, RelevanceScoringStrategy, AdaptiveContextSelector,
  ContextFusionStrategy, and _pack_budget from features/steps/ into new
  features/mocks/advanced_context_strategies_mocks.py per mock-placement rules
- Remove sys.path manipulation from robot/helper_advanced_context_strategies.py;
  import directly from features.mocks instead of features/steps
- Add None guard before selected.assemble() in step_assemble_context_query
- Add explicit ValueError for unknown strategy types in step_load_yaml_strategy
  and load_strategy_from_yaml_impl

ISSUES CLOSED: #7574
2026-06-06 05:52:06 -04:00
HAL9000 df26d166c3 test(context): add integration tests for advanced context strategies
Implemented comprehensive integration tests for advanced context strategies:

Behave Feature File (features/advanced_context_strategies.feature):
  - 30+ scenarios covering semantic search, relevance scoring,
    adaptive selection, context fusion, YAML config, and integraton
  - Uses FakeEmbeddings for deterministic testing without real API calls

Step Definitions (features/steps/advanced_context_strategies_steps.py):
  - 50+ step definitions for all test scenarios
  - RelevanceScoringStrategy, AdaptiveContextSelector, ContextFusionStrategy
  - Full type annotations with pyright compliance

Robot Framework Tests (robot/advanced_context_strategies.robot):
  - E2E integration tests for all advanced strategies
  - Helper keywords for test execution and strategy creation

Robot Helper (robot/helper_advanced_context_strategies.py):
  - Strategy creation/configureation functions
  - Fragment and budget management utilities

- Add CHANGELOG.md entry under [Unreleased] section
- Update CONTRIBUTORS.md with contribution entry

ISSUES CLOSED: #7574
2026-06-06 05:52:06 -04:00
HAL9000 cc0a2b6492 fix(changelog): add missing #5566 entry to [Unreleased] section
CI / build (pull_request) Successful in 39s
CI / lint (pull_request) Successful in 1m5s
CI / typecheck (pull_request) Successful in 1m25s
CI / security (pull_request) Successful in 1m23s
CI / quality (pull_request) Successful in 1m22s
CI / push-validation (pull_request) Successful in 26s
CI / helm (pull_request) Successful in 32s
CI / unit_tests (pull_request) Successful in 6m26s
CI / docker (pull_request) Successful in 1m48s
CI / integration_tests (pull_request) Successful in 10m47s
CI / coverage (pull_request) Successful in 13m6s
CI / status-check (pull_request) Successful in 4s
The CHANGELOG entry for issue #5566 was dropped during conflict
resolution. Adds the entry back to the [Unreleased] > Fixed section
as required by contributing guidelines.

ISSUES CLOSED: #5566
2026-06-04 17:43:33 -04:00
HAL9000 36a6bd6011 fix(resources): resolve unit_tests failures and review blockers for virtual resource PR
CI / build (pull_request) Successful in 33s
CI / lint (pull_request) Successful in 56s
CI / helm (pull_request) Successful in 53s
CI / quality (pull_request) Successful in 57s
CI / typecheck (pull_request) Successful in 1m3s
CI / security (pull_request) Successful in 1m4s
CI / push-validation (pull_request) Successful in 25s
CI / unit_tests (pull_request) Successful in 5m21s
CI / integration_tests (pull_request) Successful in 10m15s
CI / docker (pull_request) Successful in 1m33s
CI / coverage (pull_request) Successful in 10m44s
CI / status-check (pull_request) Successful in 4s
Restores green unit_tests by removing the duplicate Pydantic virtual-resource
implementation that had no production consumers and was causing behave step
collisions, fixing parse-library step patterns that never matched, and giving
the failing-test scenarios concrete step definitions.

Changes:
- Remove unused parallel implementation `src/cleveragents/domain/models/core/
  virtual_resource.py`, its feature file `features/virtual_resource_types.feature`,
  and its step file `features/steps/virtual_resource_types_steps.py`. The
  canonical `src/cleveragents/resource/virtual.py` (re-exported by
  `src/cleveragents/resource/__init__.py`) is the only public API; the
  Pydantic copy had zero non-test consumers and its step file duplicated
  step text patterns (e.g., `the computed value should be ...`), triggering
  `behave.step_registry.AmbiguousStep` errors at module load.
- Fix `VirtualResource.__init__` name validation in
  `src/cleveragents/resource/virtual.py`: replace the
  `name.replace("-", "").replace("_", "").isalnum()` check with a single
  regex `^[a-zA-Z][a-zA-Z0-9_-]*$`. The old check accepted leading digits
  (e.g., `"123-invalid"` would strip the hyphen and pass `isalnum()`), so
  the "Reject invalid resource names" scenario was silently failing.
- Fix step patterns in `features/steps/resource_virtual_types_steps.py`:
  replace unsupported `{name!r}` parse-library syntax with literal-quoted
  `"{name}"` (confirmed via `parse.parse(...)` REPL that `!r` returns
  `None`); rename the over-broad `it should contain "{text}"` /
  `it should raise {error_type} with message containing "{message}"`
  patterns to specific forms that don't collide with steps in
  `execution_environment_steps.py` and `structural_validation_steps.py`;
  add try/except in the `When I compute the virtual resource` step so the
  exception-handling scenario can reach its `Then` step.
- Fix table headers in `features/resource_virtual_types.feature` so behave's
  table parser sees a proper `| name | value |` header row instead of
  treating the first data row as headers.
- Drop the now-unused E501 override for the deleted file from `pyproject.toml`.
- Add CHANGELOG.md entry under `[Unreleased]`.

Verified locally: unit_tests gate against `features/resource_virtual_types.feature`
passes 18/18 scenarios; lint and typecheck both green.

Refs: #8610
2026-06-04 04:23:37 -04:00
HAL9000 09bc5222a5 test(e2e): fix M2 acceptance test LLM provider and actor validation
CI / lint (pull_request) Successful in 39s
CI / helm (pull_request) Successful in 33s
CI / build (pull_request) Successful in 50s
CI / quality (pull_request) Successful in 1m6s
CI / typecheck (pull_request) Successful in 1m10s
CI / push-validation (pull_request) Successful in 26s
CI / security (pull_request) Successful in 1m18s
CI / unit_tests (pull_request) Successful in 6m2s
CI / docker (pull_request) Successful in 1m28s
CI / integration_tests (pull_request) Successful in 10m12s
CI / coverage (pull_request) Successful in 10m56s
CI / status-check (pull_request) Successful in 3s
- Replace hardcoded gpt-4/openai/gpt-4 references with Resolve LLM Actor
  keyword so the test falls back to Anthropic when OpenAI is unavailable
- Add explicit return-code check (rc==0) for actor registration in Step 2
- Update CHANGELOG.md with entry for PR #11191
2026-06-04 00:33:43 -04:00
HAL9000 82502404cd docs: add CHANGELOG entry for A2A migration guide (#10230)
CI / lint (pull_request) Successful in 47s
CI / quality (pull_request) Successful in 51s
CI / typecheck (pull_request) Successful in 1m11s
CI / security (pull_request) Successful in 1m26s
CI / build (pull_request) Successful in 37s
CI / helm (pull_request) Successful in 32s
CI / push-validation (pull_request) Successful in 26s
CI / unit_tests (pull_request) Successful in 5m19s
CI / integration_tests (pull_request) Successful in 9m45s
CI / docker (pull_request) Successful in 1m51s
CI / coverage (pull_request) Successful in 10m46s
CI / status-check (pull_request) Successful in 7s
2026-06-03 23:46:13 -04:00
HAL9000 8170dabb4f docs(timeline): [AUTO-TIME-2] update schedule adherence 2026-04-18 with changelog and contributor entries
CI / lint (pull_request) Successful in 41s
CI / build (pull_request) Successful in 38s
CI / helm (pull_request) Successful in 41s
CI / typecheck (pull_request) Successful in 1m6s
CI / quality (pull_request) Successful in 1m8s
CI / security (pull_request) Successful in 1m17s
CI / push-validation (pull_request) Successful in 26s
CI / unit_tests (pull_request) Successful in 5m44s
CI / integration_tests (pull_request) Successful in 8m4s
CI / docker (pull_request) Successful in 1m40s
CI / coverage (pull_request) Successful in 11m43s
CI / status-check (pull_request) Successful in 4s
- Add Schedule Adherence tables for 2026-04-18 (M3-M10)
- Add Daily Snapshot section with milestone risk assessments
- Fix missing newline at end of timeline table content
- Update CHANGELOG.md under [Unreleased] with entry for timeline snapshot
- Update CONTRIBUTORS.md with HAL 9000 contribution entry
- Proper newline termination before new markdown table sections

ISSUES CLOSED: #10288

Epic reference: Tracking issue #8519 (AUTO-TIME supervisor)

Automated by CleverAgents Bot
Supervisor: Timeline Update | Agent: timeline-update-pool-supervisor
2026-06-03 22:07:47 -04:00
HAL9000 388fc458c5 fix(cli): fix project context set JSON/YAML output structure (#6319)
Implemented spec-compliant JSON, YAML, plain, and rich outputs for `agents project context set`. Added BDD coverage verifying the new output structure across formats.\n\nISSUES CLOSED: #6319
2026-06-03 17:30:22 -04:00
HAL9000 46fff75c1a docs: add v3.2.0 and v3.3.0 feature documentation [AUTO-DOCS-2] 2026-06-03 15:56:46 -04:00
HAL9000 35aa4f47c4 docs(changelog): correct PureGraph coverage entry to match actual diff
CI / helm (pull_request) Successful in 46s
CI / build (pull_request) Successful in 51s
CI / lint (pull_request) Successful in 1m9s
CI / typecheck (pull_request) Successful in 1m10s
CI / push-validation (pull_request) Successful in 1m8s
CI / security (pull_request) Successful in 1m19s
CI / quality (pull_request) Successful in 1m23s
CI / unit_tests (pull_request) Successful in 5m15s
CI / docker (pull_request) Successful in 1m32s
CI / integration_tests (pull_request) Successful in 9m21s
CI / coverage (pull_request) Successful in 9m31s
CI / status-check (pull_request) Successful in 2s
The CHANGELOG.md and CONTRIBUTORS.md entries from db048dd2 claimed this
PR adds `features/pure_graph_coverage.feature`. That standalone file
was intentionally not added (and an earlier draft was removed) because
the PureGraph scenarios already live in
`features/consolidated_langgraph.feature` — adding a standalone file
would have created duplicate Behave scenarios against the same step
definitions and broken `unit_tests` CI.

Reword both entries to accurately describe what this PR delivers:
- the previously orphaned `features/steps/pure_graph_coverage_steps.py`
  is now driven through the existing consolidated feature file
- Robot Framework integration tests in `robot/langgraph/pure_graph.robot`
  backed by `robot/langgraph/pure_graph_lib.py`
- ASV benchmarks in `benchmarks/pure_graph_bench.py`

ISSUES CLOSED: #9531
2026-06-03 15:04:52 -04:00
HAL9000 db048dd2d9 compliance: Add PureGraph BDD coverage to CHANGELOG and CONTRIBUTORS
Update the PR compliance checklist items that were missing from the original
PR creation by pr-creator:

- Added ### Tests section to CHANGELOG.md documenting the PureGraph BDD,
  Robot Framework integration tests, and ASV benchmark additions
- Updated CONTRIBUTORS.md with contribution details for the PureGraph test
  coverage suite (PR #9601 / issue #9531)

This completes items [1] and [2] of the mandatory 8-item PR Compliance Checklist.

ISSUES CLOSED: #9531
2026-06-03 14:30:16 -04:00
HAL9000 7279ce64dd feat(plans): implement configurable merge strategy (prefer-parent, prefer-subplan, manual)
Implemented a configurable merge strategy framework for three-way merges.

- New module: src/cleveragents/domain/models/core/merge_strategy.py
  - MergeStrategy StrEnum with options: prefer-parent, prefer-subplan, manual
  - Helper methods: is_auto_resolve(), is_manual(), from_string()

- New module: src/cleveragents/domain/models/core/merge_strategy_service.py
  - MergeConflict class with __eq__ for value equality comparison
  - MergeStrategyService to apply strategies and resolve conflicts
  - Proper type annotations (dict, Any) with no unused imports

- BDD test suite: features/plan_merge_strategy.feature (8 scenarios)
- Step definitions: features/steps/plan_merge_strategy_steps.py

- Robot Framework integration tests: robot/merge_strategy.robot
- Helper script: robot/helper_merge_strategy.py

- Updated src/cleveragents/domain/models/core/__init__.py exports

ISSUES CLOSED: #9559
2026-06-03 12:16:30 -04:00
HAL9000 1ff0a904db chore(changelog): add ACMS context CLI entry for issue #9586 2026-06-03 11:24:21 -04:00
HAL9000 fc9afae9c0 fix(acms-context): correct CLI path, fix budget labels, simplify lock handling
- Fix acms CLI command hierarchy: nested acms_context.app under main.py
  'acms' Typer as 'context' sub-command to form canonical path
   (was incorrectly at ).
- Warm/cold tier budget labels now say 'decisions' instead of fragments
  for clarity (warm/cold use decision budgets, not token budgets).
- Simplify _remove_fragments: ContextTierService is already thread-safe
  with RLock; manual lock detection/holding was unnecessary and fragile.
- Update CHANGELOG to clarify warm/cold tiers use decision budget limits.
2026-06-03 11:24:21 -04:00
HAL9000 c65a0726a8 feat(cli): implement context show and context clear CLI commands for ACMS - Closes #9586
- Rewrote production CLI to use real ContextTierService (get_scoped_view, get_all_fragments, evict_lru) instead of non-existent ACMSService
- Removed unused imports (Path, Panel, ScopedView) from production code
- Fixed all lint issues: trailing whitespace, import ordering, nested with statements
- Replaced typer.Abort() with typer.Exit(code=1) for error exits
- Added input validation for empty/whitespace view parameter
- Fixed error handling to use str(e) instead of e.message
- Added guards against negative budget values in _format_budget_utilization
- Added warning when clearing context with no filters (clear ALL)
- Removed module-level console side effect
- Moved mocks to features/mocks/acms_context_mocks.py per CONTRIBUTING.md
- Fixed test assertions to capture real CLI output (not placeholder)
- Fixed duplicate step definitions (AmbiguousStep errors)
- Fixed feature file step mismatch for tier count parameter
- Added Robot Framework integration tests in robot/acms_context_cli.robot
- Added performance benchmarks in benchmarks/acms_context_cli_bench.py
- Updated CHANGELOG.md with ACMS context CLI feature entry
- Updated CONTRIBUTORS.md with ACMS context CLI contribution

ISSUES CLOSED: #9586
2026-06-03 11:24:21 -04:00
HAL9000 7a4e8ff984 docs(changelog): restore deleted entries and add #9084 entry
CI / lint (pull_request) Successful in 35s
CI / build (pull_request) Successful in 44s
CI / push-validation (pull_request) Successful in 26s
CI / typecheck (pull_request) Successful in 59s
CI / helm (pull_request) Successful in 31s
CI / quality (pull_request) Successful in 1m13s
CI / security (pull_request) Successful in 1m23s
CI / unit_tests (pull_request) Successful in 4m50s
CI / docker (pull_request) Successful in 1m43s
CI / integration_tests (pull_request) Successful in 8m11s
CI / coverage (pull_request) Successful in 9m2s
CI / status-check (pull_request) Successful in 3s
Restores 129 lines accidentally removed during rebase conflict
resolution: entries for #8588, #4740, #9056, #9096, #7875, #10970,
#8520, #10987 (### Changed), #9055, #1549/#1544 (### Security), and
#7623, #9060, #9824, #10972 (### Fixed). Also restores 4 lines
removed from the repository save() session-contract entry.

Adds required CHANGELOG entry for this PR's own fix:
- Plan artifacts JSON completeness fix (#9084)

ISSUES CLOSED: #9084
2026-06-03 05:00:01 -04:00
HAL9000 87cfdae489 docs(plan): add CHANGELOG and CONTRIBUTORS entries for #9084 fix
- Add changelog entry under [Unreleased]/Fixed for plan artifacts JSON completeness (#9084)
- Add contributors detail for validation_summary and apply_summary fix work.

ISSUES CLOSED: #9084
2026-06-03 05:00:01 -04:00
HAL9000 24d315749b fix(cli): plan prompt JSON envelope and remove unrelated files
CI / lint (pull_request) Successful in 32s
CI / push-validation (pull_request) Successful in 25s
CI / build (pull_request) Successful in 48s
CI / helm (pull_request) Successful in 53s
CI / quality (pull_request) Successful in 1m1s
CI / typecheck (pull_request) Successful in 1m9s
CI / security (pull_request) Successful in 1m11s
CI / unit_tests (pull_request) Successful in 5m16s
CI / docker (pull_request) Successful in 1m34s
CI / integration_tests (pull_request) Successful in 9m33s
CI / coverage (pull_request) Successful in 10m21s
CI / status-check (pull_request) Successful in 2s
The prior commits added `timing.started` to a local envelope dict in
`prompt_plan_cmd`, but that dict was passed as the `data` argument to
`format_output()`, which builds its OWN envelope from `data`. Result:
the test-asserted `command="plan prompt"` ended up as an empty string
at the JSON root, and `timing.started` was buried in
`data.timing.started` instead of `timing.started`.

This commit:

- Extends `format_output` and `_build_envelope` with an optional
  `started_at: datetime | None` parameter. When provided, the envelope's
  `timing` dict includes a `started` ISO-8601 field alongside
  `duration_ms`. Backward compatible: default `None` preserves the
  existing timing shape for all current callers.
- Refactors `prompt_plan_cmd` to call
  `format_output(prompt_data, fmt, command="plan prompt", ...,
  started_at=started_at)` for the JSON and YAML formats so the envelope
  keys are populated at the document root. Table/plain/color formats
  retain the legacy envelope-wrapping behavior — the existing scenario
  outline relies on the envelope being passed directly to the table
  renderer.
- Removes 48 unrelated files accidentally committed to the repo root
  by the original PR commit (`_issue_state.py`, `_pr_dep*.py`,
  `_pr_labels.py`, `_pr_setup.py`, `coverage_boost_steps*.py`,
  `cross_plan_correction_*.py`, `parse_*.py`, `search_*.py`,
  `retry_policy_updated.py`, `run_behave_parallel.py`,
  `acms_context_analysis_steps.py`, `aggregate_all.py`,
  `check_issues.py`, `check_last_page.py`, `fix_timing.py`,
  `helper_cross_plan_correction*.py`, `groom_prompt.txt`,
  `label_result.txt`, `prompt_auto_rev_sup.txt`, `tmp/uat_worker_*`,
  `tmp/update_issue_labels.sh`). These contained hardcoded API tokens
  and broke `ruff format --check`. The exposed token
  (`92224acff675c50c5958d1eaca9a688abd405e06`) should be rotated
  separately.
- Adds CHANGELOG.md entry under [Unreleased] > Fixed.

ISSUES CLOSED: #9353
2026-06-03 03:03:14 -04:00
HAL9000 37e7fb4612 fix(plan): NamespacedName digit-start validation BDD scenarios
Remove @tdd_expected_fail tags from the 3 NamespacedName validation
scenarios and fix step mismatch that caused 2 constructor scenarios to
fail. Constructor scenarios now use the existing "a Pydantic
ValidationError should be raised" step (context_strategy_registry_steps)
which correctly checks pydantic.ValidationError instead of the project's
cleveragents.core.exceptions.ValidationError.

Also remove the duplicate @then step accidentally left in
plan_namespaced_name_tdd_steps.py (would have caused NameError since
the `then` import was already removed).

ISSUES CLOSED: #2145, #2147, #8799
2026-06-03 00:24:21 -04:00
HAL9000 7ba1e5737f docs(spec): document context_tier_hydrator module in ACMS architecture section
Adds Context Tier Hydration subsection to the ACMS Architecture section of
the specification, documenting the context_tier_hydrator module's public
interface (hydrate_tiers_for_plan, hydrate_tiers_from_project), file listing
strategy (git ls-files for git-checkout resources, os.walk fallback), budget
limits (256 KB per file, 10 MB total per project), and fragment structure
(TieredFragment with ContextTier.HOT placement, metadata keys path/detail_depth/relevance_score).

Also updates CHANGELOG.md under [Unreleased] > Documentation and adds
contribution entry to CONTRIBUTORS.md.

ISSUES CLOSED: #6175
2026-06-02 23:07:34 -04:00
HAL9000 e9e2deb090 refactor(agent): replace hardcoded dependency and context file limits with configurable parameters
CI / lint (pull_request) Successful in 40s
CI / typecheck (pull_request) Successful in 1m8s
CI / quality (pull_request) Successful in 1m0s
CI / security (pull_request) Successful in 1m21s
CI / push-validation (pull_request) Successful in 27s
CI / helm (pull_request) Successful in 30s
CI / build (pull_request) Successful in 37s
CI / unit_tests (pull_request) Successful in 4m10s
CI / docker (pull_request) Successful in 1m43s
CI / integration_tests (pull_request) Successful in 8m36s
CI / coverage (pull_request) Successful in 13m31s
CI / status-check (pull_request) Successful in 3s
author CleverThis <hal9000@cleverthis.com> 1776170939 +0000
committer CleverThis <hal9000@cleverthis.com> 1776170939 +0000

refactor(agent): replace hardcoded dependency and context file limits with configurable parameters

Implemented configurable limits for the agent and graph components:
- ContextAnalysisAgent now accepts max_dependencies: int = 10 with validation (ValueError if <= 0)
- _parse_dependencies uses self.max_dependencies instead of a hard-coded 10
- PlanGenerationGraph now accepts max_context_files: int = 5 with validation (ValueError if <= 0)
- _format_context_summary uses self.max_context_files instead of a hard-coded 5
- Updated class docstrings to reflect new parameters
- Added Behave feature file at features/agent_configurable_limits.feature with 12 scenarios
- Added step definitions at features/steps/agent_configurable_limits_steps.py

ISSUES CLOSED: #9050
2026-06-02 21:16:38 -04:00
HAL9000 5282c7bebf fix(decisions): add error handling, ULID validation, and CHANGELOG entry to plan tree command
- Remove redundant local import of get_container (already imported at module level)
- Add _validate_plan_ulid() call before querying decision service for actionable error messages
- Wrap service calls in try/except catching ValidationError, PlanError, CleverAgentsError
- Add CHANGELOG.md entry for agents plan tree command (#8525)

ISSUES CLOSED: #8525
2026-06-02 20:59:25 -04:00
HAL9000 619e8eff36 feat(resource): add --clone-into to container-instance and fix devcontainer-instance sandbox strategy
- Adds a --clone-into option to the container-instance command to clone repository contents into a specified path during container setup.
- Fixes the devcontainer-instance sandbox strategy to ensure proper isolation, correct mount permissions, and deterministic behavior across environments.
- Updates related validation and error handling to reflect the new option and sandbox changes.

ISSUES CLOSED: #7555
2026-06-02 20:37:35 -04:00
HAL9000 bc6677b3cd feat(subplans): Subplan System Specification and Invariant Enforcement v3.3.0 (#8725)
Add comprehensive Subplan System specification defining module boundaries,
data models (Subplan, SubplanResult, SubplanTree), PostgreSQL schema with
indexes, the 8-step spawning algorithm, concurrency control via per-plan
semaphores, and error handling.

Implement invariant loading and enforcement in Strategize phase:
- Add InvariantViolationError exception class
- Add load_active_invariants() and check_invariants() methods to InvariantService
- Add _is_violation heuristic for action/invariant matching
- Add BDD tests with @load_invariants, @check_invariants, etc. tags

ISSUES CLOSED: #8725
2026-06-02 19:50:41 -04:00
HAL9000 7149f1b077 test(plan-tree): add failing BDD scenario proving corrected nodes not visually marked
This TDD scenario documents the gap in Spec Requirement #7: the current
implementation of 'agents plan tree' does not visually distinguish corrected
nodes (decisions with is_correction=True).

The scenario creates a plan with a corrected decision and asserts that the
tree output contains a visual marker such as [corrected] or ✎. The scenario
is tagged @tdd_expected_fail to allow CI to pass while the bug exists.

The Rich tree renderer in tree_decisions_cmd builds node labels without
checking decision.is_correction, proving the gap exists.

- Revert production code change: remove label key and [corrected] marker
  from _node_dict in build_decision_tree (the TDD scenario must prove the
  bug exists, not fix it; the fix belongs in a separate PR)
- Update CONTRIBUTORS.md with TDD scenario contribution entry
- Add CHANGELOG.md entry for TDD scenario (#8576)
- Remove dead _make_decision() helper (was already removed by prior attempt)
- Remove # type: ignore[import-untyped] (was already removed by prior attempt)

ISSUES CLOSED: #8576
2026-06-02 18:42:43 -04:00
HAL9000 1301182990 fix(plan): include decision_id field in plan tree JSON output
The step_tree_json_valid BDD step was asserting a raw list from
format_output, but the function wraps all machine-readable output in
a spec-required envelope dict ({"data": [...]}). This PR fixes the
step to correctly validate the envelope structure (dict with data key)
and removes @tdd_expected_fail from the @tdd_issue_4254 scenario so
it runs as a permanent regression guard.

The code producing decision_id in tree nodes was already correct; only
the test assertion needed fixing.

ISSUES CLOSED: #9096
2026-06-02 17:43:31 -04:00
HAL9000 807b56bc69 fix(agents): sanitize user-provided content in AutoDebugAgent prompts to prevent prompt injection
- Add _sanitize_user_input() helper that catches PromptInjectionDetected and falls back to wrap_user_content() instead of crashing the agent
- Remove dead code (_bs, _be variables) from all three agent methods
- Use wrap_user_content() for error_analysis (internal LLM output) in _generate_fix() to avoid crashing on the agent's own output
- Add @security @prompt-injection BDD tags to feature file and all scenarios
- Add missing @then("the boundary markers should be present") step definition
- Add Robot Framework integration tests (auto_debug_agent_prompt_injection.robot)
- Update CHANGELOG.md and CONTRIBUTORS.md

ISSUES CLOSED: #9110
2026-06-02 17:06:11 -04:00
HAL9000 195fbac109 fix: add required @a2a, @session, @cli tags to BDD feature files
CI / lint (pull_request) Successful in 40s
CI / helm (pull_request) Successful in 38s
CI / build (pull_request) Successful in 48s
CI / quality (pull_request) Successful in 1m0s
CI / typecheck (pull_request) Successful in 1m29s
CI / security (pull_request) Successful in 1m28s
CI / push-validation (pull_request) Successful in 20s
CI / unit_tests (pull_request) Successful in 5m8s
CI / docker (pull_request) Successful in 1m27s
CI / integration_tests (pull_request) Successful in 8m39s
CI / coverage (pull_request) Successful in 11m1s
CI / status-check (pull_request) Successful in 3s
Add domain-scenario Gherkin tags to all A2A, session, and CLI feature
files (30 files) so tests can be filtered individually via behave.

- 8 A2A feature files: @a2a tag
- 7 session feature files: @session tag
- 15 CLI feature files: @cli tag

ISSUES CLOSED: #9124
2026-06-02 15:41:06 -04:00
HAL9000 6a4a49158c fix(cli): address review feedback on docstring example validator
- Fix error suppression in validate_all_commands: log at DEBUG level instead of silently swallowing exceptions
- Fix multi-word command name parsing bug: use command_token_count to skip the full command prefix when extracting positional values
- Add @cli tag to features/cli_docstring_example_validation.feature
- Update CONTRIBUTING.md with CLI docstring example style guide
- Update CHANGELOG.md with entry for automated docstring validation
- Update CONTRIBUTORS.md with contribution entry
- Fix test design flaws: separate Given/When/Then steps per scenario
- Add validate_all_commands test coverage via new Behave scenario
- Fix _extract_positional_args to only count required positional args
2026-06-02 14:01:59 -04:00
HAL9000 ab18e81e4a refactor(actor): add return type to _get_services and remove bare except clauses
- Add return type annotation tuple[Any, Any | None] to _get_services()
- Fix _load_config_text() to catch yaml.YAMLError and TypeError instead
  of ValueError/AttributeError around yaml.safe_load(), preserving the
  user-friendly typer.BadParameter message for malformed YAML input
- Fix _compute_actor_impact() defensive guards to also catch
  CleverAgentsError, OperationalError, and ValidationError in addition
  to AttributeError/RuntimeError, keeping actor removal resilient when
  the database layer is unavailable
- Update CHANGELOG.md with entry under Changed section for issue #8567
- Add features/actor_exception_handling.feature with four Behave scenarios
  covering the exception handling contract changes
- Add features/steps/actor_exception_handling_steps.py with step definitions

ISSUES CLOSED: #8567
2026-06-02 08:44:47 -04:00
HAL9000 bf6326b715 test(plan-correct): remove @tdd_expected_fail now bug #8584 is fixed
CI / push-validation (pull_request) Successful in 23s
CI / lint (pull_request) Successful in 36s
CI / build (pull_request) Successful in 41s
CI / helm (pull_request) Successful in 57s
CI / quality (pull_request) Successful in 1m0s
CI / typecheck (pull_request) Successful in 1m6s
CI / security (pull_request) Successful in 1m11s
CI / unit_tests (pull_request) Successful in 5m12s
CI / docker (pull_request) Successful in 1m26s
CI / integration_tests (pull_request) Successful in 8m20s
CI / coverage (pull_request) Successful in 8m43s
CI / status-check (pull_request) Successful in 3s
The plan correct --format json output already nests correction fields
under data.correction and sets command to "plan correct" via
format_output, so the three BDD scenarios now pass against the current
implementation. Remove the @tdd_expected_fail inversion tag so CI
reports them as passing, not as unexpected-pass failures.

Updated CHANGELOG.md and CONTRIBUTORS.md.

ISSUES CLOSED: #8584
2026-06-02 07:19:20 -04:00
HAL9000 d54ed1440c fix(engine_cache): guard MEMORY_ENGINES with lock to prevent TOCTOU race
Add MEMORY_ENGINES_LOCK to engine_cache.py and wrap the check-and-set
in UnitOfWork.engine with it to prevent concurrent threads from creating
duplicate in-memory SQLite engines. Also fix cache-hit bug where
self._engine was never assigned on a cache hit.

Closes #7566
2026-06-02 05:51:55 -04:00
HAL9000 0dcf7bf152 fix(plan-lifecycle): gate Apply phase on Definition-of-Done evaluation
Before transitioning to the Apply phase, PlanLifecycleService.apply_plan
now evaluates the plan's definition_of_done criteria using DoDEvaluator
(TextMatchEvaluator). If any required criteria fail, a DoDGatingError is
raised and the plan remains in Execute/COMPLETE state. The evaluation
result is stored in plan.validation_summary with dod_evaluated=True and
dod_all_passed reflecting the outcome. Plans with no DoD text skip
evaluation and proceed normally.

Adds DoDGatingError exception class and _evaluate_dod() helper method.
Adds BDD feature file and step definitions for DoD gating scenarios.

ISSUES CLOSED: #7927
2026-06-02 05:14:43 -04:00
HAL9000 f7901c404f fix(actor): move namespace filter inside lock in ActorLoader.list_actors
Fixes a race condition (TOCTOU) in ActorLoader.list_actors() where the namespace
filter was applied outside the threading lock, creating a window for concurrent
dictionary modifications. Moving the filter inside the with self._lock: block
ensures atomic reads and filtering.

- Move namespace filtering inside the RLock in list_actors()
- Add concurrency BDD test (threading.Barrier) for list_actors + clear race condition
- Update CHANGELOG.md with fix entry (closes #8588)
- Update CONTRIBUTORS.md with contribution details

ISSUES CLOSED: #8588
2026-06-02 04:52:51 -04:00
HAL9000 2609787d35 fix(concurrency): fix ValidationPipeline.run() sys.stdout replacement #7623
Introduce a reference-counted shared stream wrapper manager so concurrent
ValidationPipeline.run() calls correctly restore the true sys.stdout/stderr
after all pipelines finish.

- Add _install_thread_local_streams() / _release_thread_local_streams()
  protected by threading.Lock; first caller saves originals and installs
  wrappers, last caller restores them
- Remove io.TextIOBase inheritance from _ThreadLocalStream to avoid Python
  3.13 read-only slot conflict; use cast(TextIO, ...) at assignment sites
- encoding property returns str | None matching io.TextIOBase signature
- Replace assert guards with explicit RuntimeError fail-fast checks
- Add Behave scenario: Concurrent pipelines restore global streams after
  execution
- Split validation_pipeline_steps.py (547→428 lines) by extracting
  MockValidationExecutor to _validation_pipeline_mock.py and edge-case
  steps to validation_pipeline_edge_steps.py
- Update CHANGELOG.md and CONTRIBUTORS.md

ISSUES CLOSED: #7623
2026-06-02 04:29:20 -04:00
HAL9000 8ebd922e77 docs(specification): add deleted_at field to agents project delete JSON/YAML output
CI / lint (pull_request) Successful in 35s
CI / helm (pull_request) Successful in 21s
CI / build (pull_request) Successful in 45s
CI / push-validation (pull_request) Successful in 31s
CI / quality (pull_request) Successful in 52s
CI / typecheck (pull_request) Successful in 1m3s
CI / security (pull_request) Successful in 1m15s
CI / unit_tests (pull_request) Successful in 4m23s
CI / docker (pull_request) Successful in 2m0s
CI / integration_tests (pull_request) Successful in 7m57s
CI / coverage (pull_request) Successful in 12m1s
CI / status-check (pull_request) Successful in 3s
Updated docs/specification.md to document the correct JSON/YAML output structure
for the project delete command, replacing the legacy deletion_summary object with
the deleted, success, and deleted_at fields that match the actual implementation
introduced in PR #6639. Added BDD feature file and step definitions to validate
the output format.

ISSUES CLOSED: #7872
2026-06-02 04:09:01 -04:00
HAL9000 7859a6c05b fix(alembic): handle fileConfig parsing errors with user-friendly diagnostic (#7874)
Wrapped the `fileConfig()` call in `src/cleveragents/infrastructure/database/migrations/env.py`
with a `try/except` block that catches malformed INI logging configuration and emits
a clear, user-actionable error message to stderr before exiting with code 1.

Includes:
- Error handling guard around fileConfig() in env.py (fileConfig can raise
  configparser.Error, KeyError, ValueError on malformed logging config)
- BDD/Behave feature file with 4 scenarios under `features/`
- Step definitions in `features/steps/` for isolated test coverage
- CHANGELOG.md entry under [Unreleased] Fixed section
- CONTRIBUTORS.md update for HAL 9000

ISSUES CLOSED: #7874

Signed-off-by: CleverThis <hal9000@cleverthis.com>
2026-06-02 03:39:50 -04:00
HAL9000 3577bf95ba feat: implement automation profile precedence chain plan action global
CI / lint (pull_request) Successful in 56s
CI / quality (pull_request) Successful in 55s
CI / typecheck (pull_request) Successful in 1m2s
CI / security (pull_request) Successful in 1m11s
CI / helm (pull_request) Successful in 31s
CI / build (pull_request) Successful in 33s
CI / push-validation (pull_request) Successful in 29s
CI / unit_tests (pull_request) Successful in 6m49s
CI / docker (pull_request) Successful in 1m32s
CI / integration_tests (pull_request) Successful in 9m20s
CI / coverage (pull_request) Successful in 8m1s
CI / status-check (pull_request) Successful in 5s
Implementation of the four-level automation profile precedence chain
(plan > action > project > global) as defined in the v3.5.0 specification.

Core implementation (src/):
  - PrecedenceSource StrEnum with PLAN, ACTION, PROJECT, GLOBAL levels
  - PrecedenceResolution frozen dataclass capturing full resolution state
  - resolve_precedence_chain() with plan > action > project > global logic
  - _resolve_global_profile() with explicit > env var > default fallback
  - Comprehensive debug logging for observability

BDD tests (features/):
  - automation_profile_precedence_chain.feature: 30 scenarios covering all
    16 combinations of plan/action/project/global configurations plus edge
    cases, logging verification, enum values, env var override, and custom registry
  - step definitions with proper log handler cleanup via context._cleanup_handlers

CI compliance fixes (bd8b6748):
  - ruff format applied to step definitions (fixes CI lint gate)
  - CHANGELOG.md updated with accurate 4-level chain description
  - test_reports/ artifacts removed; directory added to .gitignore
  - tdd_a2a_sdk_dependency.feature reverted to use correct Client import

ISSUES CLOSED: #8234
2026-06-02 01:25:33 -04:00
HAL9000 9854b2c7cc chore: add CHANGELOG.md and CONTRIBUTORS.md entries for tracking prefix fix (#7891)
CI / push-validation (pull_request) Successful in 20s
CI / lint (pull_request) Successful in 35s
CI / build (pull_request) Successful in 33s
CI / helm (pull_request) Successful in 40s
CI / typecheck (pull_request) Successful in 59s
CI / quality (pull_request) Successful in 59s
CI / security (pull_request) Successful in 1m18s
CI / unit_tests (pull_request) Successful in 6m33s
CI / docker (pull_request) Successful in 1m30s
CI / integration_tests (pull_request) Successful in 10m3s
CI / coverage (pull_request) Successful in 9m18s
CI / status-check (pull_request) Successful in 3s
Added missing CHANGELOG.md entry under [Unreleased] > Fixed section documenting
the AUTO-REV-POOL to AUTO-REV-SUP tracking prefix alignment for the
pr-review-pool-supervisor agent.

Added CONTRIBUTORS.md entry crediting HAL 9000 for the tracking prefix
documentation fix (#7891).

ISSUES CLOSED: #7891
2026-06-02 00:58:16 -04:00
HAL9000 a38cb5c317 fix(uat-tester): remove one-shot script and batch examples.json update
- Delete scripts/fix_uat_tester.py: one-off patch script with a
  hardcoded /tmp path that no longer exists. Per CONTRIBUTING.md,
  scripts/ is for ongoing-purpose utilities, not development artifacts.

- Remove update_examples_json() from create_documentation_pr(): each
  per-PR call was modifying examples.json inside the git clone, causing
  merge conflicts when parallel UAT workers created docs PRs
  simultaneously. Option A from reviewer: move the call outside the PR
  creation function entirely.

- Add batch update_examples_json(documented_examples) call after the
  inner docs-PR creation loop completes, guarded by `if documented_examples`.
  This runs once per cycle instead of once per PR, eliminating the
  examples.json conflict surface for parallel workers.

- Expand CHANGELOG entry to reflect the examples.json fix.

ISSUES CLOSED: #4374
2026-06-01 01:07:53 -04:00
HAL9000 6116236c71 fix(agents): resolve PR lint failures and changelog for #5768
Fixed lint errors in fix_uat_tester.py (unused import, string concatenation).
Added CHANGELOG entry per CONTRIBUTING.md requirements.

Closes #5768
2026-06-01 01:07:53 -04:00
HAL9000 c9b274a925 fix(cli): emit JSON envelope messages for session list/show/delete/export/import
The session create command already emitted a spec-compliant JSON envelope
with messages[].text populated, but list, show, delete, export, and
import did not — they either passed no `messages` to `format_output()`
(producing an envelope with an empty messages array) or short-circuited
to a Rich-styled `console.print(...)` line that breaks JSON parsing
entirely.

Failing scenarios in features/session_cli.feature (unit_tests gate)
asserted `messages[0].text == "<command-specific success>"`. Wire each
command's machine-readable path to emit a structured envelope with the
expected message:

- list (empty) → "0 sessions listed"
- list (populated) → "<N> sessions listed"
- show → "Session details loaded"
- delete --format json|yaml|plain → "Session deleted"
- export --output-format json|yaml|plain → "Export completed"
- import --format json|yaml|plain → "Import completed"

The export command gains a new `--output-format` flag distinct from the
existing `--format` (which selects export content format: json or md).
When the new flag is non-rich, the raw export content is suppressed from
stdout so the envelope remains the only thing emitted, and Rich panels
are skipped.

The import command gains a `--format` flag. The delete command already
had a `--format` option but its non-rich branch emitted Rich-styled text
instead of an envelope; that branch now splits cleanly: `--format color`
keeps the human-readable line, and json/yaml/plain emit an envelope.

Also addresses the `Session create initializes MCP logger` and
`Session list initializes MCP logger` scenarios in
features/session_cli_mcp_logger_simple_execution.feature, which inspect
the create()/list_sessions() source via inspect.getsource() and assert
the literal string `logging.getLogger(_MCP_LOGGER_NAME)` appears. Both
functions held the inlined literal `"cleveragents.mcp"` instead of the
module-level `_MCP_LOGGER_NAME` constant; substitute the constant
reference in both call sites.

CHANGELOG entry extended to document the envelope coverage across all
session commands.

ISSUES CLOSED: #6441
2026-06-01 00:40:59 -04:00
HAL9000 fba9cbf8d1 fix(cli): resolve session export test assertion and move get_container to top-level import
- Fix `security_template_coverage_boost.feature` assertion for "Session
  export to stdout outputs JSON": the export path outputs raw JSON with
  a `session_id` key, not a `data` envelope, so revert the erroneous
  `"data"` assertion back to `"session_id"`.
- Move all deferred `from cleveragents.application.container import
  get_container` imports in session.py to the module-level import
  block, consistent with every other CLI command file (action.py,
  actor.py, config.py, plan.py, etc.). No circular import exists.
- Update `session_cli_uncovered_branches_steps.py` to patch
  `cleveragents.cli.commands.session.get_container` directly (the
  correct target after a top-level import) instead of replacing
  `sys.modules["cleveragents.application.container"]`.
- Add CHANGELOG.md entry for the session create JSON envelope fix.

ISSUES CLOSED: #6441
2026-06-01 00:40:59 -04:00
HAL9000 565263ab24 fix(cli): fix project context show test mock for tier service
Add ContextTierService mock to step_m5_invoke_project_context_show
so the CLI command can call _get_context_tier_service() without
failing. Also patch _load_policy_json to prevent JSON decode errors
from MagicMock session objects. Update CHANGELOG.md and CONTRIBUTORS.md.

ISSUES CLOSED: #6323
2026-05-31 20:45:10 -04:00
HAL9000 b1bfaf032e fix(cli): fix JSON/YAML envelope messages[].text for delete/export/import
Extend the JSON/YAML envelope messages[].text fix to cover the remaining
three session subcommands that were still producing plain Rich output
instead of structured envelopes for non-rich format paths:

- session delete: route non-rich formats through format_output() with
  messages=[{"level": "ok", "text": "Session deleted"}]
- session export: add --output-format/-f option; emit structured envelope
  with session_export/contents/integrity data and "Export completed" message
- session import: add --format/-f option; emit structured envelope with
  session_import/validation/merge data and "Import completed" message

Also add BDD scenarios to features/session_cli.feature for each new
envelope path, add corresponding step definitions, add CHANGELOG entry
under [Unreleased] Fixed, and assign milestone v3.2.0 to the PR.

ISSUES CLOSED: #6457
2026-05-31 19:27:43 -04:00
HAL9000 d95873b446 docs: update CHANGELOG for --url flag support 2026-05-31 15:39:36 -04:00
HAL9000 e884dce240 Add CHANGELOG entry for resource removal guard fix (bug #6886)
CI / helm (pull_request) Successful in 32s
CI / build (pull_request) Successful in 37s
CI / lint (pull_request) Successful in 1m0s
CI / push-validation (pull_request) Successful in 21s
CI / quality (pull_request) Successful in 1m1s
CI / typecheck (pull_request) Successful in 1m14s
CI / security (pull_request) Successful in 1m19s
CI / unit_tests (pull_request) Successful in 9m9s
CI / docker (pull_request) Successful in 1m49s
CI / coverage (pull_request) Successful in 14m9s
CI / integration_tests (pull_request) Successful in 26m12s
CI / status-check (pull_request) Successful in 3s
The PR was missing the required changelog documentation under [Unreleased] ### Fixed

Signed-off-by: CleverThis <hal9000@cleverthis.com>
2026-05-31 13:33:31 -04:00
HAL9000 bc64074036 docs: add tool and validation management showcase
CI / push-validation (pull_request) Successful in 27s
CI / build (pull_request) Successful in 39s
CI / lint (pull_request) Successful in 43s
CI / helm (pull_request) Successful in 46s
CI / typecheck (pull_request) Successful in 1m11s
CI / quality (pull_request) Successful in 1m11s
CI / security (pull_request) Successful in 1m15s
CI / unit_tests (pull_request) Successful in 7m0s
CI / docker (pull_request) Successful in 1m33s
CI / coverage (pull_request) Successful in 15m2s
CI / integration_tests (pull_request) Successful in 24m26s
CI / status-check (pull_request) Successful in 3s
- document the CLI workflow for registering tools, wrapping validations, and querying registry metadata

- index the new example in docs/showcase/examples.json

- re-enable coverage threshold regression checks by removing obsolete tdd_expected_fail tags

ISSUES CLOSED: #4565

Refs: #4305

Refs: #4227
2026-05-30 17:21:55 -04:00
HAL9000 b8eab7c032 fix(resources): delete executable.yaml, fix resource list columns, update docs
CI / push-validation (pull_request) Successful in 20s
CI / lint (pull_request) Successful in 38s
CI / build (pull_request) Successful in 31s
CI / helm (pull_request) Successful in 34s
CI / quality (pull_request) Successful in 59s
CI / typecheck (pull_request) Successful in 1m7s
CI / security (pull_request) Successful in 1m14s
CI / unit_tests (pull_request) Successful in 5m39s
CI / docker (pull_request) Successful in 1m28s
CI / coverage (pull_request) Successful in 12m39s
CI / integration_tests (pull_request) Successful in 27m48s
CI / status-check (pull_request) Successful in 2s
- Delete examples/resource-types/executable.yaml (orphaned artifact referencing
  non-existent ExecutableHandler; flagged in 4 prior reviews as blocking)
- Update agents resource list CLI columns from [ID, Name, Type, Status, Kind,
  Location, Description] to spec-required [Name, ID, Type, Phys/Virt, Children,
  Projects] per specification line 11051
- Lifecycle state for container resources now shown as a note below the table
- Update resource_list_lifecycle_state.feature to remove Status column header
  assertions; add spec-column header scenario
- Add BDD scenario in resource_cli.feature verifying new column headers
- Update CHANGELOG.md and CONTRIBUTORS.md

ISSUES CLOSED: #3077
2026-05-30 15:43:56 -04:00
HAL9000 b65f0db8d0 fix(cli): add Read-Only and Writes columns to tool list output
CI / lint (pull_request) Successful in 51s
CI / typecheck (pull_request) Successful in 1m6s
CI / security (pull_request) Successful in 1m13s
CI / helm (pull_request) Successful in 39s
CI / build (pull_request) Successful in 46s
CI / quality (pull_request) Successful in 1m7s
CI / push-validation (pull_request) Successful in 31s
CI / unit_tests (pull_request) Successful in 6m33s
CI / docker (pull_request) Successful in 1m28s
CI / coverage (pull_request) Successful in 11m43s
CI / integration_tests (pull_request) Successful in 25m4s
CI / status-check (pull_request) Successful in 2s
- Apply ruff format to tool.py (flatten single-line namespaces.add call)
- Add Behave BDD tests verifying 5-column table, capability rendering
  (checkmark/dash), and Summary panel presence
- Add CHANGELOG.md entry

ISSUES CLOSED: #1476
2026-05-30 03:33:08 -04:00