Files
cleveragents-core/robot/builtin_adapter.robot
brent.edwards 01b6eb1804
CI / build (push) Successful in 17s
CI / helm (push) Successful in 22s
CI / lint (push) Successful in 28s
CI / typecheck (push) Successful in 47s
CI / benchmark-regression (push) Has been skipped
CI / quality (push) Successful in 3m49s
CI / security (push) Successful in 4m11s
CI / unit_tests (push) Successful in 9m19s
CI / docker (push) Successful in 1m22s
CI / coverage (push) Successful in 12m35s
CI / e2e_tests (push) Successful in 16m17s
CI / integration_tests (push) Successful in 25m5s
CI / status-check (push) Successful in 2s
CI / benchmark-publish (push) Successful in 28m31s
feat(autonomy): parallel execution scales to 10+ concurrent subplans (#1201)
## Summary

Add M6 parallel-scaling coverage for 10+ concurrent subplans:

- **15-subplan parallel scenario** with explicit peak-concurrency bound checks (`max_parallel=10`) and thread-safe concurrency tracking via `_build_executor()`.
- **Deep hierarchical decomposition** coverage (4+ levels) with adjusted leaf condition that only stops early when hitting `max_depth` or when the workset is trivially small (`min_files_per_subplan`).
- **Non-progress guard** in `_build_hierarchy` to prevent pathological recursion when clustering cannot meaningfully split the file set.
- **Small-project regression test** (< 50 files) verifying decomposition depth does not increase unexpectedly with the relaxed leaf condition.
- **ASV benchmark** for 15-subplan parallel execution with `max_parallel=10` to track scaling behavior.

### Removed from this PR

The `_build_hierarchy` child-linkage correctness fix (returning `node_id` from recursive calls instead of using `nodes[-1].node_id`) has been **removed** per review feedback — it is a separate bug fix and will be submitted as an independent issue/PR per CONTRIBUTING.md §Atomic Commits.

## Approach

- **Concurrency tracking:** The `_build_executor()` closure in step definitions detects `context.concurrency_counter` / `context.concurrency_lock` and performs thread-safe peak tracking in a try/finally block.
- **Leaf condition:** Replaced the `max_files_per_subplan` / `max_tokens_per_subplan` leaf check with a `min_files_per_subplan` check to allow deeper decomposition for large projects. Added a non-progress guard so clustering that cannot split the file set terminates immediately rather than recursing to `max_depth`.
- **Deterministic IDs:** `_ids_for_count()` preserves legacy fixed IDs for the first 5 subplans and generates additional deterministic IDs for scale scenarios.

## Validation

### Passing
- `nox -s lint` — all checks passed
- `nox -s typecheck` — 0 errors, 0 warnings
- `nox -s unit_tests` — 12,988 scenarios passed, 0 failed
- `nox -s coverage_report` — 97% (passes `--fail-under=97`)

Closes #855

Reviewed-on: #1201
Co-authored-by: Brent E. Edwards <brent.edwards@cleverthis.com>
Co-committed-by: Brent E. Edwards <brent.edwards@cleverthis.com>
2026-03-31 23:57:39 +00:00

52 lines
2.5 KiB
Plaintext

*** Settings ***
Documentation Integration tests for BuiltinAdapter and MCP resource slot inference
Resource ${CURDIR}/common.resource
Suite Setup Setup Test Environment
Suite Teardown Cleanup Test Environment
*** Variables ***
${HELPER_SCRIPT} robot/helper_builtin_adapter.py
*** Test Cases ***
BuiltinAdapter Discover Returns All Tools
[Documentation] BuiltinAdapter.discover() returns all built-in tool specs
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} discover
... cwd=${WORKSPACE} on_timeout=kill timeout=120s
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} discover-ok
BuiltinAdapter Register Populates Registry
[Documentation] BuiltinAdapter.register() populates a ToolRegistry with all tools
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} register
... cwd=${WORKSPACE} on_timeout=kill timeout=120s
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} register-ok
BuiltinAdapter Tools Have Builtin Source
[Documentation] All tools registered via BuiltinAdapter have source=builtin
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} source
... cwd=${WORKSPACE} on_timeout=kill timeout=120s
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} source-ok
MCP Resource Slot Inference For File Path
[Documentation] MCP infer_resource_slots creates file slot from file_path param
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} mcp_file
... cwd=${WORKSPACE} on_timeout=kill timeout=120s
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} mcp-file-ok
MCP Resource Slot Inference For Directory
[Documentation] MCP infer_resource_slots creates directory slot from directory param
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} mcp_dir
... cwd=${WORKSPACE} on_timeout=kill timeout=120s
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} mcp-dir-ok
MCP Resource Slot Inference For Repo Path
[Documentation] MCP infer_resource_slots creates repository slot from repo_path param
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} mcp_repo
... cwd=${WORKSPACE} on_timeout=kill timeout=120s
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} mcp-repo-ok