Repository navigation
fix(agent): enable empty-response retry and follow-through guardrail in streaming - #663
Merged
DonPrus merged 3 commits intoMar 21, 2026
Conversation
…in streaming
Both the empty-response retry and the `shouldForceActionFollowThrough`
guardrail were gated on `!is_streaming`. The A2A protocol always calls
`processMessageStreaming`, so `is_streaming` is always true for A2A
sessions — meaning neither guardrail ever fired. When the model replied
with a deferred promise ("Let me list…") but no tool call, the agent
returned that text as the final answer instead of forcing a follow-up
iteration.
Fixes:
- Remove the `!is_streaming` guard from the empty-response retry.
- Remove the `!is_streaming` guard from the follow-through guardrail.
- Expand `shouldForceActionFollowThrough` from ~5 specific verbs to ~25
covering look/see/verify/fetch/get/retrieve/list/show/find/search/
read/open/load/run/execute/call/use, while keeping the match
verb-specific to avoid false-positives on conclusory phrases like
"Let me know if…" or "I'll note that…".
Adds 9 new unit tests: 5 new positive cases and 4 new negative cases.
…llowThrough Add 3 regression tests covering the exact phrases that caused NullClawBot to stop prematurely when querying the Workstream Board Kanban columns: - 'Found the Workstream Board (project ID 4). Let me get the Kanban columns (buckets) for it.' - 'Let me fetch the list of projects.' - 'Let me look up the tasks now.' These guard against the !is_streaming regression where the guardrail was never reached on A2A streaming sessions.
DonPrus
approved these changes
Mar 21, 2026
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.
Problem
Two important safeguards in
src/agent/root.zigwere gated on!is_streaming, which caused them to be silently skipped during A2A streaming turns:!is_streamingguard caused streaming turns to exit silently on an empty reply.shouldForceActionFollowThrough— after a tool-call-only turn the agent checks whether the model neglected to produce a final prose reply and, if so, forces a follow-up turn. The!is_streamingguard suppressed this for all streaming calls, meaning tool-heavy streaming conversations could stall without a final answer.Additionally, the
actionVerbsset used byshouldForceActionFollowThroughwas very small (~5 entries). Many common tool-result verbs were not matched, so the heuristic missed a wide range of stall conditions.Changes
src/agent/root.zig!is_streamingguard from the empty-response retry block so streaming turns retry on blank model output.!is_streamingguard from theshouldForceActionFollowThroughblock so streaming turns also get the follow-up guardrail.actionVerbsfrom ~5 to 25 entries covering the most common tool-result verbs (fetched,retrieved,read,wrote,created,updated,deleted,searched,listed,executed,ran,checked,found,loaded,saved,sent,posted,downloaded,uploaded,opened,closed,added,removed,set,got).src/agent/root_test.zig(new test cases)shouldForceActionFollowThroughcovering: vikunja-mcp task-list reply, pure tool output with no prose, prose-only reply (must not trigger), and empty reply.Testing
All existing tests pass. New regression cases added.
Notes
message/send) turns — the guards were already absent there.shouldForceActionFollowThroughremains a heuristic; the expanded verb list improves coverage but is not exhaustive.