fix(agent): recover blank streamed replies from final answer#71467
Conversation
Greptile SummaryThis PR fixes a bug in Confidence Score: 5/5Safe to merge — targeted one-file logic fix with a clear regression test and no impact on tool-use, retry, or provider-specific paths. The change is minimal and well-tested: three variable renames/additions in a single function, all backed by a new unit test that directly reproduces the reported scenario. Existing tests continue to pass, and the assistantTextsHaveMedia check that still uses params.assistantTexts is inconsequential because whitespace-only strings cannot carry media directives. No files require special attention. Reviews (1): Last reviewed commit: "fix(agent): recover blank streamed repli..." | Re-trigger Greptile |
bc29469 to
fa12bbc
Compare
fa12bbc to
24d96a3
Compare
|
Landed via rebase onto main.
Thanks @Sanjays2402! |
Summary
Describe the problem and fix in 2–5 bullets:
If this PR fixes a plugin beta-release blocker, title it
fix(<plugin-id>): beta blocker - <summary>and link the matchingBeta blocker: <plugin-name> - <summary>issue labeledbeta-blocker. Contributors cannot label PRs, so the title is the PR-side signal for maintainers and automation.stopReason=stopbutpayloads=0when the streamed assistant text array contains only whitespace, causing the gateway to surface the generic incomplete-turn error instead of the final answer.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write
N/A. If the cause is unclear, writeUnknown.buildEmbeddedRunPayloadstreatedassistantTexts.length > 0as proof that a streamed user-visible reply existed, even when every streamed entry was blank/whitespace.Regression Test Plan (if applicable)
For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write
N/A.src/agents/pi-embedded-runner/run/payloads.test.tsUser-visible / Behavior Changes
Interactive chat replies that previously produced the generic incomplete-turn error can now deliver the final assistant answer when it is present in the stored assistant message.
Diagram (if applicable)
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation: N/ARepro + Verification
Environment
Steps
assistantTexts: [" "].lastAssistantwith phasedfinal_answertext.Expected
Actual
Evidence
Attach at least one:
pnpm test -- --run src/agents/pi-embedded-runner/run/payloads.test.tsTypecheck note:
This appears unrelated to this PR; this change only touches
run/payloads.tsand its payload unit test.Human Verification (required)
What you personally verified (not just CI), and how:
Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations
NO_REPLYlogic.