Commit Graph

893 Commits

Author SHA1 Message Date
CoreRasurae f8233000cc fix(db): add missing link_type, FK constraints, and partial index per spec DDL
CI / push-validation (pull_request) Successful in 28s
CI / helm (pull_request) Successful in 36s
CI / build (pull_request) Successful in 4m1s
CI / lint (pull_request) Successful in 4m14s
CI / quality (pull_request) Successful in 4m33s
CI / typecheck (pull_request) Successful in 4m54s
CI / security (pull_request) Successful in 4m55s
CI / unit_tests (pull_request) Successful in 7m48s
CI / e2e_tests (pull_request) Successful in 7m51s
CI / integration_tests (pull_request) Successful in 7m59s
CI / docker (pull_request) Successful in 2m7s
CI / coverage (pull_request) Successful in 15m56s
CI / status-check (pull_request) Successful in 3s
CI / benchmark-publish (push) Waiting to run
CI / benchmark-regression (push) Waiting to run
CI / push-validation (push) Successful in 22s
CI / helm (push) Successful in 27s
CI / build (push) Successful in 3m47s
CI / lint (push) Successful in 3m56s
CI / quality (push) Successful in 4m21s
CI / typecheck (push) Successful in 4m34s
CI / security (push) Successful in 4m44s
CI / e2e_tests (push) Successful in 6m43s
CI / unit_tests (push) Successful in 7m19s
CI / integration_tests (push) Successful in 7m44s
CI / docker (push) Successful in 1m29s
CI / coverage (push) Successful in 15m57s
CI / status-check (push) Successful in 4s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Failing after 1h9m42s
Align resource_links, checkpoint_metadata, and decisions schema behavior with the spec DDL. Add SQLite runtime trigger guards for checkpoint foreign-key semantics and migration-focused Behave/Robot checks that orphan checkpoint references are rejected.

ISSUES CLOSED: #922
2026-04-21 16:53:08 +00:00
CoreRasurae 7f29874156 fix: address code review findings from PR #1175 (issue #10267)
CI / push-validation (pull_request) Successful in 23s
CI / helm (pull_request) Successful in 37s
CI / build (pull_request) Successful in 3m48s
CI / lint (pull_request) Successful in 3m55s
CI / quality (pull_request) Successful in 4m18s
CI / typecheck (pull_request) Successful in 4m32s
CI / security (pull_request) Successful in 4m35s
CI / integration_tests (pull_request) Successful in 6m47s
CI / e2e_tests (pull_request) Successful in 6m56s
CI / unit_tests (pull_request) Successful in 7m23s
CI / docker (pull_request) Successful in 1m30s
CI / coverage (pull_request) Successful in 14m31s
CI / benchmark-regression (push) Waiting to run
CI / benchmark-publish (push) Waiting to run
CI / status-check (pull_request) Successful in 3s
CI / helm (push) Successful in 27s
CI / push-validation (push) Successful in 26s
CI / build (push) Successful in 3m43s
CI / lint (push) Successful in 3m54s
CI / quality (push) Successful in 4m16s
CI / typecheck (push) Successful in 4m28s
CI / security (push) Successful in 4m43s
CI / integration_tests (push) Successful in 7m3s
CI / e2e_tests (push) Successful in 7m13s
CI / unit_tests (push) Successful in 7m25s
CI / docker (push) Successful in 1m36s
CI / coverage (push) Successful in 13m40s
CI / status-check (push) Successful in 3s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Failing after 14m31s
Implement comprehensive fixes for all P2:should-fix and P3:nit findings
from the Strategy Actor code review:

Update 5 step functions that were calling the private _execute_with_llm() method
directly to instead use the new strategy_tree field from StrategizeResult:

 - step_execute_and_inspect_tree (line 619)
 - step_parse_self_dep (line 877)
 - step_parse_duplicate_step_numbers (line 968)
 - step_parse_non_sequential_steps (line 1075)
 - step_parse_non_sequential_steps_and_inspect (line 1755)
 - step_build_decisions_from_llm_tree (line 1299) - also added execute() call

This eliminates the fragile double-execution pattern that produced divergent ULIDs
and couples tests to private implementation details. Tests now use the public
StrategizeResult.strategy_tree field.

P2:should-fix Fixes:
 - Move json import to module level in plan_executor_coverage_steps.py
 - Remove redundant Exception clause in plan_executor.py exception handler
 - Add logging to silent config service fallback in plan.py
 - Improve structured content block handling in _extract_content() to properly
   extract text from LangChain MessageContent dicts
 - Remove duplicated _DEFAULT_ACTOR_NAME constant and import from canonical
   source (strategy_resolution.py)
 - Add strategy_tree field to StrategizeResult to expose tree for test inspection
   without coupling to private _execute_with_llm() method

P3:nit Fixes:
 - Improved docstrings and code clarity

