fix(providers): refuse an empty Responses input before sending instead of retrying a guaranteed 400
Merged
WA
23d ago+56+56+01234567890123456789-1-1-0123456789
Summary
- An Agent block whose system and user messages are absent or resolve to empty (e.g.
<start.input>is"") sent the OpenAI Responses APIinput: [], because empty-content messages are dropped when the input is built. OpenAI rejects that with a 400 on every attempt, yet it surfaced as a plain internal error, logged at ERROR, and burned block retries and model fallbacks executeResponsesProviderRequestnow refuses an empty input before any request is sent, throwingEmptyProviderInputError— aUserFailure(classified as the author's to fix) withretryable = false(skips block retries and the fallback chain)- The message tells the author the Agent has nothing to send and to add a system/user message or check the referenced value
- Applies to every Responses caller (OpenAI, Azure OpenAI, Kie); none use
previous_response_id,prompt, orconversation, so an emptyinputcould never succeed on any of them - Unchanged: system-prompt-only requests, whitespace-only content (only zero-length content is dropped, as before), file-only user messages, tool-loop continuation turns
Type of Change
- Bug fix
Testing
- Extended
providers/openai/core.response-status.test.ts: empty system prompt + empty messages rejects with the user failure (isNonRetryableExecutionErrortrue,classifyFailure→user) and never calls fetch; a system-prompt-only request still sends[{ role: 'system', … }] - Red on the pre-fix code (removing the guard yields
ProviderError: OpenAI API error (400)), green with it - OpenAI, Azure OpenAI and Kie provider tests pass (154 tests)
Checklist
- Code follows project style guidelines
- Self-reviewed my changes
- Tests added/updated and passing (new tests pass the
test-auditauthoring gate) - No new warnings introduced
- I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)