diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index de4a634c1..e42c1e80c 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -209,6 +209,7 @@ jobs: path: build/nox-quality-output.log retention-days: 30 + timeout-minutes: 30 unit_tests: runs-on: docker container: @@ -282,6 +283,7 @@ jobs: path: build/nox-unit-tests-output.log retention-days: 30 + timeout-minutes: 45 integration_tests: runs-on: docker container: diff --git a/CHANGELOG.md b/CHANGELOG.md index de9c852f3..2e46470cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -198,6 +198,25 @@ ensuring data is stored with proper parameter values. LLM streaming output. A `SessionActorNotConfiguredError` is raised with exit code 1 when no actor is configured. + +### Added + +- **ContextStrategy Protocol and Plugin Registration System** (#10590): Implemented the + ``ContextStrategy`` protocol for pluggable context assembly strategies within the ACMS. + Includes six built-in strategy implementations: ``SimpleKeywordStrategy`` (keyword matching, + quality 0.3), ``SemanticEmbeddingStrategy`` (word-overlap similarity search, quality 0.6), + ``BreadthDepthNavigatorStrategy`` (UKO hierarchy traversal with depth/breadth projection, + quality 0.85), ``ARCEStrategy`` (multi-modal pipeline combining text/vector/graph backends, + quality 0.95), ``TemporalArchaeologyStrategy`` (historical pattern discovery from cold-tier data, + quality 0.5), and ``PlanDecisionContextStrategy`` (ancestor plan decision retrieval, quality 0.7). + The ``StrategyRegistry`` provides thread-safe registration, enable/disable configuration, + per-strategy timeout/fragment limits, circuit-breaker tracking, validation warnings, and plugin + discovery from ``"module:ClassName"`` strings with a module-prefix allowlist for security. + Seventy-seven (77) Behave scenarios cover strategy selection by confidence scoring, backend + capability matching, duplicate registration rejection, stale enabled-list detection, + MappingProxyType coercion validators, thread-safety under concurrent access, boundary value + validation via Pydantic model constraints, and per-strategy config updates. + ### Added - **Automated CLI Docstring Example Validation** (#9106): Added `DocstringExampleValidator` @@ -252,8 +271,6 @@ ensuring data is stored with proper parameter values. traceback in the structlog warning entry. Removed `@tdd_expected_fail` tag from the TDD test so both scenarios run as normal regression guards. (#988) -### Added - - **`pr-review-worker` review-started notification** (#11028): The `first_review` and `re_review` modes now post a "review started" notification comment to the PR at the beginning of the review, giving PR authors immediate visibility diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 2aa93a814..ca832487b 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -46,6 +46,9 @@ Below are some of the specific details of various contributions. * HAL 9000 has contributed the PureGraph BDD coverage suite (PR #9601 / issue #9531): wired the previously orphaned `features/steps/pure_graph_coverage_steps.py` definitions through the existing `features/consolidated_langgraph.feature` (topological ordering, function execution, missing function fallback, and non-functional node handling); created Robot Framework integration tests in `robot/langgraph/pure_graph.robot` backed by the `robot/langgraph/pure_graph_lib.py` Python library; and implemented ASV benchmarks in `benchmarks/pure_graph_bench.py` measuring execution throughput across varying node counts. * HAL 9000 has contributed comprehensive milestone documentation for v3.2.0 (Decisions + Validations + Invariants) and v3.3.0 (Corrections + Subplans + Checkpoints), including CLI command reference, decision system guide, and subplan/checkpoint documentation (PR #9796). * Rui Hu has contributed the v3 actor YAML schema validation fix (#5869): added `ActorConfigSchema` validation to the `agents actor add --config` CLI command, covering cycle detection, required field validation, and enum validation for v3 YAML actor definitions. +* HAL 9000 has contributed the agent-evolution-pool-supervisor PR metadata assignment (#7888): the supervisor now automatically looks up the Type/Automation label and earliest open milestone before dispatching improvement PR creation workers, ensuring all generated improvement PRs have correct Type labels and milestone assignments. +* HAL 9000 has contributed the decision recording hook for the Strategize phase (issue #8522): captures every decision point with question, chosen option, alternatives, confidence, rationale, and full context snapshot for replay and correction. +* HAL 9000 has contributed the ContextStrategy protocol and StrategyRegistry plugin registration system (PR #10590 / issue #8616): implemented the pluggable context assembly strategy protocol with proper type-safe method signatures, created the central thread-safe StrategyRegistry supporting registration, lookup, entry-point discovery, and per-strategy configuration (timeout, fragments limits, workers, circuit breaker threshold). Six built-in strategies implemented and documented: simple-keyword, semantic-embedding, breadth-depth-navigator, arce, temporal-archaeology, and plan-decision-context. Full BDD test coverage including thread safety, boundary validation, and error handling tests. (Part of Epic #8505) * This project was made possible thanks to considerable donation of time, money, and resources by CleverThis, Inc. * HAL 9000 has contributed automated bug fixes, CLI output formatting improvements, and ongoing maintenance as part of the CleverAgents automation system. * HAL 9000 has contributed the pr-review-pool-supervisor tracking prefix documentation fix (#7891): aligned all documentation references from the outdated `AUTO-REV-POOL` prefix to the correct `AUTO-REV-SUP` prefix used in production. diff --git a/src/cleveragents/application/services/acms_service.py b/src/cleveragents/application/services/acms_service.py index 99ccdf93f..940576029 100644 --- a/src/cleveragents/application/services/acms_service.py +++ b/src/cleveragents/application/services/acms_service.py @@ -111,13 +111,27 @@ logger = structlog.get_logger(__name__) # --------------------------------------------------------------------------- -# Strategy capabilities (spec ~line 25167) +# StrategyCapabilities — pipeline-specific variant (backward-compatible) # --------------------------------------------------------------------------- +# The domain-model ``StrategyCapabilities`` in +# ``domain/models/acms/strategy.py`` declares backend-usage flags +# (uses_text, uses_vector, uses_graph, etc.). ACMSPipeline uses a +# simpler dataclass for its internal strategy selectors. Both are +# re-exported here for backward compatibility; the pipeline-specific +# variant is used only by :class:`RelevanceStrategy`, +# :class:`RecencyStrategy`, :class:`TieredStrategy`, and +# :class:`SpecStrategyAdapter`. @dataclass(frozen=True) class StrategyCapabilities: - """Capabilities declared by a context strategy.""" + """Pipeline-specific capabilities declared by a context strategy. + + This is a backward-compatible variant of the domain-model + ``~cleveragents.domain.models.acms.strategy.DomainStrategyCapabilities``. + For production strategies that implement the true spec protocol, use + ``DomainStrategyCapabilities`` instead. + """ supports_semantic_search: bool = False supports_graph_navigation: bool = False @@ -127,18 +141,33 @@ class StrategyCapabilities: # --------------------------------------------------------------------------- -# Context strategy protocol (spec ~line 25167) +# ContextStrategy — pipeline-compatible protocol for ACMSPipeline # --------------------------------------------------------------------------- +# The domain-model ``ContextStrategy`` Protocol in +# ``domain/models/acms/strategy.py`` uses the full spec signature +# ``can_handle(request, backends) -> confidence`` / +# ``assemble(request, backends, budget, plan_context) -> fragments``. +# ACMSPipeline's internal strategies (Relevance, Recency, Tiered) and +# the SpecStrategyAdapter use a simpler pipeline-compatible Protocol +# because they operate on pre-fetched fragments rather than querying +# backends directly. SpecStrategyAdapter bridges between the two. +# When issue #3491 resolves protocol consolidation, this local Protocol +# can be replaced with ``DomainContextStrategy`` from +# ``cleveragents.domain.models.acms.strategy``. @runtime_checkable class ContextStrategy(Protocol): - """Protocol for context strategies. + """Pipeline-compatible Protocol for context strategies. - Based on ``docs/specification.md`` ~line 25167. Each strategy declares - a ``name`` and ``capabilities``, can report its confidence for a request - via ``can_handle``, produce fragments via ``assemble``, and explain its - approach via ``explain``. + ACMSPipeline's internal strategies (Relevance, Recency, Tiered) and + the SpecStrategyAdapter implement this interface. The domain-model + ``DomainContextStrategy`` uses a different signature that queries + backends directly during :meth:`assemble`. SpecStrategyAdapter bridges + between the two by ranking pre-fetched fragments by relevance score. + + When issue #3491 is resolved, this Protocol can be removed in favour of + ``DomainContextStrategy`` from ``cleveragents.domain.models.acms.strategy``. """ @property