Repository navigation
fix(workflow): exclude thoughts from typed node inputs - #7456
Open
BlueRaddish wants to merge 1 commit into
Open
BlueRaddish wants to merge 1 commit into
BlueRaddish wants to merge 1 commit into
Conversation
Use the existing answer-text helper for schema validation and function argument coercion so thoughts do not invalidate JSON or enter string input. Cover both routes through real workflow execution and focused schema tests. Assisted-by: OpenAI Codex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to Issue or Description of Change
Problem: A workflow node output can contain model thought parts followed by the final text or JSON answer. Typed Content conversion currently concatenates both. A downstream
strfunction receives the thought text, while a BaseModel function fails validation even when the answer alone is valid JSON.Reproduction: On main
7d8c9502f924ed5e7a1ab00dc1f5a603e858abc3, run a real Workflow through Runner with a producer returningEvent(output=Content(parts=[Part(text="Let me think first.", thought=True), Part(text=answer)])), followed by a typed function. The string case receivesLet me think first.hello; the structured case reportsmodel_typevalidation failure before the function runs. No LLM is needed to reproduce the conversion defect.Expected behavior: Typed values contain the answer text. Callers explicitly requesting
types.Contentstill receive the full Content.Solution: Reuse the existing thought-filtering
extract_text_from_contenthelper in shared schema validation and FunctionNode argument conversion. Preserve existing warnings for discarded media parts and the handling of ordinary multipart text.Testing Plan
Unit Tests:
The six regression cases fail before the fix and pass after it: string/structured schema conversion with both preserve_content settings, plus real workflow string and BaseModel inputs. Existing ordinary multipart-text, media warning, and schema conversion cases remain green. All native pre-commit hooks pass.
Manual End-to-End (E2E) Tests: The two new workflow cases execute real Workflow, FunctionNode, Runner, InMemorySessionService, and invariant checking through
run_workflow. Before: thought text leaks into the string input and valid JSON input fails. After: the functions receivehelloand_OutputModel(name='test', value=42), respectively. The setup is deterministic and performs no model or network calls.Checklist
Additional context
No public signatures, dependencies, or prompt behavior change. Full multi-version tox and the entire repository test suite were not run locally; the focused suite and native hooks above were run. Separate pending PRs #7430 (null preservation) and #6750 (JSON-mode serialization) touch schema utilities but do not address thought extraction; their actual diffs were checked. The earlier #7452 addresses debug printing and is independent of this workflow conversion fix.
Prepared with assistance from OpenAI Codex.