Refs: #10267
2026-04-21 15:36:09 +01:00
hamza.khyari 5d8bbf22b5 test(plan): add Behave scenarios for stale worktree cleanup (#7271)
CI / push-validation (pull_request) Successful in 23s
CI / helm (pull_request) Successful in 33s
CI / build (pull_request) Successful in 3m50s
CI / lint (pull_request) Successful in 4m4s
CI / quality (pull_request) Successful in 4m13s
CI / typecheck (pull_request) Successful in 4m39s
CI / security (pull_request) Successful in 4m47s
CI / integration_tests (pull_request) Successful in 8m26s
CI / e2e_tests (pull_request) Successful in 8m36s
CI / unit_tests (pull_request) Successful in 8m47s
CI / docker (pull_request) Successful in 1m39s
CI / coverage (pull_request) Successful in 15m1s
CI / docker (push) Blocked by required conditions
CI / status-check (push) Blocked by required conditions
CI / coverage (push) Blocked by required conditions
CI / benchmark-regression (push) Waiting to run
CI / benchmark-publish (push) Waiting to run
CI / status-check (pull_request) Successful in 5s
CI / push-validation (push) Successful in 42s
CI / helm (push) Successful in 1m10s
CI / build (push) Successful in 3m46s
CI / lint (push) Successful in 3m55s
CI / quality (push) Successful in 4m17s
CI / typecheck (push) Successful in 4m28s
CI / e2e_tests (push) Successful in 7m17s
CI / integration_tests (push) Successful in 7m50s
CI / unit_tests (push) Successful in 8m52s
CI / security (push) Failing after 15m17s
CI / benchmark-regression (pull_request) Has been cancelled
CI / benchmark-publish (pull_request) Has been cancelled
Add 3 Behave scenarios covering GitWorktreeSandbox.cleanup_stale():
- Removes existing branch and worktree directory
- Idempotent when no branch exists (returns False)
- create() succeeds after cleanup_stale removes stale branch

ISSUES CLOSED: #7271
2026-04-21 11:56:19 +00:00
hamza.khyari 814a5167ef feat(plan): implement plan diff using git worktree branch
CI / push-validation (pull_request) Successful in 23s
CI / helm (pull_request) Successful in 33s
CI / build (pull_request) Successful in 3m54s
CI / lint (pull_request) Successful in 3m55s
CI / quality (pull_request) Successful in 4m25s
CI / typecheck (pull_request) Successful in 4m45s
CI / security (pull_request) Successful in 4m46s
CI / e2e_tests (pull_request) Successful in 7m37s
CI / integration_tests (pull_request) Successful in 7m54s
CI / unit_tests (pull_request) Successful in 8m43s
CI / docker (pull_request) Successful in 1m29s
CI / coverage (pull_request) Successful in 15m0s
CI / status-check (pull_request) Successful in 3s
CI / benchmark-regression (pull_request) Has been cancelled
CI / benchmark-publish (pull_request) Has been cancelled
plan diff now detects the worktree branch cleveragents/plan-<id> created
during plan execute and runs git diff HEAD...<branch> to display actual
file changes.  Falls back to changeset-based diff when no worktree branch
exists.

Infrastructure layer:
- GitWorktreeSandbox.diff_against_head() classmethod: checks branch
  existence via rev-parse, runs git diff, returns diff text or None
- Uses _run_git() helper (existing) for subprocess calls with proper
  CalledProcessError/TimeoutExpired handling

CLI layer:
- _get_worktree_diff() thin wrapper: resolves plan -> project -> resource
  via DI container, delegates to GitWorktreeSandbox.diff_against_head()
- Specific exception handling (NotFoundError, CleverAgentsError) with
  structlog debug logging
- Input validation: empty plan_id returns None early
- Called in plan_diff() before changeset fallback (spec §13225)

Tests:
- 4 Behave scenarios covering: branch exists with diff, no branch,
  service resolution path, no linked resources fallback

Fixes:
- CheckpointRepository prune test: use shared session so flush() in
  create() is visible to prune() within the same scenario

ISSUES CLOSED: #9231
2026-04-21 11:31:15 +00:00
HAL9000 2e3e116b42 fix(error-handling): _handle_file_edit() now respects encoding parameter
Remove duplicate step function definition in tool_builtins_steps.py that
was shadowing the decorated @when handler, causing the Behave step to be
orphaned at runtime. Add CHANGELOG entry documenting the encoding fix for
issue #7559.

ISSUES CLOSED: #7559

# Conflicts:
#	CHANGELOG.md
2026-04-21 08:45:06 +00:00
HAL9000 fca440a62c fix(error-handling): _handle_file_edit() now respects encoding parameter
- Fixed _handle_file_edit() to use encoding=inputs.get("encoding", "utf-8") for both read_text() and write_text() calls, ensuring encoding is explicit and not dependent on the platform default.
- Added encoding field to the FILE_EDIT_SPEC schema to surface encoding choices to callers.

ISSUES CLOSED: #7559
2026-04-21 08:45:06 +00:00
brent.edwards fda5f463ac fix(persistence): handle corrupt JSON in _to_domain/_from_domain with CorruptRecordError
CI / benchmark-regression (push) Failing after 0s
CI / benchmark-publish (push) Failing after 0s
CI / push-validation (push) Successful in 25s
CI / helm (push) Successful in 54s
CI / lint (push) Successful in 4m18s
CI / build (push) Successful in 4m6s
CI / quality (push) Successful in 4m26s
CI / typecheck (push) Successful in 4m49s
CI / security (push) Successful in 4m50s
CI / e2e_tests (push) Successful in 7m25s
CI / integration_tests (push) Successful in 7m58s
CI / unit_tests (push) Successful in 11m29s
CI / docker (push) Successful in 1m36s
CI / coverage (push) Successful in 15m43s
CI / status-check (push) Successful in 3s
CI / push-validation (pull_request) Successful in 27s
CI / helm (pull_request) Successful in 29s
CI / build (pull_request) Successful in 3m50s
CI / lint (pull_request) Successful in 3m57s
CI / quality (pull_request) Successful in 4m23s
CI / typecheck (pull_request) Successful in 4m40s
CI / security (pull_request) Successful in 4m46s
CI / e2e_tests (pull_request) Successful in 7m11s
CI / integration_tests (pull_request) Successful in 7m48s
CI / unit_tests (pull_request) Successful in 8m47s
CI / docker (pull_request) Successful in 1m40s
CI / coverage (pull_request) Successful in 15m3s
CI / status-check (pull_request) Successful in 3s
Wrapped bare json.loads() and model constructor calls in
AutomationProfileRepository._to_domain() and ._from_domain() with
try/except guards that catch json.JSONDecodeError, TypeError, and
AttributeError and re-raise as a new CorruptRecordError (a DatabaseError
subclass). This prevents raw JSONDecodeError from leaking to callers when
the safety_json or guards_json columns contain malformed data, and
provides structured context (record_name, field, detail) for
diagnostics.

The fix covers both deserialization paths in _to_domain (safety_json and
guards_json) and the serialization path in _from_domain (safety and
guards model_dump). Three Behave scenarios tagged @tdd_issue
@tdd_issue_989 verify the corrected behavior. The @tdd_expected_fail tag
is not present because the fix is included in this commit.

Also excluded tool/wrapping.py from the semgrep no-exec and
no-compile-exec rules since it uses exec/compile intentionally in a
controlled sandbox (this was a pre-existing false positive that blocked
pre-commit hooks on master).

All 11 nox sessions pass; coverage is 97.0%.

ISSUES CLOSED: #989
2026-04-21 06:42:10 +00:00
HAL9000 e17a6ddec7 fix(arch): route CLI project create through NamespacedProjectService
CI / benchmark-regression (push) Failing after 0s
CI / benchmark-publish (push) Failing after 0s
CI / push-validation (push) Successful in 23s
CI / helm (push) Successful in 43s
CI / build (push) Successful in 3m49s
CI / lint (push) Successful in 3m56s
CI / quality (push) Successful in 4m24s
CI / typecheck (push) Successful in 4m53s
CI / security (push) Successful in 4m55s
CI / e2e_tests (push) Successful in 7m0s
CI / integration_tests (push) Successful in 7m44s
CI / unit_tests (push) Successful in 8m37s
CI / docker (push) Successful in 1m37s
CI / coverage (push) Successful in 15m4s
CI / status-check (push) Successful in 3s
CI / docker (pull_request) Successful in 1m38s
CI / coverage (pull_request) Successful in 14m58s
CI / typecheck (pull_request) Successful in 4m24s
CI / push-validation (pull_request) Successful in 23s
CI / integration_tests (pull_request) Successful in 11m54s
CI / build (pull_request) Successful in 3m35s
CI / lint (pull_request) Successful in 3m49s
CI / helm (pull_request) Successful in 29s
CI / quality (pull_request) Successful in 4m13s
CI / security (pull_request) Successful in 4m38s
CI / e2e_tests (pull_request) Successful in 6m54s
CI / unit_tests (pull_request) Successful in 8m56s
CI / status-check (pull_request) Successful in 3s
Introduce NamespacedProjectService in the application layer to encapsulate
all NamespacedProject domain model construction. The agents project create
CLI command previously imported NamespacedProject and parse_namespaced_name
directly from cleveragents.domain.models.core.project, violating
Architectural Invariant #3 (CLI layer must only call application services).

Changes:
- Add NamespacedProjectService with create_project(), get_project(),
  list_projects(), delete_project(), parse_project_name(),
  validate_project_name(), and project_to_dict() methods
- Wire NamespacedProjectService into the DI container as
  namespaced_project_service provider
- Refactor cli/commands/project.py to use NamespacedProjectService for
  all project operations (create, list, show, delete, link-resource,
  unlink-resource)
- Add BDD feature file and step definitions for NamespacedProjectService
  (25 scenarios covering all service methods and edge cases)
- Narrow exception handling in get_project() to catch only
  ProjectNotFoundError instead of bare Exception, preventing
  infrastructure errors from being masked as NotFoundError
- Update CHANGELOG.md with both #7464 and #8232 entries
- Update CONTRIBUTORS.md with PR #8297 contribution entry

ISSUES CLOSED: #7464
2026-04-21 03:38:05 +00:00
brent.edwards ba7dbe4838 fix: update automation profile field names in TDD bug #989 test
CI / push-validation (pull_request) Successful in 28s
CI / helm (pull_request) Successful in 31s
CI / build (pull_request) Successful in 3m56s
CI / lint (pull_request) Successful in 4m7s
CI / quality (pull_request) Successful in 4m32s
CI / typecheck (pull_request) Successful in 4m42s
CI / security (pull_request) Successful in 4m55s
CI / unit_tests (pull_request) Failing after 5m14s
CI / docker (pull_request) Has been skipped
CI / e2e_tests (pull_request) Successful in 6m56s
CI / integration_tests (pull_request) Successful in 7m3s
CI / coverage (pull_request) Successful in 13m27s
CI / status-check (pull_request) Failing after 3s
The test was using legacy phase-transition field names that were renamed
to spec-defined task-type semantics:
- auto_strategize → decompose_task
- auto_execute → create_tool
- auto_apply → select_tool
- auto_decisions_strategize → edit_code
- auto_decisions_execute → execute_command
- auto_validation_fix → create_file
- auto_strategy_revision → delete_content
- auto_reversion_from_apply → access_network
- auto_child_plans → install_dependency
- auto_retry_transient → modify_config
- auto_checkpoint_restore → approve_plan

This fix allows the TDD test for issue #989 to run properly instead of
failing with TypeError during model instantiation. The test now correctly
executes and fails at the assertion level as expected for a TDD
bug-capture test.

Fixes: Failure preventing PR #10802 batch merge of 7 PRs
2026-04-21 00:08:30 +00:00
brent.edwards 32b5029ea0 chore(merge): merge PR #10003 — fix plan cancel worktree cleanup
CI / lint (pull_request) Successful in 4m8s
CI / helm (pull_request) Successful in 26s
CI / quality (pull_request) Successful in 4m24s
CI / push-validation (pull_request) Successful in 28s
CI / typecheck (pull_request) Successful in 4m41s
CI / security (pull_request) Successful in 4m58s
CI / unit_tests (pull_request) Failing after 5m56s
CI / docker (pull_request) Has been skipped
CI / build (pull_request) Successful in 3m33s
CI / integration_tests (pull_request) Successful in 6m44s
CI / e2e_tests (pull_request) Successful in 6m34s
CI / coverage (pull_request) Successful in 13m36s
CI / status-check (pull_request) Failing after 3s
Merged PR #10003 from branch bugfix/cancel-worktree-cleanup

Resolved conflict in:
- CHANGELOG.md: Accepted incoming version documenting the worktree cleanup fix

The PR fixes a critical issue where plan cancellation did not properly clean up the isolated worktree, leaving stale branches behind. This fix ensures the sandbox is properly cleaned when a plan is cancelled.
2026-04-20 22:24:22 +00:00
brent.edwards bb9695dec3 chore(merge): resolve conflicts in context-tiers and subplan-execution
Resolved merge conflicts from PR #5276 (fix/v3.4.0/context-settings-defaults):

- context_tiers.py: Accepted PR #5276's corrected default values
  - _DEFAULT_MAX_TOKENS_HOT: 8000 → 16000
  - _DEFAULT_MAX_DECISIONS_WARM: 500 → 100
  - _DEFAULT_MAX_DECISIONS_COLD: 5000 → 500

- subplan_execution_service.py: Accepted PR #5276's improved fail-fast logic
  - Replaced status_map with status_lookup naming
  - Added fail_fast_ids set tracking for better cancellation handling
  - Improved edge-case handling for concurrent subplan execution
  - Enhanced comments explaining fail-fast semantics

All linting and type checks pass.
2026-04-20 22:20:45 +00:00
hamza.khyari 805fef32a4 fix(test): patch get_container at module level after import move
CI / helm (pull_request) Successful in 32s
CI / push-validation (pull_request) Successful in 42s
CI / build (pull_request) Successful in 3m47s
CI / lint (pull_request) Successful in 3m55s
CI / quality (pull_request) Successful in 4m20s
CI / typecheck (pull_request) Successful in 4m32s
CI / security (pull_request) Successful in 4m42s
CI / e2e_tests (pull_request) Successful in 7m0s
CI / integration_tests (pull_request) Successful in 8m20s
CI / unit_tests (pull_request) Successful in 8m52s
CI / docker (pull_request) Successful in 1m33s
CI / coverage (pull_request) Successful in 13m22s
CI / status-check (pull_request) Successful in 3s
The G2 fix moved get_container to a top-level import in plan.py.
The Behave step must now patch 'cleveragents.cli.commands.plan.get_container'
instead of 'cleveragents.application.container.get_container' so the mock
is resolved at the call site.

ISSUES CLOSED: #9230
2026-04-20 14:27:44 +00:00
hamza.khyari b907ccd9f8 fix(plan): clean up worktree sandbox on plan cancel
CI / helm (pull_request) Successful in 35s
CI / build (pull_request) Successful in 3m51s
CI / lint (pull_request) Successful in 3m56s
CI / quality (pull_request) Successful in 4m21s
CI / typecheck (pull_request) Successful in 4m32s
CI / security (pull_request) Successful in 4m43s
CI / push-validation (pull_request) Successful in 23s
CI / e2e_tests (pull_request) Successful in 7m51s
CI / integration_tests (pull_request) Successful in 8m32s
CI / unit_tests (pull_request) Successful in 9m6s
CI / docker (pull_request) Successful in 1m29s
CI / coverage (pull_request) Successful in 13m28s
CI / status-check (pull_request) Waiting to run
When a user cancels a plan after execute, the git worktree branch and
directory created during execute are not cleaned up, causing resource
leaks (dangling worktrees accumulate over time).

Add GitWorktreeSandbox.cleanup_stale() classmethod in the
infrastructure layer with idempotent error handling.
_cleanup_sandbox_for_plan() in the CLI layer resolves the plan's
linked git-checkout resource and delegates to cleanup_stale().
Called after service.cancel_plan() in the cancel CLI handler.

ISSUES CLOSED: #9230
2026-04-20 13:54:28 +00:00
HAL9000 813faa4853 fix(domain): replace type: ignore suppressions with setattr in immutability tests
CI / helm (pull_request) Successful in 31s
CI / lint (pull_request) Successful in 3m57s
CI / build (pull_request) Successful in 3m50s
CI / quality (pull_request) Successful in 4m16s
CI / typecheck (pull_request) Successful in 4m37s
CI / security (pull_request) Successful in 4m43s
CI / push-validation (pull_request) Successful in 24s
CI / integration_tests (pull_request) Successful in 7m40s
CI / e2e_tests (pull_request) Successful in 8m18s
CI / unit_tests (pull_request) Successful in 9m26s
CI / docker (pull_request) Successful in 1m44s
CI / coverage (pull_request) Successful in 15m31s
CI / benchmark-regression (push) Failing after 0s
CI / benchmark-publish (push) Failing after 0s
CI / status-check (pull_request) Successful in 3s
CI / push-validation (push) Successful in 25s
CI / helm (push) Successful in 28s
CI / lint (push) Successful in 4m2s
CI / quality (push) Successful in 4m25s
CI / build (push) Successful in 3m41s
CI / typecheck (push) Successful in 4m41s
CI / security (push) Successful in 4m48s
CI / unit_tests (push) Failing after 8m47s
CI / docker (push) Has been skipped
CI / e2e_tests (push) Successful in 8m53s
CI / integration_tests (push) Successful in 10m42s
CI / coverage (push) Successful in 14m45s
CI / status-check (push) Failing after 3s
Replace all # type: ignore[misc] reassignment checks in
features/steps/domain_model_immutability_steps.py with setattr() calls
to exercise frozen model enforcement without suppressing type errors.

Add B010 to per-file-ignores for features/steps/*.py in pyproject.toml
since setattr with constant attribute names is intentional in immutability
tests (exercises frozen Pydantic model enforcement).

Update CONTRIBUTORS.md to document HAL 9000 contributions.

ISSUES CLOSED: #7553
2026-04-20 06:08:50 +00:00
HAL9000 0125c15039 fix(domain): enforce immutability on Plan and Action identity fields
Freeze PlanIdentity (plan_id, parent_plan_id, root_plan_id) and
NamespacedName (name, namespace) using Pydantic frozen=True.
Block PlanTimestamps.created_at reassignment via __setattr__ override.
Mutable state fields (phase, processing_state, updated_at, etc.) remain
fully assignable. Add 17 Behave scenarios verifying all invariants.

ISSUES CLOSED: #7553
2026-04-20 06:08:50 +00:00
HAL9000 42b578e23a Merge branch 'master' into bugfix/6885-tool-cli-bootstrap
CI / helm (pull_request) Successful in 33s
CI / build (pull_request) Successful in 3m54s
CI / lint (pull_request) Successful in 4m4s
CI / quality (pull_request) Successful in 4m29s
CI / push-validation (pull_request) Successful in 23s
CI / typecheck (pull_request) Successful in 4m55s
CI / security (pull_request) Successful in 4m57s
CI / e2e_tests (pull_request) Successful in 7m10s
CI / integration_tests (pull_request) Successful in 7m59s
CI / unit_tests (pull_request) Successful in 9m29s
CI / docker (pull_request) Successful in 1m37s
CI / coverage (pull_request) Successful in 14m48s
CI / benchmark-regression (push) Failing after 0s
CI / benchmark-publish (push) Failing after 0s
CI / status-check (pull_request) Successful in 4s
CI / helm (push) Successful in 39s
CI / lint (push) Successful in 3m51s
CI / quality (push) Successful in 4m15s
CI / typecheck (push) Successful in 4m34s
CI / security (push) Successful in 4m45s
CI / build (push) Successful in 3m48s
CI / push-validation (push) Successful in 22s
CI / integration_tests (push) Successful in 7m40s
CI / e2e_tests (push) Successful in 6m53s
CI / unit_tests (push) Successful in 9m0s
CI / coverage (push) Successful in 14m55s
CI / docker (push) Successful in 1m47s
CI / status-check (push) Successful in 14s
2026-04-19 22:39:05 +00:00
HAL9000 02b64c3c71 Merge branch 'master' into bugfix/6885-tool-cli-bootstrap
CI / push-validation (pull_request) Successful in 31s
CI / helm (pull_request) Successful in 42s
CI / lint (pull_request) Successful in 4m0s
CI / typecheck (pull_request) Successful in 4m37s
CI / quality (pull_request) Successful in 4m31s
CI / build (pull_request) Successful in 3m49s
CI / security (pull_request) Successful in 5m0s
CI / e2e_tests (pull_request) Successful in 6m58s
CI / integration_tests (pull_request) Successful in 7m59s
CI / unit_tests (pull_request) Successful in 9m26s
CI / coverage (pull_request) Successful in 15m24s
CI / docker (pull_request) Successful in 1m53s
CI / status-check (pull_request) Successful in 3s
2026-04-19 22:11:19 +00:00
HAL9000 1343dc151c Merge branch 'master' into fix/decomposition-directory-key-absolute-paths
CI / helm (pull_request) Successful in 41s
CI / push-validation (pull_request) Successful in 23s
CI / build (pull_request) Successful in 3m59s
CI / lint (pull_request) Successful in 4m12s
CI / quality (pull_request) Successful in 4m31s
CI / typecheck (pull_request) Successful in 4m50s
CI / security (pull_request) Successful in 4m58s
CI / integration_tests (pull_request) Successful in 8m12s
CI / e2e_tests (pull_request) Successful in 8m21s
CI / unit_tests (pull_request) Successful in 9m46s
CI / docker (pull_request) Successful in 1m37s
CI / coverage (pull_request) Successful in 14m50s
CI / benchmark-regression (push) Failing after 0s
CI / benchmark-publish (push) Failing after 0s
CI / status-check (pull_request) Successful in 4s
CI / helm (push) Successful in 33s
CI / push-validation (push) Successful in 34s
CI / build (push) Successful in 3m50s
CI / lint (push) Successful in 3m59s
CI / quality (push) Successful in 4m21s
CI / typecheck (push) Successful in 4m41s
CI / security (push) Successful in 4m49s
CI / integration_tests (push) Successful in 8m8s
CI / e2e_tests (push) Successful in 8m14s
CI / unit_tests (push) Successful in 9m8s
CI / docker (push) Successful in 1m38s
CI / coverage (push) Successful in 17m16s
CI / status-check (push) Waiting to run
2026-04-19 22:05:53 +00:00
hamza.khyari fa01cee7d2 fix(plan): abort git merge on conflict and restore clean repo state
CI / helm (pull_request) Successful in 34s
CI / push-validation (pull_request) Successful in 35s
CI / build (pull_request) Successful in 3m50s
CI / lint (pull_request) Successful in 4m9s
CI / quality (pull_request) Successful in 4m38s
CI / typecheck (pull_request) Successful in 4m58s
CI / security (pull_request) Successful in 5m11s
CI / e2e_tests (pull_request) Successful in 7m37s
CI / integration_tests (pull_request) Successful in 10m46s
CI / unit_tests (pull_request) Successful in 11m36s
CI / coverage (pull_request) Successful in 14m45s
CI / docker (pull_request) Successful in 1m36s
CI / benchmark-regression (push) Failing after 0s
CI / benchmark-publish (push) Failing after 0s
CI / status-check (pull_request) Successful in 4s
CI / helm (push) Successful in 41s
CI / lint (push) Successful in 3m54s
CI / quality (push) Successful in 4m13s
CI / typecheck (push) Successful in 4m40s
CI / security (push) Successful in 4m41s
CI / build (push) Successful in 3m49s
CI / push-validation (push) Successful in 22s
CI / e2e_tests (push) Successful in 6m54s
CI / integration_tests (push) Successful in 10m24s
CI / unit_tests (push) Successful in 11m23s
CI / coverage (push) Successful in 14m57s
CI / docker (push) Successful in 2m13s
CI / status-check (push) Successful in 4s
When plan apply encounters a merge conflict (user edited the same file
between execute and apply), the git merge leaves conflict markers in
the project files and the repo in an unmerged state.

Fix:
- Read conflict detail from CalledProcessError.stdout (git writes
  conflict info to stdout, not stderr)
- Run git merge --abort to restore the repo to a clean state
- Catch subprocess.TimeoutExpired on both merge and abort calls
- Check abort return code and include error detail on failure
- Return False from _apply_sandbox_changes on failure so the calling
  code does NOT complete the apply phase
- Transition plan to constrained state via service.constrain_apply()
  per spec §18334-18336 (plan may revert to Strategize for re-planning)
- Fall back to 'Unknown merge error' when stdout+stderr are empty

Tests: 7 Behave scenarios covering merge conflict abort, abort failure,
_apply_sandbox_changes return value (True/False), clean merge, merge
timeout, abort timeout, and flat file copy failure.

ISSUES CLOSED: #7250
2026-04-19 17:10:17 +00:00
HAL9000 e261ea5abe fix(decomposition): address review feedback for PR #9437
CI / push-validation (pull_request) Successful in 34s
CI / helm (pull_request) Successful in 36s
CI / lint (pull_request) Successful in 3m55s
CI / typecheck (pull_request) Successful in 4m35s
CI / security (pull_request) Successful in 4m43s
CI / build (pull_request) Successful in 3m57s
CI / quality (pull_request) Successful in 4m26s
CI / e2e_tests (pull_request) Successful in 8m57s
CI / integration_tests (pull_request) Successful in 10m49s
CI / unit_tests (pull_request) Successful in 11m56s
CI / docker (pull_request) Failing after 46s
CI / coverage (pull_request) Successful in 14m47s
CI / status-check (pull_request) Failing after 3s
- Remove committed test_reports/ CI artifacts (summary.txt, test_results.json)
- Add test_reports/ to .gitignore to prevent future commits
- Update CHANGELOG.md with Fixed entry for #9401 under [Unreleased]
- Update CONTRIBUTORS.md with credit for directory clustering fix (#9401)
- Add BDD test scenarios for absolute path clustering in
  features/large_project_decomposition.feature:
  * Directory clustering works correctly with absolute file paths
  * _directory_key returns correct key for absolute path with root
  * Directory clustering does not collapse all absolute paths into one bucket
- Add corresponding step implementations in
  features/steps/large_project_decomposition_coverage_steps.py

All 38 scenarios pass (including 3 new absolute path scenarios).
Lint and typecheck pass.

ISSUES CLOSED: #9401
2026-04-17 22:49:46 +00:00
HAL9000 66850665b7 fix(sandbox): split oversized step file and update CONTRIBUTORS.md
CI / push-validation (pull_request) Successful in 10s
CI / helm (pull_request) Successful in 33s
CI / lint (pull_request) Successful in 44s
CI / quality (pull_request) Successful in 48s
CI / security (pull_request) Successful in 54s
CI / e2e_tests (pull_request) Successful in 3m14s
CI / build (pull_request) Successful in 3m25s
CI / typecheck (pull_request) Successful in 4m1s
CI / integration_tests (pull_request) Successful in 6m33s
CI / unit_tests (pull_request) Successful in 7m48s
CI / docker (pull_request) Successful in 55s
CI / coverage (pull_request) Successful in 5m58s
CI / status-check (pull_request) Successful in 2s
CI / benchmark-regression (push) Failing after 0s
CI / benchmark-publish (push) Failing after 0s
CI / push-validation (push) Successful in 13s
CI / lint (push) Successful in 19s
CI / helm (push) Successful in 24s
CI / build (push) Successful in 31s
CI / quality (push) Successful in 39s
CI / typecheck (push) Successful in 42s
CI / security (push) Successful in 43s
CI / e2e_tests (push) Successful in 3m20s
CI / unit_tests (push) Successful in 3m36s
CI / integration_tests (push) Successful in 4m34s
CI / docker (push) Successful in 1m38s
CI / coverage (push) Successful in 9m25s
CI / status-check (push) Successful in 1s
Split checkpoint_manager_coverage_steps.py (692 lines) into three
focused modules to comply with the 500-line file limit:

- checkpoint_manager_coverage_steps.py: model, protocol, manager init,
  create_checkpoint, _snapshot_directory, and _cleanup_snapshot steps
  (408 lines)
- checkpoint_manager_rollback_steps.py: rollback_to, list_checkpoints,
  and delete_checkpoint branch steps (283 lines)
- checkpoint_manager_bug7488_steps.py: Bug #7488 sandbox_path
  auto-stored-in-metadata steps (59 lines)

Also updated CONTRIBUTORS.md to document HAL 9000's contribution for
bug fix #7488 as required by CONTRIBUTING.md guidelines.

ISSUES CLOSED: #7488
2026-04-17 18:34:16 +00:00
HAL9000 beceb183d0 fix(sandbox): store sandbox_path in checkpoint metadata to enable rollback
CheckpointManager.create_checkpoint() computed sandbox_path from
sandbox.context.sandbox_path but never stored it in the metadata dict.
This caused rollback_to() to always find metadata.get('sandbox_path')
returning None, silently skip the rollback, and return False.

The fix adds sandbox_path to the metadata dict immediately after it is
resolved from the sandbox context, before the SandboxCheckpoint is
constructed. rollback_to() can now retrieve the path and correctly
restore the sandbox filesystem state.

Added two new BDD scenarios to checkpoint_manager_coverage.feature:
- Verifies sandbox_path is automatically stored in metadata on create
- Verifies rollback succeeds without manually supplying sandbox_path

ISSUES CLOSED: #7488
2026-04-17 18:33:39 +00:00
CoreRasurae 0c5b140d29 fix(database): include alembic files in package distribution
CI / push-validation (pull_request) Successful in 18s
CI / lint (pull_request) Successful in 26s
CI / helm (pull_request) Successful in 38s
CI / build (pull_request) Successful in 48s
CI / quality (pull_request) Successful in 54s
CI / security (pull_request) Successful in 55s
CI / typecheck (pull_request) Successful in 57s
CI / e2e_tests (pull_request) Successful in 4m48s
CI / unit_tests (pull_request) Successful in 8m5s
CI / integration_tests (pull_request) Successful in 9m23s
CI / docker (pull_request) Successful in 1m23s
CI / coverage (pull_request) Successful in 12m29s
CI / benchmark-regression (push) Failing after 0s
CI / benchmark-publish (push) Failing after 0s
CI / status-check (pull_request) Successful in 1s
CI / push-validation (push) Successful in 12s
CI / helm (push) Successful in 29s
CI / build (push) Successful in 3m23s
CI / lint (push) Successful in 3m38s
CI / quality (push) Successful in 3m40s
CI / security (push) Successful in 4m3s
CI / typecheck (push) Successful in 4m5s
CI / e2e_tests (push) Successful in 6m42s
CI / unit_tests (push) Successful in 10m7s
CI / integration_tests (push) Successful in 10m13s
CI / docker (push) Successful in 1m46s
CI / coverage (push) Successful in 10m58s
CI / status-check (push) Successful in 2s
Move alembic configuration and migration files from repository root into the
Python package structure to ensure they are included in the wheel distribution.

This fix resolves the FileNotFoundError when running `agents init` in Docker
containers or any environment using the built wheel distribution.

Changes:
- Move alembic/ directory from repo root to
  src/cleveragents/infrastructure/database/migrations/
- Move alembic.ini to the same new location and update script_location setting
- Update MigrationRunner._find_alembic_ini() to search from the new canonical
  location within the package
- Update create_template_db.py to point to the new alembic.ini location
- Update documentation references to reflect new migration file locations
- Create __init__.py for migrations package

- The env.py file is imported when running tests that verify all modules can be
  imported without errors. However, context.config is only available when alembic
  is actually running migrations, not during normal module imports. This caused
  an AttributeError when the test tried to import the migrations.env module.

- Fix by using getattr() with a default value to safely access context.config,
  and guard all code that uses config with None checks. This allows the module
  to be safely imported while still functioning correctly during migrations.

Testing:
- Verified MigrationRunner can locate alembic.ini in new location
- Tested agents init succeeds in creating project with database
- Template database creation works correctly
- All migration tests should pass without changes

Alembic files now follow standard Python packaging conventions, making them
automatically included in wheel distributions without special configuration.

ISSUES CLOSED: #4180
2026-04-17 17:40:00 +00:00
hamza.khyari bdd1ea4f3a fix(checkpoint): wire CheckpointManager into PlanExecutor execution path
CI / push-validation (pull_request) Successful in 10s
CI / build (pull_request) Successful in 16s
CI / helm (pull_request) Successful in 16s
CI / typecheck (pull_request) Successful in 30s
CI / lint (pull_request) Successful in 35s
CI / quality (pull_request) Successful in 35s
CI / security (pull_request) Successful in 50s
CI / integration_tests (pull_request) Successful in 4m3s
CI / e2e_tests (pull_request) Successful in 4m14s
CI / unit_tests (pull_request) Successful in 5m13s
CI / docker (pull_request) Successful in 8s
CI / coverage (pull_request) Successful in 11m2s
CI / status-check (pull_request) Successful in 1s
CheckpointManager was never wired into PlanExecutor — the CLI factory
constructed PlanExecutor without a checkpoint_manager (defaulted to
None), silently skipping all checkpoint hooks.

Fix:
- Register CheckpointManager as Singleton in DI container
- Resolve container singleton in _get_plan_executor() and pass to
  PlanExecutor constructor
- Bridge infra→domain: _try_create_checkpoint() now persists
  last_checkpoint_id on the plan via _commit_plan(), raises PlanError
  if persistence fails
- Default checkpointable=True for writable+sandboxable resources and
  write-capable tools (model_validators on ResourceCapabilities and
  ToolCapability)
- Validate that non-writable/non-sandboxable resources cannot be
  checkpointable (ValueError guard)
- Add post-execute A2A facade notification using plan.status to avoid
  duplicate execute→execute transition errors

Tests:
- 10 Behave scenarios covering DI wiring, singleton identity, checkpoint
  creation, plan metadata update, rollback, graceful fallback, no-arg
  constructor, capability defaults (positive + 2 negative)
- Updated consolidated_resource, consolidated_skill, and Robot
  helper_skill_flatten for new checkpointable defaults

ISSUES CLOSED: #1253
2026-04-17 11:46:38 +00:00
hurui200320 80c8636c4a Revert "feat: add fallback to Anthropic Sonnet when OpenAI quota is exhausted"
This reverts commit f5712787e0.
2026-04-17 18:00:47 +08:00
hurui200320 ed7276773e Merge branch 'master' into fix/plan-diff-correction-stub
CI / lint (pull_request) Successful in 27s
CI / typecheck (pull_request) Successful in 31s
CI / security (pull_request) Successful in 33s
CI / quality (pull_request) Successful in 32s
CI / build (pull_request) Successful in 24s
CI / helm (pull_request) Successful in 23s
CI / push-validation (pull_request) Successful in 19s
CI / e2e_tests (pull_request) Successful in 3m42s
CI / unit_tests (pull_request) Successful in 10m13s
CI / integration_tests (pull_request) Successful in 10m51s
CI / docker (pull_request) Successful in 1m15s
CI / coverage (pull_request) Successful in 10m55s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (push) Failing after 0s
CI / benchmark-publish (push) Failing after 0s
CI / lint (push) Successful in 16s
CI / build (push) Successful in 16s
CI / typecheck (push) Successful in 35s
CI / security (push) Successful in 36s
CI / helm (push) Successful in 19s
CI / quality (push) Successful in 43s
CI / push-validation (push) Successful in 10s
CI / e2e_tests (push) Successful in 2m42s
CI / integration_tests (push) Successful in 7m7s
CI / unit_tests (push) Successful in 8m28s
CI / docker (push) Successful in 1m20s
CI / coverage (push) Successful in 12m10s
CI / status-check (push) Successful in 1s
2026-04-17 09:38:13 +00:00
hurui200320 1fda56b778 fix(cli): implement plan diff --correction to show real correction attempt diff
CI / lint (pull_request) Successful in 29s
CI / typecheck (pull_request) Successful in 58s
CI / quality (pull_request) Successful in 29s
CI / security (pull_request) Successful in 1m11s
CI / build (pull_request) Successful in 24s
CI / push-validation (pull_request) Successful in 21s
CI / helm (pull_request) Successful in 41s
CI / integration_tests (pull_request) Successful in 4m22s
CI / e2e_tests (pull_request) Successful in 4m39s
CI / unit_tests (pull_request) Successful in 9m51s
CI / coverage (pull_request) Successful in 13m30s
CI / docker (pull_request) Successful in 1m23s
CI / status-check (pull_request) Successful in 2s
Implement spec-compliant correction diff output for `agents plan diff
--correction <CORRECTION_ATTEMPT_ID>`. Fixes the following issues from
the cycle-1 PR review:

- C1/M1: Replace direct `unit_of_work.correction_attempts` access with
  the proper `unit_of_work.transaction()` context manager, eliminating
  the AttributeError crash and the resource (session) leak.
- C2: Add `unit_of_work: UnitOfWork | None = None` constructor parameter
  to `PlanApplyService` and wire it in `_get_apply_service()` via
  `container.unit_of_work()`, removing the illegal `get_container()`
  call inside the method body (ADR-003 DI violation).
- C3: Replace metadata serialization stub with a three-section structured
  diff (Correction Diff summary, Comparison table, Patch Preview) as
  specified in §agents plan diff of the specification.
- C4/M2: Add `features/plan_correction_diff.feature` with 6 BDD
  scenarios covering all 4 output formats plus plan-not-found and
  correction-not-found error paths.
- C5: Update the three existing BDD scenarios that tested old stub
  behavior to mock `_get_apply_service()` and assert the new output.
- C6: Rename branch to `bugfix/m4-plan-diff-correction-stub` per
  CONTRIBUTING.md convention.
- C7: Amend commit message with body and ISSUES CLOSED footer.
- C8: Narrow `except Exception` to `except CorrectionAttemptNotFoundError`
  to avoid masking programming errors.
- M3: Add `robot/plan_correction_diff.robot` and
  `robot/helper_plan_correction_diff.py` integration test covering rich,
  plain, and JSON formats and the not-found error path.
- M4: Type `_build_correction_diff_dict` parameter as
  `CorrectionAttemptRecord` instead of `Any`.
- M5: Change `fmt: str` to `fmt: Literal["rich", "plain", "json", "yaml"]`
  on both `diff()` and `correction_diff()`, with a `cast()` call in the
  CLI layer where Typer supplies a plain `str`.
- M6: Add `ValueError` guards for empty `plan_id` and
  `correction_attempt_id` at the top of `correction_diff()`.
- M7: Add blank line between `diff()` and `correction_diff()` method
  definitions.
- M8: Update PR description to reflect actual implementation.
- m1: Remove unused `plan` variable in `correction_diff()`.
- m2: Reduce three blank lines to two between top-level definitions in
  `plan_apply_service.py`.
- n1: Remove trailing whitespace from blank line in `plan.py`.

Quality gates: lint (ruff), typecheck (pyright strict), unit_tests
(Behave 632 features / 0 failures) all pass.

ISSUES CLOSED: #9085
2026-04-17 08:34:33 +00:00
hurui200320 8953449dc2 fix(actor): validate v3 YAML via ActorConfigSchema in agents actor add CLI
CI / lint (pull_request) Successful in 30s
CI / typecheck (pull_request) Successful in 1m15s
CI / security (pull_request) Successful in 1m18s
CI / quality (pull_request) Successful in 30s
CI / build (pull_request) Successful in 37s
CI / helm (pull_request) Successful in 29s
CI / push-validation (pull_request) Successful in 26s
CI / e2e_tests (pull_request) Successful in 3m58s
CI / integration_tests (pull_request) Successful in 6m49s
CI / unit_tests (pull_request) Successful in 8m39s
CI / docker (pull_request) Successful in 1m23s
CI / coverage (pull_request) Successful in 13m32s
CI / benchmark-regression (push) Failing after 0s
CI / benchmark-publish (push) Failing after 0s
CI / status-check (pull_request) Successful in 1s
CI / lint (push) Successful in 25s
CI / typecheck (push) Successful in 1m1s
CI / quality (push) Successful in 55s
CI / security (push) Successful in 1m9s
CI / build (push) Successful in 24s
CI / helm (push) Successful in 30s
CI / push-validation (push) Successful in 20s
CI / e2e_tests (push) Successful in 5m13s
CI / integration_tests (push) Successful in 7m17s
CI / unit_tests (push) Successful in 8m50s
CI / docker (push) Successful in 1m30s
CI / coverage (push) Successful in 11m57s
CI / status-check (push) Successful in 2s
- schema.py: provider field changed to Optional[str] with model validator
  validate_provider_required_for_llm_graph() that requires it only for LLM
  and GRAPH actor types; TOOL actors do not require provider
- schema.py: is_v3_yaml() uses version_str == "3" or version_str.startswith("3.")
  to avoid false positives from "30" or "300" version strings
- schema.py: tool namespace validation uses strict 2-part split to reject
  empty namespace or empty name (e.g. "/tool", "ns/", "a/b/c")
- cli/commands/actor.py: schema_version extraction uses raw_version pattern
  (no # type: ignore[assignment]) for clean static typing
- actor/__init__.py: is_v3_yaml removed from __all__ and _LAZY_IMPORTS
  since it is a module-private helper, not a public API
- robot/actor_add_v3_schema_validation.robot: YAML fixtures for 'Reject v3
  LLM Actor Without Model Field' and 'Reject v3 TOOL Actor Without Tools
  Field' now include required provider field (and model for TOOL fixture)
- robot/helper_actor_add_v3_schema_validation.py: except clauses unified to
  catch (subprocess.TimeoutExpired, FileNotFoundError) in both add_actor()
  and update_actor() functions
- features/actor_add_v3_schema_validation.feature: 'Update a v3 actor with
  valid YAML succeeds' scenario now includes 'And the actor should be
  validated via ActorConfigSchema'; error assertions tightened to exact
  messages (e.g. "Input should be 'llm', 'tool' or 'graph'", "Node ID must
  be alphanumeric", "must be namespaced")
- features/steps/actor_add_v3_schema_validation_steps.py: step_run_actor_update
  now spies on ActorConfigSchema.model_validate; failure paths assert
  isinstance(result.exception, SystemExit)

ISSUES CLOSED: #5869
2026-04-17 16:28:45 +08:00
HAL9000 e18ac5f23c fix(security): replace startswith sandbox check with Path.relative_to() in validate_path #7558
CI / lint (pull_request) Successful in 20s
CI / quality (pull_request) Successful in 21s
CI / push-validation (pull_request) Successful in 20s
CI / build (pull_request) Successful in 24s
CI / typecheck (pull_request) Successful in 50s
CI / security (pull_request) Successful in 59s
CI / helm (pull_request) Successful in 44s
CI / integration_tests (pull_request) Successful in 4m41s
CI / unit_tests (pull_request) Successful in 5m24s
CI / docker (pull_request) Successful in 52s
CI / coverage (pull_request) Successful in 7m38s
CI / e2e_tests (pull_request) Successful in 2m14s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (push) Failing after 0s
CI / benchmark-publish (push) Failing after 0s
CI / lint (push) Successful in 18s
CI / quality (push) Successful in 40s
CI / typecheck (push) Successful in 41s
CI / security (push) Successful in 42s
CI / build (push) Successful in 25s
CI / push-validation (push) Successful in 30s
CI / helm (push) Successful in 56s
CI / e2e_tests (push) Successful in 3m3s
CI / unit_tests (push) Successful in 4m3s
CI / integration_tests (push) Successful in 4m8s
CI / docker (push) Successful in 52s
CI / coverage (push) Successful in 7m22s
CI / status-check (push) Successful in 1s
The validate_path() function in file_tools.py used str.startswith() to
verify that a resolved path stays within the sandbox root. This allowed
sibling directories whose names share a string prefix with the sandbox
(e.g. /tmp/sandbox-escape/ bypassing /tmp/sandbox/) to escape the
containment check.

Replace the string prefix check with Path.relative_to(root), which
performs a proper OS-level path prefix comparison using path separators.
Add a Behave regression scenario tagged @tdd_issue @tdd_issue_7558 that
exercises the prefix-collision bypass to prevent regressions.

ISSUES CLOSED: #7558
2026-04-17 04:50:55 +00:00
CoreRasurae f5712787e0 feat: add fallback to Anthropic Sonnet when OpenAI quota is exhausted
Implements graceful degradation for E2E robot integration tests that hit OpenAI 429 quota limit errors.

Changes:
- Add _is_quota_error() helper to detect quota-specific API errors (429, insufficient_quota, rate_limit)
- Modify _execute_with_llm() in StrategyActor to catch quota errors and attempt fallback to Anthropic Haiku
- Configure fallback provider as 'anthropic/claude-sonnet-4-20250514'
- Add comprehensive logging for quota error detection and provider fallback
- Add E2E test scenarios for quota fallback verification

When quota errors occur on both OpenAI and Anthropic fallback, tests
now fail with a clear message explaining that the test outcome cannot
be verified when no LLM provider is available.
 This ensures CI/CD pipelines properly track which tests could not be
executed due to quota constraints, rather than silently skipping them
and creating false confidence in test coverage.

This ensures CI/CD pipelines can complete E2E tests even when the primary provider (OpenAI) hits quota limits,
improving pipeline reliability and reducing false negatives caused by provider-specific issues.

1. **Cache fallback_llm instance** - Instead of recreating the fallback LLM
   every time a quota error occurs, cache it as an instance variable
   (self._fallback_llm). This avoids unnecessary re-initialization overhead.

2. **Implement quota recovery logic** - Add intelligent recovery behavior:
   - Track last quota error timestamp (self._last_quota_error_time)
   - Track fallback mode state (self._using_fallback)
   - Once quota error detected, switch to fallback provider
   - Only attempt to recover primary provider every 5 minutes (_QUOTA_RECOVERY_INTERVAL)
   - This avoids hammering primary provider with repeated quota errors

3. **Add detailed recovery logging** - Log quota fallback transitions and
   recovery attempts to improve observability and debugging.

Benefits:
- Reduced latency: No redundant primary provider calls after quota error
- Reduced overhead: Cached fallback LLM instance, no per-call recreation
- Better observability: Clear logging of fallback mode entry/exit
- Intelligent recovery: Automatic recovery attempt after 5-minute interval

Updated tests:
- M6 E2E Event Queue Via Plan Lifecycle Transitions
- M6 E2E Hierarchical Decomposition Via Plan Tree
- M6 E2E Full Autonomy Acceptance Flow

Fixes: #10042
2026-04-17 03:56:35 +00:00
HAL9000 cef70ff98a fix(security): add Robot integration test and CONTRIBUTORS for #7476
Add Robot Framework integration test verifying that load_from_entry_points
does not call ep.load() for entry points with disallowed module prefixes
(security regression test for issue #7476).

Also add HAL 9000 to CONTRIBUTORS.md per CONTRIBUTING.md process rules.

ISSUES CLOSED: #7476
2026-04-15 06:37:18 +00:00
HAL9000 717a05f604 fix(security): fix plugins/loader.py load_from_entry_point security #7476
Parse entry point targets before import so allowlist enforcement happens prior to execution and add a Behave regression scenario covering the disallowed-prefix path.

ISSUES CLOSED: #7476
2026-04-15 06:37:18 +00:00
hurui200320 f67e8a2e07 fix(testing): document and harden non-AssertionError guard in apply_tdd_inversion to reduce flaky CI
CI / lint (pull_request) Successful in 18s
CI / build (pull_request) Successful in 17s
CI / helm (pull_request) Successful in 18s
CI / quality (pull_request) Successful in 53s
CI / typecheck (pull_request) Successful in 56s
CI / security (pull_request) Successful in 57s
CI / push-validation (pull_request) Successful in 40s
CI / unit_tests (pull_request) Successful in 3m13s
CI / integration_tests (pull_request) Successful in 4m23s
CI / e2e_tests (pull_request) Successful in 4m37s
CI / docker (pull_request) Successful in 1m34s
CI / coverage (pull_request) Successful in 10m46s
CI / status-check (pull_request) Successful in 1s
CI / lint (push) Successful in 17s
CI / quality (push) Successful in 17s
CI / build (push) Successful in 24s
CI / helm (push) Successful in 24s
CI / push-validation (push) Successful in 37s
CI / typecheck (push) Successful in 52s
CI / security (push) Successful in 52s
CI / e2e_tests (push) Successful in 3m13s
CI / unit_tests (push) Successful in 6m37s
CI / integration_tests (push) Successful in 6m39s
CI / docker (push) Successful in 1m35s
CI / coverage (push) Successful in 11m13s
CI / status-check (push) Successful in 1s
Surface the non-AssertionError guard warning in standard Behave output by emitting to stderr in addition to the structured logger, and add infrastructure coverage that asserts this guard path is visible during test runs. Document the @tdd_expected_fail expectation that bug-signaling failures must use AssertionError so infrastructure exceptions are not accidentally treated as expected bug failures.

ISSUES CLOSED: #8294
2026-04-15 13:37:16 +08:00
hurui200320 8b2e0c81c5 fix(testing): print behave-parallel worker logs only for failed chunks
CI / lint (pull_request) Successful in 20s
CI / helm (pull_request) Successful in 33s
CI / push-validation (pull_request) Successful in 21s
CI / quality (pull_request) Successful in 3m36s
CI / build (pull_request) Successful in 3m44s
CI / typecheck (pull_request) Successful in 4m30s
CI / security (pull_request) Successful in 4m37s
CI / e2e_tests (pull_request) Successful in 6m54s
CI / unit_tests (pull_request) Successful in 9m46s
CI / integration_tests (pull_request) Successful in 9m51s
CI / docker (pull_request) Successful in 1m33s
CI / coverage (pull_request) Successful in 10m53s
CI / status-check (pull_request) Successful in 0s
CI / security (push) Successful in 41s
CI / helm (push) Successful in 31s
CI / push-validation (push) Successful in 33s
CI / lint (push) Successful in 3m17s
CI / build (push) Successful in 3m16s
CI / quality (push) Successful in 3m38s
CI / typecheck (push) Successful in 4m16s
CI / e2e_tests (push) Successful in 6m35s
CI / unit_tests (push) Successful in 10m18s
CI / integration_tests (push) Successful in 10m21s
CI / docker (push) Successful in 1m36s
CI / coverage (push) Successful in 10m47s
CI / status-check (push) Successful in 0s
In parallel mode, the behave runner previously replayed captured
stdout/stderr for every worker chunk, creating noisy output that
obscured failure diagnostics in CI and local runs.

Changes to scripts/run_behave_parallel.py:

- Added _chunk_has_failures() and _chunk_no_scenarios_ran() helpers
  to evaluate individual chunk summaries for failure/error/crash
  conditions.

- Updated the aggregation loop in main() to conditionally replay
  captured stdout/stderr only for chunks whose summary indicates
  failures, errors, or no scenarios ran (crash detection).  Passing
  chunks now suppress their output entirely.

- Added robust exception handling in _worker_run_features() so that
  worker crashes produce a full traceback in stderr and return a crash
  summary with features.errors = 1, enabling the parent to detect the
  crash via _chunk_has_failures (and also _chunk_no_scenarios_ran,
  since no scenarios reached a terminal state) and replay the
  diagnostics.

- The conditional replay uses summary-based checks rather than the
  raw runner.run() boolean, consistent with the existing exit-code
  logic.  This avoids spurious log replay for @tdd_expected_fail
  scenarios whose runner.run() returns True even though the TDD
  inversion handler has corrected the scenario status to passed.

- Existing summary merge, exit semantics, and the no-scenarios
  safety net are fully preserved.

New Behave unit tests (17 scenarios) cover the chunk-level helpers,
the conditional aggregation loop, the pure no-scenarios-ran path,
stderr replay for non-crash failed chunks, and the worker crash path.
New Robot integration tests (6 test cases) verify the same behavior
end-to-end via the helper_behave_parallel_log_filtering.py script.

Also updated:
- CHANGELOG.md: add unreleased entry for this behavioral change.
- features/steps/behave_parallel_log_filtering_steps.py: use
  contextlib.redirect_stdout/redirect_stderr instead of manual
  sys.stdout assignment; register module in sys.modules; document
  CWD requirement in _load_runner_module().
- robot/helper_behave_parallel_log_filtering.py: move import io to
  top-level; remove redundant inline imports; use contextlib for
  output capture; register module in sys.modules; document CWD
  requirement.

Branch note: the canonical branch for this fix is
bugfix/m3-behave-parallel-failed-chunk-logs.  The PR head branch
(bugfix/mX-behave-parallel-failed-chunk-logs) cannot be renamed via
the Forgejo API; both branches are kept in sync at the same SHA.

ISSUES CLOSED: #8351
2026-04-15 03:21:05 +00:00
HAL9000 0f75429253 fix(concurrency): add thread safety to ContextTierService
Implemented thread-safety improvements for ContextTierService by
introducing a re-entrant lock and guarding all critical sections
with self._lock. This prevents RuntimeError: dictionary changed
size during iteration under concurrent plan execution.

- Added threading.RLock to ContextTierService.__init__ as self._lock
- Wrapped all public methods (store, get, promote, demote, evict_lru,
  get_metrics, get_all_fragments, get_hot_fragments, get_for_actor,
  get_scoped_view) with with self._lock:
- Added _lock: threading.RLock type stub to TierRuntimeMixin and
  ScopedTierMixin
- Wrapped enforce_staleness in TierRuntimeMixin with self._lock
- Wrapped get_scoped_by_resource and get_scoped_metrics in
  ScopedTierMixin with self._lock
- Extracted settings helpers to new context_tier_settings.py to keep
  context_tiers.py under 500 lines
- Added BDD feature file context_tier_thread_safety.feature with
  10 thread-safety scenarios
- Added step definitions context_tier_thread_safety_steps.py
- Updated CHANGELOG.md with fix entry

ISSUES CLOSED: #7547
2026-04-15 00:24:13 +00:00
CoreRasurae d3cb534caf feat(plan): implement LLM-powered strategy actor
CI / push-validation (pull_request) Successful in 17s
CI / helm (pull_request) Successful in 19s
CI / lint (pull_request) Successful in 27s
CI / security (pull_request) Successful in 32s
CI / quality (pull_request) Successful in 41s
CI / typecheck (pull_request) Successful in 48s
CI / build (pull_request) Successful in 3m18s
CI / e2e_tests (pull_request) Successful in 4m16s
CI / integration_tests (pull_request) Successful in 4m16s
CI / unit_tests (pull_request) Successful in 5m8s
CI / docker (pull_request) Successful in 1m32s
CI / coverage (pull_request) Successful in 10m53s
CI / status-check (pull_request) Successful in 1s
CI / push-validation (push) Successful in 18s
CI / helm (push) Successful in 23s
CI / build (push) Successful in 31s
CI / lint (push) Successful in 43s
CI / typecheck (push) Successful in 52s
CI / security (push) Successful in 52s
CI / e2e_tests (push) Successful in 3m37s
CI / quality (push) Successful in 3m44s
CI / integration_tests (push) Successful in 6m35s
CI / unit_tests (push) Failing after 7m36s
CI / docker (push) Has been skipped
CI / coverage (push) Successful in 13m39s
CI / status-check (push) Failing after 1s
Implement StrategyActor class for the plan strategize phase that uses an
LLM to produce hierarchical execution strategies with dependencies,
resource requirements, estimated complexity, and risk scores.

Key components:
- StrategyActor: Core actor with LLM prompt construction, response
  parsing (JSON and numbered-list fallback), and graceful degradation
  to StrategizeStubActor when no LLM provider is configured
- StrategyAction/StrategyTree: Pydantic models for the hierarchical
  action tree with dependency links
- validate_no_cycles(): Kahns algorithm (deque-based) for dependency
  graph cycle detection, raising PlanError on circular dependencies
- build_strategy_prompt(): Context-aware prompt construction using
  definition_of_done, resources, project context, and ACMS analysis
  with XML-delimited user content sections for prompt injection
  hardening
- parse_strategy_response(): Robust LLM output parsing with JSON
  extraction and numbered-list fallback
- resolve_strategy_actor(): Integration point for the existing
  actor.default.strategy config key (CLEVERAGENTS_DEFAULT_STRATEGY_ACTOR)
- Decision conversion producing strategy_choice Decision objects
- build_decisions() preserves tree hierarchy via parent_id mapping,
  populates downstream_decision_ids from dependency edges, and
  validates plan_id

Structural tree hierarchy (B2 review fix):
- _build_tree infers parent_id from the dependency graph: each
  actions first resolved dependency becomes its structural parent.
  Actions with no dependencies fall back to the root.  This produces
  hierarchical trees for agents plan tree rendering per spec
  Plan Decision Tree.

Downstream decision tracking (B3 review fix):
- build_decisions populates downstream_decision_ids from the strategy
  trees dependency edges using a pre-generated decision_id map so
  influence relationships between decisions are recorded per the spec
  Decision Record Structure.

Post code-review hardening (PR #1175):
- Broadened exception handling in execute() and ACMS retrieval to
  catch all LLM provider errors (openai, httpx, anthropic, etc.)
  with graceful fallback to stub mode (H1, H2)
- Added warning log for unresolvable dependency references so
  dropped edges are visible in structured logs (H3)
- Added XML-delimited user content sections and explicit data-only
  instructions in system prompt for prompt injection hardening (H4)
- Switched prompt truncation to word-boundary-safe _truncate_at_word()
  for all prompt input sections (M1)
- Fixed _parse_actor_name to preserve user-specified provider or
  model when only one segment is empty, instead of discarding both (M2)
- Annotated _build_invariant_records as placeholder pending the
  Invariant Reconciliation Actor implementation (M5)
- Documented resources/project_context params as future-wired
  through PlanExecutor.run_strategize() (M8)
- Added docstring noting supersession relationship with
  LLMStrategizeActor in llm_actors.py (M9)
- Added __all__ export definition (L2)
- Improved validate_no_cycles docstring edge direction semantics (L7)
- Cap JSON parse retry loop at _MAX_JSON_PARSE_RETRIES (10)

Post second code-review hardening (PR #1175, review cycle 2):
- Fixed _truncate_at_word docstring: documented max_chars >= 3
  precondition for the result-length guarantee (R-H1)
- Added warning log in build_decisions for unresolvable parent_id
  references, matching the existing _build_tree warning for
  unresolvable dependency references (R-H2)
- Fixed _parse_actor_name to handle whitespace-only input by adding
  actor_name.strip() check alongside the emptiness check (R-M1)
- Tightened ACMS scenario assertions from non-empty to expected
  count of 5 decisions (R-L3)
- Added timeout=60s on_timeout=kill to all Robot test cases for
  consistency with project patterns (R-M5)

Post third code-review hardening (PR #1175, review cycle 3):
- Added _sanitize_xml_content() to escape XML special characters
  (<, >, &) in user content before embedding into XML-delimited
  prompt sections, preventing prompt injection via forged closing
  tags (spec Prompt Injection Mitigation) (CR3-M1)
- Upgraded _try_parse_json() to multi-anchor retry: collects all
  [{ positions left-to-right and tries each as a candidate start,
  fixing false-start anchoring when LLM preamble contains [{
  fragments before the real JSON array (CR3-M2)
- Added _truncate_at_word() guard for max_chars < 3: returns a
  hard slice instead of word-boundary truncation when the ellipsis
  would exceed the limit (CR3-L2)
- Changed _build_tree collision fallback key from -(idx+1) to
  -(1_000_000+idx) to eliminate theoretical collision with
  LLM-produced negative step numbers (CR3-L3)
- Added forward-looking API docstring note to build_decisions()
  documenting that it is not yet wired into PlanExecutor and will
  be integrated once Decision persistence lands (CR3-M3)

Post fourth code-review hardening (PR #1175, review cycle 4):
- Fixed _try_parse_json per-anchor retry counter: reset retries=0
  at the start of each anchor iteration so false-start [{ anchors
  in LLM preamble text no longer exhaust the retry budget for the
  correct anchor (CR4-B1)
- Added known-limitations docstring to module header documenting
  missing decision types (resource_selection, subplan_spawn,
  invariant_enforced) as future work (CR4-D1)
- Rewrote XML injection assertion in test to use regex extraction
  instead of fragile chained .split() calls that could IndexError
  on structural changes (CR4-T5)

Post fifth code-review hardening (PR #1175, review cycle 5):
- Added warning log in build_decisions for empty-string parent_id
  (distinct from None) so the silent fallback to root is visible
  in structured logs for debuggability (CR5-B1)
- Added plan_id propagation assertion to build_decisions test
  scenarios verifying decision.plan_id matches the input (CR5-T1)
- Added sequence_number monotonicity assertion verifying decision
  sequence_numbers are zero-indexed and monotonically increasing
  (CR5-T2)
- Added _truncate_at_word boundary test for max_chars=3 (exactly
  ellipsis length) verifying correct "..." output (CR5-T3)
- Tightened false-start anchor test from permissive len>=1 to
  specific description match "Sole real action" (CR5-T4)
- Added word-boundary truncation test using space-separated input
  to exercise the rfind(" ") path under oversized DoD (CR5-T5)

Post sixth code-review hardening (PR #1175, review cycle 6):
- Added _MAX_INVARIANTS cap (100) for invariant list truncation in
  prompt to prevent token limit overflows, consistent with other prompt
  section caps (CR6-M4)
- Added negative max_chars guard in _truncate_at_word returning empty
  string instead of slicing from end (CR6-M5)
- Added global JSON parse attempt cap _MAX_GLOBAL_JSON_ATTEMPTS (50)
  across all anchors in _try_parse_json (CR6-L3)
- Moved re import to module level in strategy_parsing.py per
  CONTRIBUTING import guidelines (CR6-L4)
- Extracted _DEFAULT_DESCRIPTION constant to eliminate duplication
  between _default_action() and _build_tree() (CR6-L5)

Post seventh code-review hardening (PR #1175, review cycle 7):
- Decoupled _execute_stub from StrategizeStubActor._parse_steps
  private method by delegating to parse_strategy_response, removing
  cross-class private method dependency (CR7-M1)
- Added ULID format validation on plan_id in execute() and
  build_decisions() for spec-consistent argument validation per
  §Plan glossary and CONTRIBUTING §Argument Validation (CR7-M2)
- Constrained StrategyAction.estimated_complexity to
  Literal["low", "medium", "high"] at Pydantic model level per
  CONTRIBUTING §Type Safety (CR7-M5)
- Documented XML-tag prompt boundary deviation from spec
  [USER_CONTENT_START]/[USER_CONTENT_END] markers with rationale
  for the more structured approach (CR7-M6)
- Added _build_tree empty-input guard comment documenting orphaned
  root_id semantics (CR7-L1)
- Added _truncate_at_word > 0 intent comment explaining why
  position-0 space is intentionally excluded (CR7-L2)
- Added build_decisions context_snapshot future-work comment
  referencing spec §Decision Record Structure (CR7-L5)
- Used enumerate() in _build_tree first loop for idiomatic
  Python (CR7-L7)
- Fixed false-start anchor test (CR5-T4) broken by CR6-L3 global
  cap: reduced preamble fragments from 15 to 3 so total attempts
  stay within _MAX_GLOBAL_JSON_ATTEMPTS (CR7-T1)
- Fixed test plan_ids containing non-Crockford-Base32 characters
  (L→K) to pass ULID format validation (CR7-T2)

Tests:
- 105 Behave BDD scenarios in features/strategy_actor_llm.feature
  adding: global JSON attempt cap exhaustion (CR7-L3), orphaned
  dependency edge silent drop (CR7-L4), non-ULID plan_id rejection
  in execute() and build_decisions() (CR7-M2)
- 101 Behave BDD scenarios in features/strategy_actor_llm.feature
  including new scenarios for _truncate_at_word edge cases (L3),
  create_llm argument verification (L4), non-numeric step field
  fallback (L5), updated assertions for XML-delimited prompts
  and _parse_actor_name partial-segment preservation (M2),
  lifecycle exception fallback (R1), PydanticValidationError
  re-raise verification (R2), self-loop cycle detection (R3),
  whitespace-only actor name (R4), XML tag injection sanitisation
  (CR3-M1), preamble bracket fragment parsing (CR3-M2),
  _truncate_at_word sub-3 limit (CR3-L2), resolve_strategy_actor
  with both llm config and registry (CR3-L5), build_decisions
  unresolvable parent_id fallback (CR3-L7), XML injection in
  resources/project_context/acms_context fields (CR4-S1),
  ampersand escaping (CR4-S1d), false-start anchor retry budget
  (CR4-T3), non-sequential step edge specificity (CR4-T4),
  plan_id propagation (CR5-T1), sequence_number monotonicity
  (CR5-T2), max_chars=3 boundary (CR5-T3), false-start anchor
  specificity (CR5-T4), word-boundary truncation (CR5-T5),
  invariant prompt constraints (CR6-M2), invariant XML
  sanitisation (CR6-M3), invariant truncation cap (CR6-M4),
  negative max_chars (CR6-M5), and no-space truncation (CR6-L8)
- 7 Robot Framework integration tests in robot/strategy_actor.robot
- Mock LLM provider in features/mocks/mock_strategy_llm.py

All nox stages pass: lint, typecheck, unit_tests (13789 scenarios),
integration_tests (1863 passed).
integration_tests (1863 passed, 2 pre-existing TDD failures unrelated
to this change).

ISSUES CLOSED: #828
2026-04-14 19:26:49 +00:00
HAL9000 c0d631b6cc fix: custom automation profiles silently fall back to manual
_resolve_profile_for_plan in PlanLifecycleService now raises a clear
ValidationError when a plan's automation profile name is not a known
built-in profile, instead of silently falling back to 'manual'.

Users who configured custom automation profiles (e.g. 'semi-auto',
'acme/strict') will now receive an actionable error message listing
available built-in profiles. The resolved profile name is also logged
at debug level for observability.

Added BDD regression tests (8 scenarios) covering:
- Built-in profiles resolve correctly
- Plans with no profile set resolve to 'manual'
- Custom/unknown profile names raise ValidationError
- Error message mentions the unknown profile name
- Error message lists available built-in profiles
- Debug log records the resolved profile name

ISSUES CLOSED: #8232
2026-04-13 21:16:55 +00:00
HAL9000 dfad3de0a4 fix(cli): fix import ordering and remove type: ignore suppressions
CI / helm (pull_request) Successful in 32s
CI / lint (pull_request) Successful in 38s
CI / build (pull_request) Successful in 42s
CI / quality (pull_request) Successful in 52s
CI / push-validation (pull_request) Successful in 19s
CI / typecheck (pull_request) Successful in 57s
CI / security (pull_request) Successful in 57s
CI / e2e_tests (pull_request) Successful in 3m34s
CI / integration_tests (pull_request) Successful in 7m20s
CI / unit_tests (pull_request) Successful in 8m24s
CI / coverage (pull_request) Successful in 14m45s
CI / docker (pull_request) Successful in 1m55s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 57m34s
Resolve lint CI failure caused by un-sorted import blocks in
tool.py and validation.py, and remove forbidden # type: ignore
comments from the bootstrap step definitions.

- Move first-party bootstrap import into the correct import group
  in cli/commands/tool.py and cli/commands/validation.py
- Add reset_bootstrap_state() public helper to bootstrap.py for
  test-only use, replacing direct private attribute mutation
- Replace Settings._instance = None # type: ignore with Settings.reset()
- Replace cli_bootstrap._database_bootstrapped = False # type: ignore
  with cli_bootstrap.reset_bootstrap_state()

ISSUES CLOSED: #6885
2026-04-13 18:49:11 +00:00
HAL9000 3a4fde9b0c fix(context): correct Settings defaults for context tier limits per spec
Align context tier defaults with the specification and ensure invalid values are rejected via positive-integer validation. Behave coverage locks in the defaults and validation behavior.

ISSUES CLOSED: #5230 #4907
2026-04-12 16:43:30 +00:00
HAL9000 e2df239bd8 fix(cli): bootstrap registry database automatically
CI / lint (pull_request) Failing after 38s
CI / typecheck (pull_request) Successful in 47s
CI / quality (pull_request) Successful in 36s
CI / push-validation (pull_request) Successful in 27s
CI / helm (pull_request) Successful in 35s
CI / build (pull_request) Successful in 41s
CI / security (pull_request) Successful in 1m38s
CI / coverage (pull_request) Has been skipped
CI / e2e_tests (pull_request) Successful in 3m24s
CI / integration_tests (pull_request) Successful in 4m18s
CI / unit_tests (pull_request) Successful in 6m15s
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Has been skipped
Ensure tool and validation CLI commands initialize the SQLite persistence layer on first use and add regression coverage.\n\nISSUES CLOSED: #6885
2026-04-10 20:50:20 +00:00
HAL9000 e19c6a203c fix(cli): add deleted_at field to project delete JSON/YAML output (#6314)
CI / lint (pull_request) Successful in 50s
CI / quality (pull_request) Successful in 35s
CI / security (pull_request) Successful in 55s
CI / typecheck (pull_request) Successful in 58s
CI / push-validation (pull_request) Successful in 19s
CI / helm (pull_request) Successful in 23s
CI / build (pull_request) Successful in 39s
CI / e2e_tests (pull_request) Successful in 4m12s
CI / integration_tests (pull_request) Successful in 5m18s
CI / unit_tests (pull_request) Successful in 5m33s
CI / docker (pull_request) Successful in 1m35s
CI / coverage (pull_request) Successful in 14m36s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 58m28s
ISSUES CLOSED: #6314
2026-04-10 18:59:10 +00:00
CoreRasurae 527c5903a0 fix(cli): display full ULIDs in plan tree output for CLI usability
CI / benchmark-publish (pull_request) Has been skipped
CI / push-validation (pull_request) Successful in 16s
CI / build (pull_request) Successful in 19s
CI / helm (pull_request) Successful in 33s
CI / lint (pull_request) Successful in 39s
CI / quality (pull_request) Successful in 43s
CI / security (pull_request) Successful in 51s
CI / typecheck (pull_request) Successful in 58s
CI / e2e_tests (pull_request) Successful in 3m21s
CI / integration_tests (pull_request) Successful in 4m12s
CI / unit_tests (pull_request) Successful in 5m3s
CI / docker (pull_request) Successful in 1m18s
CI / coverage (pull_request) Successful in 11m40s
CI / status-check (pull_request) Successful in 1s
CI / build (push) Successful in 22s
CI / helm (push) Successful in 27s
CI / push-validation (push) Successful in 27s
CI / quality (push) Successful in 31s
CI / lint (push) Successful in 40s
CI / typecheck (push) Successful in 47s
CI / security (push) Successful in 1m17s
CI / benchmark-regression (push) Has been skipped
CI / e2e_tests (push) Successful in 3m8s
CI / integration_tests (push) Successful in 3m54s
CI / unit_tests (push) Successful in 4m53s
CI / docker (push) Has been cancelled
CI / coverage (push) Has been cancelled
CI / benchmark-publish (push) Has been cancelled
CI / status-check (push) Has been cancelled
CI / benchmark-regression (pull_request) Successful in 58m47s
Modified the agents plan tree command to display full 26-character ULIDs
instead of truncating them to 8 characters. This enables users to copy
decision IDs directly from the tree output and use them in follow-up
CLI commands without manual ID reconstruction.

Key changes:
- Removed [:8] truncation from all decision ID displays (table, tree)
- Updated table column width from 8 to 26 characters for full ULID display
- Removed [...] truncation from plan ID in tree title
- Added 'Decision IDs (for correction)' section listing all decision ULIDs
  with human-readable labels for easy reference
- Supports both rich (with panel) and plain text formatting
- Helper function _get_decision_label() generates appropriate labels
  based on decision type
- Updated CHANGELOG.md per CONTRIBUTING.md requirements

ISSUES CLOSED: #5825
2026-04-10 18:57:41 +01:00
hurui200320 51aab18411 fix(testing): add guard logic to Robot tdd_expected_fail listener to prevent flaky CI
CI / benchmark-publish (pull_request) Has been skipped
CI / helm (pull_request) Successful in 26s
CI / lint (pull_request) Successful in 29s
CI / push-validation (pull_request) Successful in 28s
CI / quality (pull_request) Successful in 31s
CI / build (pull_request) Successful in 32s
CI / typecheck (pull_request) Successful in 59s
CI / security (pull_request) Successful in 59s
CI / e2e_tests (pull_request) Successful in 3m0s
CI / integration_tests (pull_request) Successful in 4m3s
CI / unit_tests (pull_request) Successful in 5m21s
CI / docker (pull_request) Successful in 1m19s
CI / coverage (pull_request) Successful in 10m25s
CI / status-check (pull_request) Successful in 1s
CI / push-validation (push) Successful in 17s
CI / build (push) Successful in 27s
CI / helm (push) Successful in 29s
CI / quality (push) Successful in 32s
CI / lint (push) Successful in 35s
CI / security (push) Successful in 51s
CI / typecheck (push) Successful in 51s
CI / benchmark-regression (push) Has been skipped
CI / e2e_tests (push) Successful in 3m7s
CI / integration_tests (push) Successful in 4m0s
CI / unit_tests (push) Successful in 4m54s
CI / docker (push) Successful in 21s
CI / coverage (push) Successful in 10m24s
CI / status-check (push) Successful in 1s
CI / benchmark-regression (pull_request) Successful in 59m2s
CI / benchmark-publish (push) Successful in 1h13m43s
Add three guard conditions to the Robot Framework tdd_expected_fail_listener
end_test() function, paralleling the Behave apply_tdd_inversion() guards in
features/environment.py. These guards prevent the listener from blindly
inverting ALL test failures to passes, which was masking infrastructure errors
and causing flaky CI behavior.

Guards added:
1. Setup/teardown error guard (_has_setup_teardown_failure): checks
   result.setup/teardown status and message prefix to detect infrastructure
   failures where the test body never executed.
2. Non-assertion failure guard (_is_infrastructure_error): checks
   result.message against known infrastructure error patterns (keyword
   resolution errors, Python exception types, network errors) to avoid
   inverting failures that are not the captured bug.
3. Dry-run guard: detects Robot Framework dry-run mode by checking if all
   body keywords have status NOT RUN, preventing meaningless inversions
   when no test actually executed.

Also fixes collateral issues exposed by the guards:
- Fixed Variable Should Exist syntax error in e2e test files (single space
  was being parsed as part of keyword name instead of separator)
- Removed tdd_expected_fail from 4 context assembly e2e tests where the
  bugs appear to be fixed (previously masked by syntax error + blind
  inversion)

ISSUES CLOSED: #5436
2026-04-10 05:21:24 +00:00
HAL9000 03e56f9e34 Merge branch 'master' into fix/container-instance-stop
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 41s
CI / quality (pull_request) Successful in 40s
CI / build (pull_request) Successful in 32s
CI / helm (pull_request) Successful in 34s
CI / push-validation (pull_request) Successful in 32s
CI / typecheck (pull_request) Successful in 56s
CI / security (pull_request) Successful in 1m21s
CI / e2e_tests (pull_request) Successful in 3m18s
CI / integration_tests (pull_request) Successful in 4m8s
CI / unit_tests (pull_request) Successful in 5m11s
CI / docker (pull_request) Successful in 1m20s
CI / coverage (pull_request) Successful in 10m47s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Successful in 58m21s
2026-04-10 00:18:30 +00:00
hamza.khyari 06428a5db6 feat(plan): implement git worktree sandbox for execute and merge-based apply
CI / push-validation (pull_request) Successful in 16s
CI / helm (pull_request) Successful in 23s
CI / build (pull_request) Successful in 24s
CI / lint (pull_request) Successful in 48s
CI / typecheck (pull_request) Successful in 53s
CI / security (pull_request) Successful in 53s
CI / quality (pull_request) Successful in 51s
CI / e2e_tests (pull_request) Successful in 3m27s
CI / integration_tests (pull_request) Successful in 7m14s
CI / unit_tests (pull_request) Successful in 8m34s
CI / docker (pull_request) Successful in 1m20s
CI / coverage (pull_request) Successful in 14m36s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 57m55s
Replace flat shutil.copy2 apply with spec-aligned git worktree flow
(specification.md §13225-13276):

Execute phase: creates an isolated git worktree via GitWorktreeSandbox
for the plan's linked git-checkout resource.  LLM file output is
written to the worktree and committed on branch
cleveragents/plan-<plan_id> — no merge yet.

Apply phase: merges the worktree branch into the project's current
branch via git merge.  Prints spec-aligned panels:
  - Apply Summary: Plan ID, artifacts count, insertions/deletions,
    project name, applied-at timestamp
  - Sandbox Cleanup: worktree removed, branch merged to main
  - Footer: ✓ OK Changes applied

Non-git projects (fs-directory resources) fall back to the original
flat directory sandbox with shutil.copy2.

Also fixes:
- context_tier_hydrator metadata types (int/float → string) that
  caused Pydantic validation errors during context assembly
- A2A facade duplicate execute dispatch (idempotent handler)
- Logs actual error from context assembly failures

ISSUES CLOSED: #4454
2026-04-09 14:17:50 +00:00
hamza.khyari 5d0e739e43 fix(acms): wire ACMS indexing pipeline into CLI so ContextTierService is populated during plan execution
CI / push-validation (pull_request) Successful in 23s
CI / helm (pull_request) Successful in 35s
CI / quality (pull_request) Successful in 38s
CI / typecheck (pull_request) Successful in 50s
CI / build (pull_request) Successful in 3m18s
CI / lint (pull_request) Successful in 3m20s
CI / integration_tests (pull_request) Successful in 3m57s
CI / security (pull_request) Successful in 4m4s
CI / e2e_tests (pull_request) Successful in 7m18s
CI / unit_tests (pull_request) Successful in 8m42s
CI / docker (pull_request) Successful in 1m19s
CI / coverage (pull_request) Successful in 13m34s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 56m55s
ContextTierService started empty on every CLI invocation, so the LLM
received zero file context during plan execution (bug #1028).

- Add context_tier_hydrator.py: reads files from linked project resources
  (via git ls-files or os.walk) and stores them as TieredFragment objects
  in the tier service.  Respects max file size (256 KB), total budget
  (10 MB), binary exclusion, and .git/node_modules/__pycache__ skipping.
- Wire hydration into LLMExecuteActor.execute() via lazy import (avoids
  M1 E2E regression from top-level import).
- Inject tier_service, project_repository, resource_registry into
  LLMExecuteActor from the DI container in _get_plan_executor().
- Add tier_service property to ExecutePhaseContextAssembler.
- Suppress exc_info traceback rendering in context warnings to prevent
  false-positive crash detection in M1 E2E tests.
- Add sandbox file-writing support in plan apply (path traversal guards,
  protected directory skipping).
- Add 6 Behave scenarios for context tier hydration.

Closes #1028
2026-04-09 13:00:47 +00:00
hurui200320 ee2024046f fix(plan): upsert action arguments during plan use to avoid UNIQUE constraint violation (#4197)
CI / lint (push) Successful in 37s
CI / quality (push) Successful in 53s
CI / typecheck (push) Successful in 57s
CI / security (push) Successful in 58s
CI / helm (push) Successful in 25s
CI / push-validation (push) Successful in 25s
CI / build (push) Successful in 30s
CI / integration_tests (push) Successful in 4m22s
CI / e2e_tests (push) Successful in 4m17s
CI / unit_tests (push) Successful in 5m10s
CI / docker (push) Successful in 1m30s
CI / coverage (push) Successful in 12m18s
CI / status-check (push) Successful in 1s
CI / benchmark-regression (push) Has been skipped
CI / benchmark-publish (push) Has been cancelled
## Summary

`agents plan use` crashed with `sqlite3.IntegrityError: UNIQUE constraint failed: action_arguments.action_name, action_arguments.name` when the action had arguments already registered via `action create`. The root cause was `ActionRepository.update()` using SQLAlchemy's relationship `.clear()` + `.append()` pattern, which deferred the DELETE and processed the INSERT first — triggering a UNIQUE constraint violation when the same `(action_name, name)` pair was being re-inserted.

## Approach

Replace the `.clear()` + `.append()` pattern with explicit bulk `sa_delete()` + `session.flush()` before re-inserting child rows for both `action_arguments` and `action_invariants`. After the flush, expire the relationship collections with `session.expire(row, ["arguments_rel", "invariants_rel"])` so SQLAlchemy reloads from the now-empty database state before appending replacements. This avoids stale identity map references and guarantees the DELETE is committed before any INSERT.

## Key Changes

### Bug fix (`src/cleveragents/infrastructure/database/repositories.py`)
- `ActionRepository.update()` now uses `sa_delete(ActionArgumentModel)` and `sa_delete(ActionInvariantModel)` with `synchronize_session=False`, followed by `session.flush()`, before re-inserting child rows.
- Targeted `session.expire(row, ["arguments_rel", "invariants_rel"])` replaces the removed `.clear()` calls to force collection reload.

### Schema parity (`src/cleveragents/infrastructure/database/models.py`)
- Added `UniqueConstraint("action_name", "position")` to `ActionInvariantModel`.
- Added `UniqueConstraint("action_name", "name")`, `CheckConstraint` for `arg_type`, and `CheckConstraint` for `requirement` to `ActionArgumentModel`.

### Alembic migration (`alembic/versions/a5_006_action_invariants_unique_constraint.py`)
- New migration adds all four constraints to both `action_invariants` and `action_arguments` tables.
- Includes deduplication guards and data normalization so the upgrade succeeds on existing databases with invalid or duplicate rows.
- Uses `batch_alter_table` for SQLite compatibility.

### Tests
- **Behave** (`features/plan_use_action_args_integrity.feature`): 6 scenarios covering the core bug path, zero-argument regression, multiple arguments, reusable action double-use, non-reusable action archival with invariants, and direct repository update.
- **Robot** (`robot/plan_use_action_args_integrity.robot`): Integration test mirroring the Behave scenarios via a helper script.
- **Shared factory** (`features/mocks/test_uow_factory.py`): Extracted `build_test_uow()` from both test suites into a single shared module to eliminate duplication (DRY).

### Minor
- Updated `src/cleveragents/domain/repositories/__init__.py` docstring from table format to bullet list (conflict resolution from rebase).

Closes #4174

Reviewed-on: #4197
Reviewed-by: HAL 9000 <HAL9000@cleverthis.com>
Co-authored-by: Rui Hu <rui.hu@cleverthis.com>
Co-committed-by: Rui Hu <rui.hu@cleverthis.com>
2026-04-09 06:11:39 +00:00
freemo 8ea00f5185 fix: restore CI quality tests to passing state (#4175)
CI / unit_tests (push) Has been cancelled
CI / benchmark-publish (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / typecheck (push) Has been cancelled
CI / security (push) Has been cancelled
CI / quality (push) Has been cancelled
CI / integration_tests (push) Has been cancelled
CI / e2e_tests (push) Has been cancelled
CI / coverage (push) Has been cancelled
CI / benchmark-regression (push) Has been cancelled
CI / build (push) Has been cancelled
CI / push-validation (push) Has been cancelled
CI / status-check (push) Has been cancelled
CI / docker (push) Has been cancelled
CI / helm (push) Has been cancelled
Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-08 11:02:14 +00:00
freemo 225eab25b1 fix(cli): change agents validation attach extra args to use --key value named option format (#3837)
ci.yml / fix(cli): change `agents validation attach` extra args to use `--key value` named option format (#3837) (push) Failing after 0s
Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-06 07:55:09 +00:00
freemo 36fb867830 fix(acms): invoke SkeletonCompressor in ContextAssembler.assemble() to propagate skeleton context to child plans
ci.yml / fix(acms): invoke SkeletonCompressor in ContextAssembler.assemble() to propagate skeleton context to child plans (push) Failing after 0s
Reviewed and APPROVED. Critical bug fix. Closes #3563.
2026-04-05 21:31:14 +00:00