fix(adk): reject nil events from custom agents - #1245
Open
yiran-culture wants to merge 1 commit into
Open
Conversation
|
|
yiran-culture
force-pushed
the
codex/fix-agent-tool-nil-event
branch
from
September 9, 2026 02:07
e15e6a6 to
cfe00d4
Compare
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.
What type of PR is this?
fix
Check the PR title.
(Optional) Translate the PR title into Chinese.
fix(adk): 拒绝自定义 Agent 返回的 nil 事件
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
A custom Agent can currently send a nil event through its AsyncIterator. Both flowAgent.run and typedFlowAgent.run dereference that event while assigning RunPath, which triggers a nil-pointer panic. Although the outer recovery keeps the process alive, callers receive a generic panic error and stack trace instead of an actionable contract error.
This change validates events at the shared flow boundary for both Message and AgenticMessage paths. A nil event now terminates that run with a descriptive error containing the agent name. It also adds regression coverage for a nil event consumed directly through TypedRunner and through an AgentTool.
Validation:
go test ./adk/...go test -racegit diff --checkzh:
自定义 Agent 通过 AsyncIterator 返回 nil event 时,统一 flow 管线此前会在设置 RunPath 时发生空指针 panic。该修改在 Message 和 AgenticMessage 的公共边界进行校验,将 panic 转换为包含 Agent 名称的明确错误,并补充 Runner 与 AgentTool 回归测试。
(Optional) Which issue(s) this PR fixes:
Fixes #1244
(optional) The PR that updates user documentation:
Not required.