Files
cleveragents-core/robot/actor_compiler.robot
T
HAL9000 5db663cb63 fix(actor): read actor_ref from NodeDefinition field in _detect_subgraph_cycles
Fix cross-actor subgraph cycle detection in the actor compiler by reading
actor_ref from the top-level NodeDefinition field instead of the config dict.

The _detect_subgraph_cycles(), _map_node(), and compile_actor() functions
were all reading node.config.get("actor_ref", "") instead of node.actor_ref.
Because actor_ref is a typed, validated Pydantic field on NodeDefinition (not
a key inside the untyped config dict), the old code always returned an empty
string, causing cross-actor cycle detection to silently fail and leaving the
system vulnerable to infinite recursion at runtime.

Changes:
- Fix all three call sites in src/cleveragents/actor/compiler.py
- Add Behave regression tests (features/actor_subgraph_cycle_detection.feature)
  with @tdd_issue and @tdd_issue_1431 tags on all scenarios
- Add Robot Framework integration test (robot/actor_compiler.robot)
- Fix existing test helpers to use actor_ref as top-level field
- Add CHANGELOG entry

ISSUES CLOSED: #1431
2026-05-06 04:08:25 +00:00

57 lines
2.7 KiB
Plaintext

*** Settings ***
Documentation Smoke tests for the Actor Compiler (GRAPH → LangGraph)
Resource ${CURDIR}/common.resource
Suite Setup Setup Test Environment
Suite Teardown Cleanup Test Environment
*** Variables ***
${HELPER} ${CURDIR}/helper_actor_compiler.py
*** Test Cases ***
Compile Simple Graph Actor YAML
[Documentation] Compile the simple_graph example and verify node/edge counts
[Tags] slow
${result}= Run Process ${PYTHON} ${HELPER} compile ${CURDIR}/../examples/actors/simple_graph.yaml cwd=${WORKSPACE}
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} actor-compiler-ok
Compile Graph Workflow Actor YAML
[Documentation] Compile the graph_workflow example and verify success
[Tags] slow
${result}= Run Process ${PYTHON} ${HELPER} compile ${CURDIR}/../examples/actors/graph_workflow.yaml cwd=${WORKSPACE}
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} actor-compiler-ok
Retrieve Compilation Metadata
[Documentation] Verify metadata output from the compiler contains node IDs
[Tags] slow
${result}= Run Process ${PYTHON} ${HELPER} metadata ${CURDIR}/../examples/actors/simple_graph.yaml cwd=${WORKSPACE}
Log ${result.stdout}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} actor-compiler-metadata
Reject LLM Actor Compilation
[Documentation] Attempt to compile an LLM-type actor and expect failure
[Tags] slow
${result}= Run Process ${PYTHON} ${HELPER} compile-fail ${CURDIR}/../examples/actors/simple_llm.yaml cwd=${WORKSPACE}
Log ${result.stdout}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} actor-compiler-expected-fail
Should Contain ${result.stdout} GRAPH
Detect Cross-Actor Subgraph Cycle Via actor_ref Field
[Documentation] Verify that mutually-referencing actors raise SubgraphCycleError.
... This is the regression test for issue #1431: _detect_subgraph_cycles()
... was reading node.config.get("actor_ref") instead of node.actor_ref,
... causing cycle detection to silently fail.
[Tags] slow
${result}= Run Process ${PYTHON} ${HELPER} cycle-detect dummy cwd=${WORKSPACE}
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} actor-compiler-cycle-detected