Implement strategy registry integration as spec §47561 by adding:
- load_strategies_from_config() in context_strategies.py for TOML-driven
strategy bootstrapping (register builtins, discover custom plugins via
module:ClassName, set enabled list)
- Re-exports of StrategyRegistry, StrategyConfig, StrategyRegistryEntry,
StrategyNotFoundError, StrategyRegistrationError and ContextStrategy from
strategy_registry and acms_service modules
- __all__ export list and DEFAULT_ENABLED_STRATEGIES constant
Fix StrategyRegistry.validate_registry() to skip resource_types check for
v1 pipeline strategies (context_strategies.py, acms_service.py) whose
StrategyCapabilities dataclass lacks the domain-model resource_types field,
preventing false-positive warnings. Adds _is_v1_pipeline_caps() helper.
Auto-load strategy configuration from Settings in ACMSPipeline.__init__()
when a Settings object is provided, reading context.strategies config and
registering/ enabling strategies via the plugin loader.
The previous refactor routed list_invariants through _resolve_scope,
which silently changed the no-flags behavior: _resolve_scope returns
(GLOBAL, "system") when no flag is given (the `add` default), so
`agents invariant list` filtered to only global+system invariants
instead of returning every active invariant.
InvariantService.list_invariants documents scope=None / source_name=None
as "all scopes" / "all sources"; the listing CLI must preserve that
contract. Inline the mutual-exclusion check in list_invariants and
restore the if/elif chain that leaves scope/source_name=None when no
flag is set, while keeping `agents invariant add` defaulting to global.
Tests added:
- "List invariants with no flags passes no scope filter" verifies the
service is called with scope=None, source_name=None.
- "List invariants with conflicting scope flags rejected" covers the
new BadParameter raise path.
ISSUES CLOSED: #11049
Fix `_resolve_scope()` to properly check the `is_global` parameter
instead of silently ignoring it. Replace the standalone if/elif chain
in `list_invariants` with a call to `_resolve_scope()` so that scope
flag conflicts are consistently rejected on both `add` and `list`
commands via mutual-exclusion validation.
- Explicit global check in _resolve_scope() for correctness
- list_invariants uses shared _resolve_scope for consistent validation
- BDD coverage: add scenario for list with conflicting scope flags
- Robot coverage: add list-scope-conflict smoke test
- CHANGELOG.md and CONTRIBUTORS.md updated
ISSUES CLOSED: #11049
- Fix _resolve_scope() to properly use the is_global parameter instead of ignoring it
- Replace standalone if/elif chain in list_invariants with a call to _resolve_scope for consistent scope resolution
Fix missing plugin import in cli/main.py that caused lint/typecheck/test
cascade failures. Add plugin to _register_subcommands() import list so
plugin.app reference at line 233 resolves correctly.
Also fix AmbiguousStep collision: semantic_context_search_steps.py
defined @when("I assemble context with query {query}") duplicating the
same step in advanced_context_strategies_steps.py, crashing all 836
Behave features at load time. Rename to @when("I assemble semantic
context with query {query}") and update the feature file to match.
ISSUES CLOSED: #5254
Three scenarios in features/semantic_context_search.feature were erroring
during behave execution, surfacing as test setup/teardown errors in CI's
unit_tests gate. Each had a distinct root cause:
1. "Filter fragments by minimum similarity threshold" (line 30) referenced
context.ranked_fragments inside step_filter_by_threshold, but the
scenario filters directly without first running the "rank fragments"
step that populates that attribute. The filter step now computes
per-fragment similarity inline from context.fragments +
context.query_embedding so it works regardless of whether a prior
ranking step ran.
2. "Semantic strategy selects relevant files" (line 41) constructed
ContextFragment with a FragmentProvenance imported from
cleveragents.domain.models.acms.crp. The core ContextFragment's
provenance field is annotated with the core FragmentProvenance subclass
(which adds resource_type), and pydantic v2's strict model_type check
rejects a bare CRP-base instance. Switched the import to the core
FragmentProvenance so the type matches.
3. "Embedding provider configuration" (line 53) stored its provider config
on context.config. Behave's Context reserves the config attribute for
its own Configuration object; user assignment raises KeyError inside
Behave's scope-tracking __setattr__. Renamed to embedding_config.
Verified locally: behave on features/semantic_context_search.feature now
reports 6 scenarios passed / 0 errored. lint + typecheck both pass.
ISSUES CLOSED: #5254
Fix ruff format lint on plugin.py by removing the out-of-scope stub and
its main.py registration. Fix bandit B324 security finding by annotating
the MockEmbeddingProvider MD5 call with usedforsecurity=False. Add
CHANGELOG entry under [Unreleased].
ISSUES CLOSED: #5254
- Replace non-deterministic hash() in MockEmbeddingProvider with
hashlib.md5 for reproducible test outputs
- Change zip(strict=False) to strict=True in cosine_similarity
- Add vocabulary overflow warning in SimpleWordEmbeddingProvider
- Fix spec reference in module docstring (remove line numbers)
- Remove Quality: 0.4 development artifact from docstring
- Fix type annotations (list[float] instead of bare Sequence[float])
- Add noqa comments for SIM300 false positives
ISSUES CLOSED: #5254
- Fix ruff lint errors in embedding_provider.py (Sequence import, zip strict)
- Fix ruff lint errors in semantic_context_search_steps.py (import ordering, unused vars, whitespace)
- Fix ContextFragment creation in steps to include required provenance field
- Create missing plugin.py CLI module referenced in main.py
- Add plugin command to valid_cmds list in main.py
- Add EmbeddingProvider ABC for pluggable embedding generation
- Implement SimpleWordEmbeddingProvider for lightweight semantic similarity
- Implement MockEmbeddingProvider for testing
- Add cosine_similarity utility function for vector comparison
- Create comprehensive Behave BDD tests for semantic context search
- Support configurable embedding providers (local/API)
- Enable relevance-based file selection using embeddings
- Full type annotations with no suppression
- Coverage >= 97% for all new code
Closes#5254
langchain-community 0.4.2 removed ChatOllama from its chat_models
module. Switch to the standalone langchain-ollama package which is
the official replacement.
- ollama_provider.py: import ChatOllama from langchain_ollama
- pyproject.toml: replace ollama>=0.1.0 with langchain-ollama>=0.1.0
- uv.lock: regenerated to include langchain-ollama v1.1.0
- Fix import order in ollama_provider.py (langchain_community before langchain_core)
- Remove duplicate shared step definitions from ollama_provider_steps.py
- Remove duplicate shared step definitions from mistral_provider_steps.py
The duplicate @given step definitions caused AmbiguousStep errors when running the full Behave test suite. Shared steps (provider domain inputs, plan generation graph setup) are already defined in openai_provider_steps.py and loaded by Behave for all feature files.
- Implemented OllamaChatProvider to enable local Ollama model support.
- Implemented MistralChatProvider to integrate with the Mistral API.
- Added Behave BDD tests for both providers.
- Updated dependencies: langchain-mistralai and ollama.
- Updated provider exports to include the new providers.
ISSUES CLOSED: #5257
The docker gate has been failing on `curl: (22) ... error: 404` against
the v0.58.0 GitHub release tarball even after pinning the version. The
helm gate's kubeconform download from github.com/yannh/kubeconform works
in the same workflow, so it's a Trivy-asset-path-specific 404 (URL/CDN
state we don't control), not a blanket github.com block.
Switch to `aquasec/trivy:0.58.0` pulled from Docker Hub:
- Docker Hub is already proven reachable by the preceding `docker build`
steps (server image base layers pull successfully in this same dind
job).
- A pinned tag's manifest digest is itself the verifiable artifact — no
separate checksum file fetch and grep dance.
- Trivy runs against the just-built `cleveragents-server:test` image
via the mounted dind docker socket.
- Same severity gating (`--severity HIGH,CRITICAL --exit-code 1`) and
same trailing detailed-report step are preserved verbatim.
ISSUES CLOSED: #1927
The prior pin used TRIVY_VERSION=0.57.1, but Trivy never published a
v0.57.1 tag — the release sequence went v0.57.0 → v0.58.0. The CI
docker job consequently failed with `curl: (22) The requested URL
returned error: 404` when fetching trivy_0.57.1_Linux-64bit.tar.gz.
- Bump TRIVY_VERSION to 0.58.0 (the first stable release after v0.57.0).
- Factor the GitHub release base URL into TRIVY_BASE_URL.
- Add explicit `set -euo pipefail` so each curl failure surfaces
immediately instead of relying on the runner's implicit -e.
- Anchor the checksum grep with ` ${TRIVY_TARBALL}$` so a partial
filename match cannot smuggle in the wrong checksum line.
- Wrap the checksum verification in a subshell so `cd /tmp` does not
affect later commands.
ISSUES CLOSED: #1927
- Pin Trivy installation to v0.57.1 with checksum verification instead
of the insecure curl-pipe-sh install pattern
- Fix BDD step context initialization: load workflow_content in the
Background step so scenarios 17/24/31 no longer error with AttributeError
- Fix ruff format violations in step definitions
- Add Robot Framework integration test verifying CI scan configuration
- Add CHANGELOG entry for issue #1927
ISSUES CLOSED: #1927
Added Trivy-based security scanning to the CI pipeline for the Dockerfile.server image.
The scan is configured to fail the build on any HIGH or CRITICAL severity vulnerabilities,
preventing insecure images from being deployed to production.
Changes:
- Added security scan step to .forgejo/workflows/ci.yml docker job
- Trivy is installed and executed after building the Dockerfile.server image
- Scan results are displayed in CI job output with detailed vulnerability report
- Build fails (non-zero exit) if HIGH or CRITICAL vulnerabilities are detected
- Added BDD feature file and step definitions for security scanning verification