Commit Graph

133 Commits

Author SHA1 Message Date
HAL9000 421429c65f fix(invariant): persist invariants to database via InvariantRepository and Alembic migration
ISSUES CLOSED: #8573
2026-06-18 11:36:35 -04:00
CleverAgents Bot d0e685aed4 fix(cli): add project switch command
CI / load-versions (pull_request) Successful in 17s
CI / push-validation (pull_request) Successful in 25s
CI / quality (pull_request) Successful in 54s
CI / lint (pull_request) Successful in 1m1s
CI / security (pull_request) Successful in 1m9s
CI / typecheck (pull_request) Successful in 1m16s
CI / build (pull_request) Successful in 30s
CI / helm (pull_request) Successful in 36s
CI / unit_tests (pull_request) Successful in 6m3s
CI / docker (pull_request) Successful in 2m16s
CI / integration_tests (pull_request) Successful in 8m28s
CI / coverage (pull_request) Successful in 12m21s
CI / status-check (pull_request) Successful in 3s
ISSUES CLOSED: #8675
2026-06-18 00:57:44 -04:00
HAL9000 7faab96582 fix(acms): resolve all reviewer feedback for context policy loader and plan execution integration
Fixed all blocking issues identified in 4 REQUEST_CHANGES reviews:

- Removed broken ContextPolicy import (root cause of all CI failures)
- Fixed all ruff lint violations: deprecated typing aliases, format parameter shadowing built-in, unused imports, imports inside functions, SIM115/SIM102
- Fixed Behave step ambiguity and duplicate step definitions across files
- Fixed context.config collision with Behave's internal config attribute
- Added CHANGELOG entry for the new ACMS context policy feature
- Added CONTRIBUTORS.md entry for HAL9000
- Added performance benchmark file: benchmarks/acms_context_policy_bench.py
- Fixed pre-existing lint errors in scripts/validate_automation_tracking.py
- Wired PlanExecutionACMSIntegration documentation to explain integration point

ISSUES CLOSED: #9584
2026-06-17 23:15:50 -04:00
HAL9000 7470f98155 fix(concurrency): add thread safety to InvariantService
Add threading.RLock to InvariantService to protect shared state
(_invariants dict, _enforcement_records list) from concurrent access
by multiple threads during parallel plan execution. Prevents
RuntimeError: dictionary changed size during iteration and data
corruption in multi-threaded environments.

Changes:
- Added self._lock = RLock() in __init__
- Wrapped all public methods (add_invariant, list_invariants,
  remove_invariant, get_effective_invariants, enforce_invariants)
  with lock acquisition via context managers
- Added helper read methods: get_enforcement_records(), get_invariant(),
  get_invariants_snapshot() -- all thread-safe
- Added BDD tests for concurrent access patterns
- Updated CHANGELOG.md and CONTRIBUTORS.md

ISSUES CLOSED: #7524
2026-06-17 22:36:33 -04:00
HAL9000 4d5fa6a9d1 feat(acms): implement budget enforcement for max_file_size and max_total_size constraints
Add ACMS BudgetEnforcer dataclass with per-file (max_file_size) and
aggregate (max_total_size) constraint enforcement. Includes:

- BudgetEnforcer: core enforcer with add_file(), get_assembled_context(),
  get_violations(), reset() methods and defensive-copy returns
- BudgetViolation: structured violation reporting with filename, file_size,
  limit, and clear actionable messages (error for max_file_size, warning
  for max_total_size)
- ContextFile: size tracking with automatic byte-size calculation from UTF-8

Also updates src/cleveragents/acms/__init__.py to export budget enforcement
classes alongside existing UKO vocabulary exports.

Comprehensive BDD test coverage: 11 Behave scenarios covering inclusion,
exclusion, boundary conditions, cumulative budget cutoff, ordering,
metadata reporting, empty files, and multi-byte UTF-8 measurement.
Robot Framework integration tests with helper module.

ISSUES CLOSED: #9583

Signed-off-by: HAL9000 <hal9000@cleverthis.com>
2026-06-17 19:54:20 -04:00
HAL9000 3dc22f4630 fix(a2a/events): guard A2aEventQueue with threading.Lock to prevent concurrent iteration crash
Fix a critical concurrency bug in A2aEventQueue.publish() where the method
iterates over _subscriptions without holding a lock. This causes RuntimeError:
dictionary changed size during iteration when subscribe_local/unsubscribe are
called concurrently from other threads.

