Skip to content

fix(flows): preserve code execution continuation - #7003

Open
saransh-translucent wants to merge 1 commit into
google:mainfrom
saransh-translucent:fix/code-execution-stop-continuation
Open

fix(flows): preserve code execution continuation#7003
saransh-translucent wants to merge 1 commit into
google:mainfrom
saransh-translucent:fix/code-execution-stop-continuation

Conversation

@saransh-translucent

Copy link
Copy Markdown

Link to Issue or Description of Change

Problem:

The non-built-in code-execution response processor intentionally clears llm_response.content after emitting a sandbox result so the LLM loop continues. The genuine-empty-STOP guard currently runs after response processors, mistakes that internal continuation sentinel for a provider-empty response, and emits MODEL_RETURNED_NO_CONTENT before the model can produce its final answer.

Solution:

Classify genuine non-streaming empty STOP responses before response processors run. This keeps the existing provider-empty error while allowing processor-cleared code-execution responses to continue the loop.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.
$ .venv/bin/pytest tests/unittests/flows/llm_flows/test_base_llm_flow.py -q
101 passed, 8 warnings in 2.55s

The new regression test uses a deterministic two-response model and a recording non-built-in executor. It verifies that the code executes, a second model call occurs, the final response is emitted, and no MODEL_RETURNED_NO_CONTENT event appears. The existing genuine-empty response regression test remains green.

Manual End-to-End (E2E) Tests:

The same test drives the public in-memory Runner through the complete model → code executor → execution result → second model call → final response flow without external model or customer data.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

This is a processor-ordering fix. It does not suppress genuine empty model responses and does not change SSE terminal-chunk handling.

@google-cla

google-cla Bot commented Sep 3, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@saransh-translucent
saransh-translucent force-pushed the fix/code-execution-stop-continuation branch from e3517aa to cba407f Compare September 3, 2026 16:42
Validate genuinely empty STOP responses before response processors mutate the
response so the sandbox continuation sentinel remains intact.

Closes google#7002
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code execution continuation is misclassified as MODEL_RETURNED_NO_CONTENT

2 participants