Skip to content

fix(providers): refuse an empty Responses input before sending instead of retrying a guaranteed 400 - #9196

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/openai-responses-empty-input
Oct 18, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
fix/openai-responses-empty-input

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • An Agent block whose system and user messages are absent or resolve to empty (e.g. <start.input> is "") sent the OpenAI Responses API input: [], 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
  • executeResponsesProviderRequest now refuses an empty input before any request is sent, throwing EmptyProviderInputError — a UserFailure (classified as the author's to fix) with retryable = 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, or conversation, so an empty input could 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 (isNonRetryableExecutionError true, 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-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 18, 2026 9:05pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Rejects empty Responses input before sending a request.

  • Responses requests with no input stop before they reach the provider.

Reviews (1) · Last reviewed commit: "fix(providers): refuse an empty Response..." · Reviewed by Greptile

@waleedlatif1
waleedlatif1 merged commit 4346f70 into staging Oct 18, 2026
53 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/openai-responses-empty-input branch October 18, 2026 22:12

This branch was previously deployed

1 inactive deployment
Preview — acbcb93e Deployed Oct 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant