Fix OpenAI API errors, session logging warnings, and infinite loops in AgentAlpha#66
Merged
Fix OpenAI API errors, session logging warnings, and infinite loops in AgentAlpha#66
Conversation
…vity logging Co-authored-by: johnkord <16021727+johnkord@users.noreply.github.com>
Co-authored-by: johnkord <16021727+johnkord@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix the bugs identified in logs here
Fix OpenAI API errors, session logging warnings, and infinite loops in AgentAlpha
Jun 25, 2025
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.
This PR fixes three critical bugs identified in the AgentAlpha GitHub PR review workflow that were causing execution failures:
🔧 Issues Fixed
1. OpenAI API "Unknown parameter: 'tool_choice.function'" Error
Problem: PlanningService was using an outdated OpenAI API format for the
tool_choiceparameter, causing requests to fail with:Solution: Updated the tool_choice format to use the correct API specification:
2. Session Activity Logger "Cannot log activity - no current session set" Warnings
Problem: When using the simple
ExecuteAsync(string task)method, no session was created, causing repeated warnings:Solution: Added automatic default session creation when no session is provided, ensuring activity logging works in all execution scenarios.
3. Infinite Loop When Tools Return Errors
Problem: When GitHub API returned 404 errors (or similar), the agent would get stuck repeating the same response indefinitely:
Solution: Implemented comprehensive repetitive response detection:
🧪 Testing
📁 Files Modified
src/Agent/AgentAlpha/Services/PlanningService.cs- Fixed OpenAI API compatibilitysrc/Agent/AgentAlpha/Services/TaskExecutor.cs- Added session initialization and loop detectionsrc/Agent/AgentAlpha/Services/ConversationManager.cs- Added repetitive response detectionsrc/Agent/AgentAlpha/Interfaces/IConversationManager.cs- Added repetition detection interfaceThe AgentAlpha GitHub PR review workflow should now execute successfully without the reported errors.
Fixes #65.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.