The fix introduces a threading.Lock to protect all state mutations and
dictionary access in the A2aEventQueue class, while carefully ensuring callbacks
are invoked outside the lock to prevent potential deadlocks.

Changes:
- src/cleveragents/a2a/events.py: Added _lock attribute, protected
  __init__, is_closed, publish, subscribe_local, unsubscribe, get_events,
  and close methods with threading.Lock snapshot pattern for callbacks.

- features/a2a_event_queue_concurrency.feature: BDD feature file with 6
  scenarios covering concurrent publish/subscribe/unsubscribe safety.

- features/steps/a2a_event_queue_concurrency_steps.py: Step definitions
  implementing multi-threaded concurrency test harness.

ISSUES CLOSED: #7604
2026-06-17 18:24:32 -04:00
HAL9000 013b779e30 fix(v3.7.1): Align ContextTierService default budget values with TierBudget model (#1443)
The DEFAULT_MAX_TOKENS_HOT was 8000 (should be 16000),
DEFAULT_MAX_DECISIONS_WARM was 500 (should be 100), and
DEFAULT_MAX_DECISIONS_COLD was 5000 (should be 500). These values in context_tier_settings.py did not match the canonical defaults defined in TierBudget model (tiers.py) or Settings class defaults, causing incorrect budget enforcement when settings were None.

ISSUES CLOSED: #1443
2026-06-17 15:28:59 -04:00
HAL9000 787b99329a fix(a2a): correct IndentationError, add tdd_issue_9250 tags, fix CONTRIBUTORS
- Fix 2-space -> 4-space indentation on _handle_session_close in
  facade.py; this single error caused every CI gate to fail
  (lint, typecheck, unit_tests, integration_tests, e2e_tests, security)
- Add @tdd_issue @tdd_issue_9250 tags to the three session_id
  validation scenarios in a2a_facade_coverage.feature per the mandatory
  bug-fix TDD workflow requirement
- Fix CONTRIBUTORS.md entry: was PR #11053 / issue #9094, corrected to
  PR #11098 / issue #9250

ISSUES CLOSED: #9250
2026-06-17 08:49:34 -04:00
HAL9000 863be6780a fix(a2a): validate session_id at entry of _handle_session_close before devcontainer cleanup
The _handle_session_close handler in the A2A local facade previously validated
session_id only after checking whether a session service was wired. When no
session service was available, _cleanup_session_devcontainers() was invoked
with an empty or missing session_id, risking incorrect container lifecycle
operations on unknown sessions. This fix moves validation to the top of
_handle_session_close so it applies uniformly across both code paths.

Updated BDD tests in features/a2a_facade_wiring.feature and
features/a2a_facade_coverage.feature to reflect the new validation behavior.

PR-CLOSED: #9250
2026-06-17 08:49:34 -04:00
HAL9000 653a4e9001 fix(plan): wrap plan tree JSON/YAML output in spec-required command envelope
Add `command="agents plan tree"` parameter to the `format_output()` call for
the `plan tree` CLI command, so that JSON and YAML output conforms to the
spec's Output Rendering Framework. The output is now a proper envelope with
`command`, `status`, `exit_code`, `data`, `timing`, and `messages` fields.

Update BDD step definitions to validate envelope structure and update feature
scenarios for spec-compliant assertions. Remove `@tdd_expected_fail` tag from
the previously-failing JSON tree format test (issue #4254).

ISSUES CLOSED: #11041
2026-06-17 04:52:07 -04:00
HAL9000 d1ced790ca docs: update CHANGELOG, CONTRIBUTORS, and fix DI snippet for module guides (#4848)
- Add CHANGELOG.md [Unreleased] entry for the three new module guides
- Add CONTRIBUTORS.md entry for HAL9000 authoring the module guides
- Fix InvariantReconciliationActor DI container snippet in
  invariant-reconciliation.md: replace incorrect event_bus/audit_service
  params with the actual constructor params (invariant_service,
  decision_service) as defined in src/cleveragents/actor/reconciliation.py

ISSUES CLOSED: #4848
2026-06-16 18:28:16 -04:00
HAL9000 b4ec544e40 feat(resources): implement cloud infrastructure resource type stubs (AWS, GCP, Azure) and resolve merge conflicts 2026-06-15 14:11:47 -04:00
HAL9000 0bd6f98cef chore(contributors): add PR #11090 entry for plan explain alternatives format fix
CI / load-versions (pull_request) Successful in 15s
CI / push-validation (pull_request) Successful in 25s
CI / lint (pull_request) Successful in 1m13s
CI / typecheck (pull_request) Successful in 1m20s
CI / security (pull_request) Successful in 1m18s
CI / quality (pull_request) Successful in 1m15s
CI / build (pull_request) Successful in 47s
CI / helm (pull_request) Successful in 48s
CI / unit_tests (pull_request) Successful in 6m44s
CI / docker (pull_request) Successful in 1m30s
CI / integration_tests (pull_request) Failing after 16m23s
CI / coverage (pull_request) Successful in 14m33s
CI / status-check (pull_request) Failing after 3s
ISSUES CLOSED: #11090
2026-06-15 11:16:04 -04:00
HAL9000 3cb3815944 feat(tui): implement TuiMaterializer bridging A2A event queue to conversation view with ThoughtBlockWidget
Implemented the TuiMaterializer class that bridges the Output Rendering
Framework to Textual UI widgets, enabling all CLI command producers to
render in the TUI without modification. Split the module into three files
to stay under the 500-line file limit: main materializer.py (TuiMaterializer
class), _tui_events.py (event type constants and event model), and
_tui_renderers.py (all rendering helper functions).

The TuiMaterializer implements the MaterializationStrategy protocol and
maps ElementHandle events (Panel, Table, Status, Progress, Tree, Code,
Diff, Separator, ActionHint, Text) to plain-text renderings for TUI display.
Supports real-time streaming updates and A2A event routing for
PermissionRequest and ThoughtBlock events. Thread-safe with lock guards on
all shared state mutations.

Added comprehensive Behave BDD test suite covering all element types,
callback invocation, rendered output accumulation, A2A routing logic, and
concurrent thread safety verification.

ISSUES CLOSED: #5326
2026-06-15 11:14:31 +00:00
HAL9000 d0531a92e2 refactor(a2a): add BDD tests for ACP → A2A module rename validation (#10995)
Add comprehensive BDD test coverage validating the ACP to A2A module rename:

- features/a2a_module_rename_standardization.feature — 3 scenarios:
  1. All 22 __all__ symbols exported and importable from cleveragents.a2a
  2. Zero legacy ACP references found in a2a module source files
  3. Documentation strings use A2A naming per ADR-047

- features/steps/a2a_module_rename_standardization_steps.py — step definitions
  with recursive ACP reference scanning and symbol completeness checks

- Updated CHANGELOG.md under ### Added section
- Updated CONTRIBUTORS.md with contribution entry

ISSUES CLOSED: #8615
2026-06-15 02:59:42 -04:00
HAL9000 e6094d1fb7 fix(deps): address reviewer feedback on PyYAML security hardening
- Fix step definitions: remove unused imports (sys, Any, Dict), move
  all imports to module level, drop noqa suppressor, fix docstring step
  to use context.text, use packaging.version for correct semver check
- Upgrade version floor from 6.0.2 to 6.0.3 in step text and feature
  file to match pyproject.toml constraint and issue requirement
- Fix CONTRIBUTORS.md: correct PR number (#11012 -> #11017), issue
  reference (#13605 -> #11012), and version string (6.0.2 -> 6.0.3)

ISSUES CLOSED: #11012
2026-06-15 02:24:03 -04:00
HAL9000 7af8e59eb6 chore(deps): upgrade PyYAML to address known security vulnerability
Add pyyaml>=6.0.2 as explicit runtime dependency in pyproject.toml to
mitigate CVE-2025-8045 (arbitrary code execution via crafted YAML
payloads). PyYAML was previously only transitive, used at runtime by
src/cleveragents/actor/yaml_loader.py for actor configuration YAML loading.

This change:

- Declares pyyaml>=6.0.2 as a direct runtime dependency with security comment
- Updates uv.lock to resolve the new explicit dependency constraint (requires-dist)
- Adds CHANGELOG.md entry under [Unreleased] -> Security section
- Updates CONTRIBUTORS.md with HAL 9000 contribution details
- Adds BDD/Behave test (features/pyyaml_runtime_dependency.feature) verifying
  PyYAML availability and version compliance at runtime
- Adds corresponding step definitions for BDD scenarios

ISSUES CLOSED: #13605
2026-06-15 02:24:03 -04:00
HAL9000 f38491e5a6 docs: add showcase example for CLI version/info/diagnostics basics
Add a verified CLI showcase for the version, info, and diagnostics commands,
register in examples.json and update CHANGELOG/CONTRIBUTORS.

ISSUES CLOSED: #7592
2026-06-14 23:57:38 -04:00
HAL9000 854dd2aada fix(providers): add ProviderType.GEMINI to FALLBACK_ORDER
The provider registry's FALLBACK_ORDER was missing ProviderType.GEMINI,
which meant Gemini-only configured installations could not select the
Gemini provider as default via the fallback chain.

This fix adds GEMINI right after GOOGLE in the priority order, consistent
with how it appears in DEFAULT_CAPABILITIES, DEFAULT_MODELS, and
PROVIDER_KEY_ATTRS - all of which already support Gemini.

Includes BDD regression coverage in features/fallback_gemini_provider.feature.

ISSUES CLOSED: #10906

Signed-off-by: HAL 9000 <hal9000@cleverthis.com>
2026-06-14 23:37:20 -04:00
HAL9000 b4a7f26d7c bug(cli): plan apply --format json returns raw plan dict instead of spec-required JSON envelope
The `agents plan apply --format json` command was returning a raw
plan dictionary instead of the spec-required JSON envelope. This fix
introduces a dedicated `_apply_output_dict()` helper that wraps the
non-rich format output in the proper envelope structure with
`command`, `status`, `exit_code`, `data`, `timing`, and `messages`
fields.

The `data` field contains structured information about artifacts,
changes, project, applied_at, validation (test/lint/type_check),
sandbox_cleanup, and lifecycle metrics. Other commands (plan status,
plan cancel, plan use) remain unaffected — they continue using
`_plan_spec_dict`.

Tests: 16 Behave scenarios + 15 Robot Framework integration tests
added covering envelope structure, field presence, sandbox cleanup
state derivation from actual plan state, legacy fallback, cost
metadata, and command isolation.

ISSUES CLOSED: #9449
2026-06-14 21:07:19 -04:00
HAL9000 1d5cff117c docs(contributors): add Semgrep guard contribution entry for PR #9185
Document HAL 9000's contribution of the broad exception suppression
Semgrep guard (PR #9185, issue #9103) in CONTRIBUTORS.md per the
PR compliance checklist requirement.
2026-06-14 19:05:21 -04:00
freemo 946ebdec66 fix(cli/session): add --format flag and JSON envelope output to session tell
Add BDD/Behave test scenarios for the existing --format/-f flag on `agents session tell`,
  and update CHANGELOG.md and CONTRIBUTORS.md.

  The implementation of --format on session tell exists in the codebase (commit 87a7ce35d),
  but lacks dedicated BDD test coverage. This PR adds:

  - 6 new Behave scenarios in features/session_cli.feature testing JSON, YAML, plain, table,
    short flag (-f), and Rich output regression paths
  - 6 corresponding step definitions in features/steps/session_cli_steps.py verifying
    spec-compliant JSON envelopes, valid YAML/JSON output, ASCII table output, and Rich console
    content preservation
  - CHANGELOG.md entry under [Unreleased] documenting the --format flag feature
  - CONTRIBUTORS.md entry crediting Jeffrey Phillips Freeman

  Quality gates: lint ✓, typecheck ✓ (only pre-existing warnings about optional provider imports)

  ISSUES CLOSED: #10466
2026-06-14 13:23:57 -04:00
HAL9000 022b354359 fix(data-integrity): remove session.rollback() calls from ProjectRepository
Removed unconditional session.rollback() calls within exception handlers in:

- ProjectRepository.create()
- NamespacedProjectRepository.create() (IntegrityError handler)
- NamespacedProjectRepository.create() (OperationalError handler)
- NamespacedProjectRepository.update()
- NamespacedProjectRepository.delete()

The Unit of Work pattern already handles transaction rollback at the outer layer
via its except Exception: session.rollback() handler, making these inner rollbacks
redundant. SQLAlchemy automatically invalidates the transaction state when exceptions
occur after flush(), preventing partial data from being committed.

Removing the redundant rollbacks improves clarity, eliminates potential issues related
to exception chaining across retry boundary layers, and aligns repository implementations
with explicit transaction boundaries.

ISSUES CLOSED: #8179
2026-06-14 11:36:15 -04:00
freemo 4e53cd3969 fix(a2a): correct issue references and fix documentation compliance
Issue references corrected from #264 to #691 throughout all documentation.
The A2A stdio transport feature is tracked by issue #691, not #264 (which was
about resource registry tables in v3.0.0).

CHANGELOG.md: Updated issue reference and added .py path routing fix entry under

BDD tests: Added command construction assertions for all three connect scenarios
(module, .py script, executable) to verify subprocess.Popen receives correct args:
- Module paths (cleveragents.X): [python, -m, module]
- .py file paths: [python, file.py]
- Executable paths: [executable_path]
2026-06-14 11:14:35 -04:00
HAL9000 3ae8161c37 fix(a2a): correct .py path handling and fix documentation compliance
The connect() method in A2aStdioTransport incorrectly routed literal .py
script paths (e.g. "agent.py") through `python -m` which expects Python
module names. Fixed to use `python agent_path` for direct script execution
while keeping module paths (cleveragents.*) via `-m` and executables unchanged.

Also resolved merge conflict markers in CONTRIBUTORS.md and added changelog
entry for the A2A stdio transport feature under [Unreleased]. Added BDD
test coverage entry.

ISSUES CLOSED: #264
2026-06-14 11:14:35 -04:00
HAL9000 7a52a5e87b fix(security): fix file_tools.py validate_path startswith bypass #7478
Replaced insecure str.startswith(root + "/") path containment checks in
tool/path_mapper.py (_is_under) and application/services/llm_actors.py
(_write_to_sandbox) with semantic os.path.relpath comparisons to prevent
sibling-directory prefix-collision path traversal attacks.

The string-prefix approach was vulnerable: a sandbox root of /tmp/sandbox
would incorrectly allow access to /tmp/sandboxmalicious/file.txt because
"/tmp/sandboxmalicious/file" starts with "/tmp/sandbox".

Security specification mandates all path containment checks use
Path.is_relative_to() or equivalent semantic comparison.

Added BDD test coverage in features/path_containment_security.feature
with @tdd_issue_7478 tags for the prefix-collision attack scenarios.

ISSUES CLOSED: #7478
2026-06-14 09:49:42 -04:00
HAL9000 3233e8733c docs(changelog): correct issue references for ContextStrategy feature
CI / lint (pull_request) Successful in 33s
CI / quality (pull_request) Successful in 48s
CI / push-validation (pull_request) Successful in 25s
CI / typecheck (pull_request) Successful in 1m14s
CI / security (pull_request) Successful in 1m14s
CI / build (pull_request) Successful in 58s
CI / helm (pull_request) Successful in 58s
CI / unit_tests (pull_request) Successful in 4m56s
CI / docker (pull_request) Successful in 1m32s
CI / integration_tests (pull_request) Successful in 10m3s
CI / coverage (pull_request) Successful in 12m26s
CI / status-check (pull_request) Successful in 3s
CI / lint (push) Successful in 42s
CI / quality (push) Successful in 47s
CI / build (push) Successful in 49s
CI / helm (push) Successful in 50s
CI / typecheck (push) Successful in 58s
CI / security (push) Successful in 1m8s
CI / unit_tests (push) Successful in 5m47s
CI / docker (push) Successful in 1m38s
CI / push-validation (push) Failing after 14m45s
CI / integration_tests (push) Failing after 15m18s
CI / coverage (push) Successful in 12m45s
CI / status-check (push) Failing after 2s
CI / benchmark-publish (push) Has been cancelled
CI / benchmark-regression (push) Has been cancelled
CHANGELOG.md and CONTRIBUTORS.md both referenced #10590, which is an
open PR not an issue. The correct issue is #8616. Also removed the
duplicate ### Added heading in CHANGELOG.md that preceded the entry.
CONTRIBUTORS.md now references PR #11106 / issue #8616.

ISSUES CLOSED: #8616
2026-06-14 08:33:44 -04:00
HAL9000 1ace8d53fd feat(context): implement ContextStrategy protocol and plugin registration system
Implement the ContextStrategy Protocol for pluggable context assembly strategies
in the ACMS pipeline. Includes six built-in strategies, a StrategyRegistry service
with plugin discovery support, thread-safe operations, and comprehensive BDD tests.

ISSUES CLOSED: #10590
2026-06-14 08:33:44 -04:00
HAL9000 9da9c1b1c6 fix(acms): wire ContextAssemblyPipeline as default in ACMSExecutePhaseContextAssembler
ACMSExecutePhaseContextAssembler previously instantiated the plain
ACMSPipeline when no pipeline was explicitly provided, missing production
Phase 1 optimizations including confidence-weighted strategy selection,
proportional budget allocation with min-budget enforcement, parallel
strategy execution with circuit breaking, and per-stage timing instrumentation.

The default is now ContextAssemblyPipeline which provides all of these
capabilities while remaining a drop-in replacement for ACMSPipeline.

ISSUES CLOSED: #10027
2026-06-14 08:18:13 -04:00
HAL9000 fd3c075c10 fix(context): finalize PR #10590 compliance checklist items
Implement all missing compliance requirements for PR #10590 (ContextStrategy
protocol and StrategyRegistry plugin registration system) as required by the
implementation-pool-supervisor mandatory PR compliance checklist:

[ ] 1. CHANGELOG.md — add entry under [Unreleased] section: DONE
[✓] Added changelog entry documenting ContextStrategy protocol, StrategyRegistry,
    six built-in strategies, and BDD test coverage (#8616, Epic #8505)

[ ] 2. CONTRIBUTORS.md — add or update contribution entry: DONE
[✓] Added HAL 9000 contribution note for the full ContextStrategy feature impl

[ ] 3. Commit footer — include ISSUES CLOSED reference: DONE
[✓] Footer includes ISSUES CLOSED: #8616

[ ] 4. CI passes — all quality gates and tests green before requesting review: PARTIAL
[✓] Added timeout-minutes (30/45min) to unit_tests and integration_tests jobs
    to prevent OOM timeouts that were blocking CI

[ ] 5. BDD/Behave tests — added or updated for the changed behaviour: DONE (pre-existing)
[✓] Comprehensive test suite in features/context_strategy_registry.feature
    (589 lines, 60+ scenarios covering protocol, registry, backends, thread safety)

[✓] 6. Epic reference — PR description references parent Epic issue number: PRE-EXISTING
[✓] PR body and commit message both reference Epic #8505

[ ] 7. Labels — applied via forgejo-label-manager: DONE (pre-existing)
[✓] State/In Review, Priority/High, MoSCoW/Must have, Type/Feature

[ ] 8. Milestone — PR assigned to earliest open matching milestone: PRE-EXISTING
[✓] v3.6.0 (M7): Advanced Concepts & Deferred Features

Additionally addresses the protocol API mismatch blocking review findings:
- Import and document DomainContextStrategy alongside pipeline-compatible Protocol
- Add backward-compat re-exports for existing code importing from acms_service

ISSUES CLOSED: #8616
2026-06-14 07:35:01 -04:00
freemo 4ba0348338 feat(decisions): implement ExecutePhaseDecisionHook with Behave tests
Epic #8477: added ExecutePhaseDecisionHook as the Execute-phase mirror of
StrategizeDecisionHook. Provides six recording methods for implementation
choices, tool invocations, error recovery, validation responses, subplan
spawn, and resource selection during execution contexts. Captures full
context snapshots with SHA-256 hashes and persists decisions atomically
via DecisionService. Includes comprehensive Behave test coverage.

ISSUES CLOSED: #8477
2026-06-13 18:50:14 -04:00
HAL9000 bdc2ccd6a3 feat(invariants): implement Invariant data model and database schema
This PR implements the Invariant data model and database schema for the
v3.2.0 milestone. The Invariant feature enables the system to define, store,
and manage invariant rules that can be evaluated against system state.

- Alembic migration m3_001_invariants_table creates the invariants table
  with columns: id (UUID), description (text), created_at (timestamp),
  is_active (bool, default True), with index on is_active for efficiency
- SQLAlchemy ORM InvariantModel in
  cleveragents.infrastructure.database.models.InvariantModel
- M3 merge migration to resolve Alembic head conflict
- BDD Behave scenarios (10 test cases) in features/invariant_model.feature
- Robot Framework integration tests in robot/invariant_model.robot
- Updated CHANGELOG.md and CONTRIBUTORS.md
- Restored status-check CI aggregation job

ISSUES CLOSED: #8524
2026-06-13 17:42:05 -04:00
HAL9000 c8232c17f4 fix(lsp): cleanup subprocess on failed initialization in StdioTransport.start()
When subprocess.Popen() fails during LSP server initialization (e.g.
FileNotFoundError for missing command or general OSError), partially-allocated
pipe resources and internal file descriptors could be left in an inconsistent
state. This was caused by _process potentially containing a stale reference if
an exception occurred between pipe allocation and the Popen object being fully
returned.

Fix: Add explicit self._process = None resets in three places:
1) Before subprocess.Popen() — ensures clean initial state even across retries
2) In FileNotFoundError handler — guards against intermediate error states
3) In OSError handler — general safety net for all subprocess failures

This prevents:
- Orphaned child processes never terminated (zombie processes)
- File descriptor leaks from partially-allocated pipes
- Transports stuck in ambiguous 'started but not live' state

Tests added: Two new Behave scenarios verify _process is None after both
FileNotFoundError and OSError during start().

ISSUES CLOSED: #10597
2026-06-13 16:10:40 -04:00
HAL9000 8f6dc11cc6 fix(cleanup): invalidate sandbox_dirs_cache after purge (#7527)
Implemented cache invalidation for CleanupService to fix stale sandbox paths
being reported after purge() completes. The _sandbox_dirs_cache is now
invalidated after _purge_sandboxes() so subsequent scan() calls re-read the
filesystem instead of returning already-deleted paths.

Changes:
- Added self._sandbox_dirs_cache = None at end of _purge_sandboxes()
- Updated docstring to document cache invalidation behavior
- Created comprehensive BDD test coverage with 5 scenarios under new
  features/cleanup_service_cache_invalidation.feature and step definitions
- Updated CHANGELOG.md with bug fix entry
- Updated CONTRIBUTORS.md with PR #8257

ISSUES CLOSED: #7527
2026-06-13 09:29:11 -04:00
HAL9000 89d8b9e751 fix(lsp): prevent header injection in LSP transport ASCII decoding
Security: Added strict ASCII validation to _read_one_message() header parsing
to enforce LSP specification requirements. Non-ASCII bytes in headers now raise
LspError. Printable-ASCII guard rejects characters outside 0x20–0x7E range.

- Removed redundant inline LspError imports from start() exception handlers
  (top-level import added instead)
- Updated _read_one_message() docstring with ASCII enforcement documentation
- Created BDD test suite for LSP header injection security scenarios
- Fixed Gherkin feature file tag placement and whitespace
- Fixed select.select() 3-tuple return in patched mock to match API contract
- Cleaned up CHANGELOG.md bullet formatting and CONTRIBUTORS.md entries

Closes #7112

Signed-off-by: HAL9000 <hal9000@cleverthis.com>
2026-06-13 04:39:01 -04:00
HAL9000 54b08e00f2 fix(lsp): address code-review blockers in LSP header injection fix (#10608)
- Move Gherkin scenario tags from inline to separate lines before Scenario keywords in feature spec
- Remove HAL 9000 prose contribution entry from name list in CONTRIBUTORS.md per project conventions
- Add commit footer: ISSUES CLOSED: #7112

ISSUES CLOSED: #7112
2026-06-13 04:36:34 -04:00
HAL9000 1a6f10d5fb fix(lsp): prevent header injection in LSP transport ASCII decoding
Closes #7112

ISSUES CLOSED: #7112
EPIC REFERENCES: #824
2026-06-13 04:33:37 -04:00
HAL9000 9801d34cad fix(cleanup): invalidate sandbox_dirs_cache after purge (#7527)
Adds SandboxDirsCache to track filesystem paths of sandbox-created directories indexed by plan_id. Cache is purged in cleanup_all(), cleanup_abandoned(), clear_sandbox_dirs_cache(), and the at-exit handler matching the existing clear_boundary_cache() invalidation.
2026-06-12 12:08:13 -04:00
HAL9000 ad88422efe docs(spec): clarify layer boundary DI exception, ULID scope, TUI/ACMS gap-fill [AUTO-ARCH-1]
Add targeted clarifications to docs/specification.md to fill identified gaps:

1. Layer boundary DI Container Exception (Cross-Milestone Architectural Invariants)
2. ULID Scope Clarification - domain vs internal identifiers
3. ACMS Pipeline Protocol Contracts with storage tiers and budget protocol
4. TUI Component Interfaces with verifiable checks

Co-authored-by: CleverAgents Bot <bot@cleveragents.com>

ISSUES CLOSED: #10451
2026-06-12 12:08:13 -04:00
freemo 33cf919e7b Fix race condition in McpClient.start() double initialization
Add _state == McpClientState.STARTING guard inside the threading.RLock in
start() and _ensure_started() so that concurrent callers see the in-progress
state and return immediately, preventing double initialisation of the MCP
server connection.

- Move _CountingTransport test double from inline step file to dedicated
  features/mocks/counting_mcp_transport.py per CONTRIBUTING.md mock placement rules
- Updated step definitions to import CountingMCPTransport from new location
- Added Race condition entry to CHANGELOG under [Unreleased] -> Fixed
- Added contributor credit for McpClient race condition fix

ISSUES CLOSED: #10438
2026-06-10 11:14:45 -04:00
HAL9000 c1a29a331b docs: add showcase example for resource and skill management
CI / lint (pull_request) Successful in 1m9s
CI / push-validation (pull_request) Successful in 54s
CI / quality (pull_request) Successful in 1m20s
CI / typecheck (pull_request) Successful in 1m37s
CI / security (pull_request) Successful in 1m37s
CI / build (pull_request) Successful in 1m19s
CI / helm (pull_request) Successful in 1m31s
CI / unit_tests (pull_request) Successful in 6m45s
CI / docker (pull_request) Successful in 2m54s
CI / integration_tests (pull_request) Successful in 10m45s
CI / coverage (pull_request) Successful in 22m39s
CI / status-check (pull_request) Successful in 5s
Align the resource and skill management showcase with review feedback: consistent resource type counts (101), explicit save-to-disk instructions before each skill registration command, metadata callouts for non-obvious behaviors (Config: unknown, capability summary zeros, local/linear-tracker 0-tool count), and README framing to acknowledge platform feature walkthroughs.

Remove obsolete tdd_issue tags from coverage threshold Robot tests now that the noxfile enforces COVERAGE_THRESHOLD = 97.

Harden the Skip If No LLM Keys E2E helper with per-key regex validation and log-level suppression to prevent credential leakage in CI logs. Restore the Resolve LLM Actor keyword that was inadvertently removed from common_e2e.resource.

Update CHANGELOG.md and CONTRIBUTORS.md per project requirements.

ISSUES CLOSED: #4470
2026-06-06 22:55:02 -04:00
HAL9000 ebb543a9c3 fix(plans): resolve CI failures in parallel subplan scheduler BDD tests
- Remove duplicate @then decorator on step_verify_peak_concurrency_limit
  (caused AmbiguousStep error crashing all 8 unit test feature files)
- Rename "the subplans should have been executed in order" to
  "the subplans should have been executed in sequential order" to
  avoid conflict with pre-existing step in subplan_execution_steps.py
- Remove 13 additional @then step definitions that duplicated steps in
  subplan_execution_steps.py; alias context.exec_result and
  context.validation_error in @when steps so pre-existing steps work
- Replace two # type: ignore comments (lines 438, 453) with typed
  Any variables per zero-tolerance policy
- Apply ruff format to fix formatting (long import wrapping, list comps)
- Add CHANGELOG entry and CONTRIBUTORS entry for #9555

ISSUES CLOSED: #9609
2026-06-06 20:26:27 -04:00
HAL9000 f2b23e397f fix(tui): fix format check and undefined step in execution_environment feature
Applied ruff format fix to tui_permissions_screen_steps.py and corrected the step text mismatch in execution_environment.feature where 'it should not contain' was not updated to 'the container types should not contain' when the step definition was renamed.

ISSUES CLOSED: #10488
2026-06-06 12:11:44 -04:00
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 4cc4863d2e fix(governance): correct budget_type docs, remove unused lock and lint fixes
- Remove unused threading.Lock from CostTrackingService.__init__
- Extract WARNING_THRESHOLD = 0.9 in cost_tracking.py warning if-blocks
- Fix E501 line length violations by breaking long f-string lines
- Combine nested if statements (SIM102) for budget checks
- Update BudgetExceededError docstrings to reference 'session'/'org'
- Add CHANGELOG.md entry under [Unreleased]
- Update CONTRIBUTORS.md with cost budget tracking contribution

ISSUES CLOSED: #8609
2026-06-04 02:28:50 -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 27dadc8f88 docs: fix merge conflicts, add CHANGELOG [Unreleased] entries from master, update CONTRIBUTORS (#9796) [AUTO-DOCS-2]
CI / push-validation (pull_request) Successful in 29s
CI / helm (pull_request) Successful in 37s
CI / build (pull_request) Successful in 44s
CI / lint (pull_request) Successful in 1m3s
CI / quality (pull_request) Successful in 54s
CI / typecheck (pull_request) Successful in 1m12s
CI / security (pull_request) Successful in 1m24s
CI / unit_tests (pull_request) Successful in 5m17s
CI / docker (pull_request) Successful in 1m51s
CI / integration_tests (pull_request) Successful in 8m5s
CI / coverage (pull_request) Failing after 22m2s
CI / status-check (pull_request) Has been cancelled
Merge latest master [Unreleased] changes into PR branch CHANGELOG.
Added HAL 9000 documentation contribution to CONTRIBUTORS.md.

ISSUES CLOSED: #9796
2026-06-03 15:58:44 -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