15 Commits

Author SHA1 Message Date
HAL9000 6141d2a36d fix(agents/graphs): unblock TDD validate tests + read-only _should_retry + max_context_files
CI / lint (pull_request) Successful in 42s
CI / quality (pull_request) Successful in 1m2s
CI / security (pull_request) Successful in 1m12s
CI / typecheck (pull_request) Successful in 1m19s
CI / build (pull_request) Successful in 47s
CI / helm (pull_request) Successful in 51s
CI / push-validation (pull_request) Successful in 25s
CI / unit_tests (pull_request) Successful in 5m57s
CI / docker (pull_request) Successful in 1m40s
CI / integration_tests (pull_request) Successful in 9m35s
CI / coverage (pull_request) Successful in 12m42s
CI / status-check (pull_request) Successful in 4s
- features/steps/tdd_plan_generation_validate_steps.py: drop duplicate
  @given/@then registrations (live in plan_generation_langgraph_coverage_
  steps.py; redefinition caused AmbiguousStep errors crashing all 8
  behave-parallel workers); have the @when step feed the docstring as the
  FakeListLLM response so each scenario tests _validate()'s parsing of a
  specific PASS/FAIL signal rather than the input code.
- features/tdd_plan_generation_validate_logic.feature: add the required
  @tdd_issue tag alongside @tdd_issue_10746 (enforced by
  features/environment.py); tighten scenario 4 wording to remove the
  reference to the obsolete length guard.
- robot/plan_generation_graph.robot: drop assertion for handle_retry node
  (retry is a conditional edge, not a fifth node) and update node-count
  check from 5 to 4; update Should Retry test to assert _should_retry does
  NOT mutate state (read-only contract for LangGraph conditional edges).
- src/cleveragents/agents/graphs/plan_generation.py:
  * _validate: persist retry_count increment in return dict (FAIL path and
    exception path) so LangGraph propagates it through the state graph.
  * _should_retry: remove state mutation (conditional-edge functions are
    read-only in LangGraph; mutations were silently dropped, causing
    retry_count to remain 0 forever and the graph to loop infinitely).
    Adjust comparison to retry_count <= max_retries because _validate has
    already incremented before _should_retry runs.
  * __init__: add max_context_files parameter (default 5, validated > 0)
    and wire it into _format_context_summary in place of the hardcoded 5,
    implementing the configurable-limits contract tested by
    features/agent_configurable_limits.feature.

