Skip to content

fix: agent loop to support non-OpenAI providers by selecting correct response handler #722

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

byteakp
Copy link

@byteakp byteakp commented Apr 29, 2025

This PR fixes an issue where the agent loop would hang or fail when using non-OpenAI providers (e.g., Gemini), due to hardcoded assumptions about the /responses endpoint.

🔧 Changes Made:
Adjusted agent loop logic to dynamically select the correct response handler based on both the provider argument and project config.

Prevents attempts to call unsupported OpenAI-specific endpoints when using alternatives.

Ensures a smooth response flow across providers with varying endpoint structures.

🐛 Fixes:
Resolves #706

✅ Expected Behavior:
The agent responds correctly regardless of whether OpenAI or another provider (e.g., Gemini) is used.

No hangs, timeouts, or silent failures on unsupported endpoints.

Copy link

github-actions bot commented Apr 29, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@byteakp
Copy link
Author

byteakp commented Apr 29, 2025

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Apr 29, 2025
@feelmypain
Copy link

Would be nice to push this ASAP after reviewing it.

@tibo-openai tibo-openai changed the title Fix agent loop to support non-OpenAI providers by selecting correct response handler fix: agent loop to support non-OpenAI providers by selecting correct response handler May 2, 2025
@byteakp
Copy link
Author

byteakp commented May 5, 2025

Hi @openai,
Could you please review my PR and provide feedback when possible? I’ve addressed the issue with the agent loop to support non-OpenAI providers and signed the CLA as requested. Let me know if there are any changes or further steps needed. Thank you!

@asadm
Copy link

asadm commented May 7, 2025

Hey @openai, Is there a blocker on this one? I would LOVE to use this. Is there a plan to merge this? I am leaning pushing an alt npm package with this cherry picked otherwise.

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.

bug: codex doesn't answer anymore after asking to fix/improve a code (Gemini)
3 participants