fix(agents/graphs/plan_generation): _validate always passes for code longer than 10 characters, making LLM validation ineffective #10876

Merged
HAL9000 merged 4 commits from pr-fix-10746 into master 2026-06-15 03:24:22 +00:00

4 Commits

Author SHA1 Message Date
controller-ci-rerun df3aa5636b chore: re-trigger CI [controller]
CI / helm (pull_request) Successful in 42s
CI / lint (pull_request) Successful in 44s
CI / build (pull_request) Successful in 53s
CI / push-validation (pull_request) Successful in 30s
CI / quality (pull_request) Successful in 1m5s
CI / typecheck (pull_request) Successful in 1m11s
CI / security (pull_request) Successful in 1m12s
CI / unit_tests (pull_request) Successful in 5m34s
CI / integration_tests (pull_request) Successful in 8m42s
CI / docker (pull_request) Successful in 1m41s
CI / coverage (pull_request) Successful in 10m13s
CI / status-check (pull_request) Successful in 3s
2026-06-14 22:53:22 -04:00
HAL9000 df298f3a3b fix(agents/graphs/plan_generation): fix Behave step definitions to use FakeListLLM and patch.object
- Replace MagicMock() LLM with FakeListLLM (a proper LangChain Runnable)
  to avoid TypeError when PromptTemplate.__or__ evaluates the chain expression
- Use patch.object() context manager to mock _chain_with_retry cleanly
- Fix type annotations from lowercase any to typing.Any
- Separate validation response setup from chain mocking for cleaner test flow

ISSUES CLOSED: #10746
2026-06-14 22:53:22 -04:00
HAL9000 008684737e fix(agents/graphs/plan_generation): _validate always passes for code longer than 10 characters, making LLM validation ineffective
Fix duplicate step_impl function names in Behave test steps that caused
only the last-defined step to be registered with Behave, making all
scenarios fail with undefined step errors. Each step now has a unique
function name following the step_given/step_when/step_then convention.

Also fix the step parameter handling: Gherkin passes quoted string
parameters with their surrounding quotes included, so strip quotes from
the response and status parameters before comparison.

Remove the redundant if/else branch in the validation node step that
called the same code path in both branches.

Add CHANGELOG entry for the fix.

ISSUES CLOSED: #10746
2026-06-14 22:53:22 -04:00
HAL9000 e8e76702a9 fix(agents/graphs/plan_generation): _validate always passes for code longer than 10 characters, making LLM validation ineffective
Remove the len(all_code) > 10 fallback in the _validate method that
was overriding the LLM validation response. Previously, any code longer
than 10 characters would cause validation to automatically pass regardless
of the LLM's assessment, making the validation check ineffective.

The fix ensures validation status is determined solely by whether the LLM
response contains 'PASS', making the validation meaningful.

A regression test was added to verify that FAIL/REJECTED LLM responses
are properly handled even for long code blocks.

ISSUES CLOSED: #10746
2026-06-14 22:50:43 -04:00