ISSUES CLOSED: #10746
2026-06-14 16:34:44 -04:00
brent.edwards d31d9226f9 test(wf10_batch.robot): request that LLM not create files (#11133)
CI / push-validation (push) Successful in 32s
CI / helm (push) Successful in 44s
CI / build (push) Successful in 1m17s
CI / lint (push) Successful in 1m31s
CI / e2e_tests (push) Successful in 1m43s
CI / quality (push) Successful in 1m59s
CI / typecheck (push) Successful in 2m17s
CI / benchmark-regression (push) Failing after 40s
CI / security (push) Successful in 2m18s
CI / integration_tests (push) Successful in 3m45s
CI / unit_tests (push) Successful in 6m52s
CI / docker (push) Successful in 2m0s
CI / coverage (push) Successful in 12m43s
CI / status-check (push) Successful in 8s
CI / benchmark-publish (push) Successful in 1h23m7s
Closes: #11007

## Description

Asks LLM to not create files.

## Type of Change

- [ X ] Bug fix (non-breaking change which fixes an issue)
- [ X ] Test improvements

## Quality Checklist

- [ ] Code follows the project's coding standards (see CONTRIBUTING.md)
- [ ] All public/protected methods have argument validation
- [ ] Static typing is complete (no `Any` unless justified)
- [ ] `nox -s typecheck` passes with no errors
- [ ] `nox -s lint` passes with no errors
- [ ] Unit tests written/updated (Behave scenarios in `features/`)
- [ ] Integration tests written/updated (Robot suites in `robot/`) if applicable
- [ ] Coverage remains above 85% (`nox -s coverage_report`)
- [ ] No security issues introduced (`nox -s security_scan`)
- [ ] No dead code introduced (`nox -s dead_code`)
- [ ] Documentation updated if behavior changed

## Testing

Running in git.cleverthis.com is the only real test possible.

### Test Commands Run

```bash
nox -s unit_tests       # Behave tests
nox -s typecheck        # Type checking
nox -s lint             # Linting
nox -s coverage_report  # Coverage
```

## Related Issues

Closes #11007

Reviewed-on: #11133
Reviewed-by: Hamza Khyari <hamza.khyari@cleverthis.com>
2026-05-13 23:39:15 +00:00
hurui200320 9fe69c468c test(plan): add tdd issue-capture test for cleanup_stale destroying execute output before apply
Add two Behave scenarios tagged @tdd_issue, @tdd_issue_11121, and @tdd_expected_fail
that capture bug #11121: _create_sandbox_for_plan() calls
GitWorktreeSandbox.cleanup_stale() unconditionally on every execute invocation,
including when the plan is already in execute/complete state awaiting apply.

Scenario 1 asserts that the cleveragents/plan-<id> branch survives a second call
to _create_sandbox_for_plan() on an execute/complete plan. This assertion fails
because cleanup_stale deletes the branch regardless of plan state.

Scenario 2 asserts that plan apply would find at least one artifact after a
re-invoked execute on an execute/complete plan. This assertion fails because the
branch (holding execute output) was destroyed by cleanup_stale.

Both scenarios use @tdd_expected_fail so CI passes while the bug is unfixed.
The @mock_only tag ensures no database is created for these git-only tests.
The companion fix is tracked in issue #11121.

Additional CI fixes bundled in this commit:

- Fixed PlanGenerationGraph recursion bug: _should_retry() was mutating state
  in-place but LangGraph conditional edge functions cannot persist state
  mutations. Replaced with a proper _handle_retry() node that increments
  retry_count via state returns, resolving the GraphRecursionError that was
  crashing the integration tests. Updated the graph to include handle_retry
  as the 5th node, routing validate→should_retry→handle_retry→analyze.

- Fixed TDD quality gate (scripts/tdd_quality_gate.py): Renamed @tdd_bug_N
  tags to @tdd_issue_N to match the CONTRIBUTING.md specification. Added
  _diff_is_tdd_issue_capture() detection so that TDD issue-capture PRs
  (which add @tdd_expected_fail rather than remove it) pass the quality gate
  correctly. Updated all related tests (Behave unit tests, Robot integration
  tests, and test helpers) to use the new tag naming.

ISSUES CLOSED: #11120
2026-05-12 16:57:50 +08:00
hurui200320 d25a060c58 Revert "feat(ci): implement TDD bug tag quality gate for bug fix PRs"
CI / lint (pull_request) Successful in 50s
CI / quality (pull_request) Successful in 1m2s
CI / push-validation (pull_request) Successful in 39s
CI / helm (pull_request) Successful in 43s
CI / typecheck (pull_request) Successful in 1m31s
CI / security (pull_request) Successful in 1m32s
CI / build (pull_request) Successful in 1m3s
CI / integration_tests (pull_request) Successful in 3m42s
CI / unit_tests (pull_request) Successful in 6m13s
CI / docker (pull_request) Successful in 2m2s
CI / coverage (pull_request) Successful in 11m15s
CI / status-check (pull_request) Successful in 3s
CI / build (push) Successful in 53s
CI / lint (push) Successful in 1m1s
CI / helm (push) Successful in 26s
CI / quality (push) Successful in 1m16s
CI / typecheck (push) Successful in 1m20s
CI / security (push) Successful in 1m37s
CI / benchmark-regression (push) Failing after 40s
CI / push-validation (push) Successful in 21s
CI / integration_tests (push) Successful in 3m17s
CI / unit_tests (push) Successful in 4m28s
CI / e2e_tests (push) Successful in 3m22s
CI / docker (push) Successful in 1m52s
CI / coverage (push) Successful in 12m50s
CI / status-check (push) Successful in 3s
CI / benchmark-publish (push) Successful in 1h20m0s
This reverts commit e8d2f76466.
2026-05-12 08:30:24 +00:00
freemo b122ec7ed5 fix(test-infra): remove redundant ${PYTHON} variable definitions from robot files
CI / lint (pull_request) Successful in 23s
CI / quality (pull_request) Successful in 51s
CI / typecheck (pull_request) Successful in 1m0s
CI / security (pull_request) Successful in 55s
CI / build (pull_request) Successful in 25s
CI / helm (pull_request) Successful in 32s
CI / push-validation (pull_request) Successful in 26s
CI / e2e_tests (pull_request) Successful in 3m38s
CI / integration_tests (pull_request) Successful in 6m42s
CI / unit_tests (pull_request) Successful in 8m19s
CI / docker (pull_request) Successful in 13s
CI / coverage (pull_request) Successful in 15m23s
CI / status-check (pull_request) Successful in 2s
Remove the local ${PYTHON}    python (and python3) variable definitions from
the *** Variables *** sections of all affected robot files. These local
definitions were overriding the pabot-injected venv Python path passed via
--variable PYTHON:/path/to/venv/python, causing tests to use the system
Python (which lacks required packages like structlog, sqlalchemy, etc.)
instead of the nox venv Python.

The correct ${PYTHON} value is already set by Setup Test Environment in
common.resource via sys.executable, and pabot passes it via --variable.
The local fallback definitions are redundant and harmful in parallel runs.

Audit found 56 robot files with the pattern (more than the 9 originally
identified in the issue). All occurrences have been removed.

ISSUES CLOSED: #1309
2026-04-14 14:50:55 +00:00
brent.edwards 3eecb79003 test(plan): TDD failing tests for checkpoint real rollback (bug #822)
CI / lint (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 46s
CI / typecheck (pull_request) Successful in 56s
CI / security (pull_request) Successful in 56s
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 29s
CI / e2e_tests (pull_request) Successful in 2m7s
CI / unit_tests (pull_request) Successful in 3m8s
CI / docker (pull_request) Successful in 9s
CI / integration_tests (pull_request) Successful in 3m57s
CI / coverage (pull_request) Successful in 7m48s
CI / benchmark-regression (pull_request) Successful in 40m48s
TDD expected-fail tests proving bug #822 exists:
CheckpointService.rollback_to_checkpoint() returns a successful
RollbackResult but does not execute git reset --hard. Files modified
after the checkpoint remain unchanged after rollback.

Also fixes Robot Framework timeout robustness across the entire test
suite: all Run Process calls now use on_timeout=kill (prevents
SIGTERM-induced -15 exit codes under CI load) and timeouts increased
to 120s (prevents premature kills during heavy parallel execution).

ISSUES CLOSED: #839
2026-03-16 01:45:50 +00:00
freemo a074b4846f fix(provider): remove FakeListLLM defaults
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 19s
CI / quality (pull_request) Successful in 28s
CI / security (pull_request) Successful in 50s
CI / typecheck (pull_request) Successful in 56s
CI / integration_tests (pull_request) Successful in 4m51s
CI / unit_tests (pull_request) Successful in 19m29s
CI / docker (pull_request) Successful in 39s
CI / benchmark-regression (pull_request) Successful in 26m10s
CI / coverage (pull_request) Successful in 47m42s
CI / lint (push) Successful in 13s
CI / quality (push) Successful in 17s
CI / build (push) Successful in 23s
CI / typecheck (push) Successful in 30s
CI / security (push) Successful in 30s
CI / benchmark-regression (push) Has been skipped
CI / integration_tests (push) Successful in 2m52s
CI / unit_tests (push) Successful in 10m8s
CI / docker (push) Successful in 1m19s
CI / benchmark-publish (push) Successful in 11m54s
CI / coverage (push) Failing after 39m51s
Remove FakeListLLM as a silent fallback in agent graph constructors
(plan_generation.py, context_analysis.py, auto_debug.py). All three now
raise ValueError when llm=None, making missing-provider errors explicit.

Add Settings.mock_providers flag and validate_provider_availability()
method. Update container.get_ai_provider() to check Settings.mock_providers
first, with env-var fallback for backward compatibility.

Add resolve_provider_by_name() helper to the provider registry and export
it from cleveragents.providers. Add structlog trace logging to
ProviderRegistry.get_default_provider_type() to record selection reasoning.

Update all existing behave step files, robot tests, and benchmarks that
relied on the implicit FakeListLLM default to pass an explicit LLM
instance instead.

Add new BDD tests (features/provider_fixes.feature with 17 scenarios),
Robot Framework integration tests (robot/provider_detection_smoke.robot),
and ASV benchmarks (benchmarks/provider_selection_bench.py).

ISSUES CLOSED: #323
2026-02-27 09:47:10 -05:00
brent.edwards e8aa5ac268 fix(ci): restore venv PATH, use absolute resource paths, and add timeouts in robot tests
CI / lint (pull_request) Successful in 15s
CI / typecheck (pull_request) Successful in 28s
CI / security (pull_request) Successful in 21s
CI / quality (pull_request) Successful in 15s
CI / integration_tests (pull_request) Failing after 6m25s
CI / build (pull_request) Successful in 15s
CI / unit_tests (pull_request) Successful in 6m52s
CI / docker (pull_request) Successful in 9s
CI / coverage (pull_request) Successful in 5m5s
- Restore session.env["PATH"] in integration_tests nox session to ensure
  Run Process uses venv Python instead of system Python
- Convert bare Resource references to ${CURDIR}/ absolute paths across
  30 robot files to fix CI resolution failures
- Add timeout=30s to all Run Process calls in rxpy_route_validation.robot
  to prevent hanging tests
- Tag 2 rxpy tests as slow (require running actors unavailable on CI)
- Fix LangGraph test to use correct config file (LANGGRAPH_CONFIG)
- All 204 tests pass (4 excluded: 2 slow + 2 discovery)
2026-02-13 02:42:57 +00:00
brent.edwards e5b1b04ec6 test(integration_tests-3.13): fix nox tests
CI / lint (pull_request) Successful in 15s
CI / typecheck (pull_request) Successful in 28s
CI / security (pull_request) Successful in 18s
CI / quality (pull_request) Successful in 16s
CI / integration_tests (pull_request) Failing after 2m33s
CI / build (pull_request) Successful in 15s
CI / unit_tests (pull_request) Failing after 5m42s
CI / docker (pull_request) Has been skipped
CI / coverage (pull_request) Has been cancelled
`integration_tests-3.13` was failing; it is now passing.
2026-02-12 22:48:19 +00:00
freemo 162b1e35d0 Build: Made Robot integration tests run in parallel 2025-12-20 10:28:51 -05:00
freemo 07fbe7afaf Feat: Integrated PlanGenerationGraph for Context loading, added EntityMemory for project tracking 2025-12-10 18:39:00 -05:00
freemo adf04a7b60 Tests: fixed some minor bugs in our tests 2025-11-25 01:07:09 -05:00
freemo 496f565a57 Chore: Completed stage 1.5 2025-11-24 20:04:18 -05:00
freemo af5093c881 Chore: Got code coverage up to 98% 2025-11-19 22:40:53 -05:00
freemo a47abd20b2 Feat: Added plan generation module 2025-11-18 21:39:03 -05:00