test(runner): cover node-runtime behaviors #1103
Draft
wolo-lab wants to merge 3 commits into
Draft
Conversation
Port the runner-level node behaviors from adk-python's tests/unittests/runners/test_runner_node.py to run_node_test.go. adk-go has no Runner(node=...) constructor, so each case drives a node graph wrapped in a workflowagent (or an LlmAgent root) through the same node runtime. Covers behaviors adk-go already implements: terminal output plus persistence, error propagation, event accumulation across turns, yield_user_message default-off, state delta applied before the node and the LlmAgent run and surfaced on the user event, and plain text not triggering resume. Also adds two characterization tests guarding an intentional divergence from adk-python: adk-go accepts a resume message that mixes a function response with text and tolerates a function response with no matching call, because the A2A flow resumes a paused task by sending the human's reply text alongside the approval response in one message (agent/remoteagent/v2/a2a_e2e_test.go).
3eab9c4 to
ee46a28
Compare
Address review feedback on the comments added in the previous commit: - YieldUserMessageFalseByDefault: the doc said the user event "is persisted but not yielded" but only the not-yielded half was checked; add a session-history assertion (sessionHasUserText) so the comment is backed by a check. - StateDeltaAppliedBeforeLlmAgentRuns: the before-agent callback returns content and short-circuits the agent, so the model is never consulted; reword the comment to stop implying it runs after. - AllowsMixedFunctionResponseAndText: assert the model is actually consulted (fresh run yields "handled") instead of only checking for no error, matching the sibling ToleratesUnmatchedFunctionResponse test and making newPermissiveAgent's doc honest. Drops the now-unused collectRunError helper. - Replace the bespoke errNode string type with errors.New; nothing type- asserts it, and fix its comment wording.
Drop the floating "the tests below" block comment: the "below" anchor rots the moment a test is appended, and the adk-python provenance it carried already lives in the PR description rather than belonging in the code. Keep the one piece of in-code value (why node graphs are wrapped in a workflowagent, since adk-go has no Runner(node=...) constructor) by folding it into the newUpperWorkflowAgent doc comment.
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.
Summary
Ports the runner-level node behaviors from adk-python's
tests/unittests/runners/test_runner_node.pyinto adk-go'srunner/run_node_test.go, to confirm behavioral parity around therun_nodepath inrunners.py. adk-go has noRunner(node=...)constructor, so each case drives a node graph wrapped in a
workflowagent(or a plainLlmAgentroot) through the same noderuntime.
Test-only change — no production code is touched.
What's covered
Behaviors adk-go already implements correctly (now verified at the
runner level):
Runyield_user_messagedefaulting to offWithStateDeltaapplied to session state before the node /LlmAgentruns, and surfaced on the yielded user event
Intentional divergence (guarded by characterization tests)
adk-python's
Runner._run_node_asyncrejects malformed resume messages(
test_mixed_fr_and_text_raises,test_resume_raises_on_unmatched_fr,test_resume_raises_on_multi_invocation_fr). adk-go is deliberately morepermissive: the A2A flow resumes a paused task by sending the human's
reply text alongside the approval function response in a single
message (
agent/remoteagent/v2/a2a_e2e_test.go,msg3), andbuildResumeResponsesignores responses that answer no pendinginterrupt.
Two characterization tests (
TestRunner_Node_AllowsMixedFunctionResponseAndText,TestRunner_Node_ToleratesUnmatchedFunctionResponse) lock in thispermissive behavior so a future "parity" change can't silently break
A2A. Porting the adk-python guards was tried and reverted because it
failed the A2A e2e tests.