-
Notifications
You must be signed in to change notification settings - Fork 13
Fix: Restore tool messages in conversation history for context continuity #39
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
base: main
Are you sure you want to change the base?
Fix: Restore tool messages in conversation history for context continuity #39
Conversation
…uity Tool messages were saved but not restored, causing context loss and redundant tool calls across conversation turns. - Add :tool role support to restore_conversation_history - Extract helper methods to reduce complexity - Enhance MessageExtractor for Hash/Array tool_calls compatibility - Add 7 test cases - Fully backwards compatible Fixes critical bug affecting tool-based multi-turn conversations
✅ Deploy Preview for ruby-ai-agents canceled.
|
|
Hey, thanks for this. I'll review it get it merged soon. |
|
Fixes: #38 |
|
@codex please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…dation errors The runner previously intentionally omitted `tool_calls` when restoring conversation history, restoring only the tool results[cite: 688]. However, this behavior violates the API contracts of major providers like OpenAI and Anthropic. These APIs require that any message with a `tool` role be immediately preceded by an `assistant` message containing the corresponding `tool_calls` and matching IDs. Failing to provide this structure results in 400 Bad Request errors when resuming conversations that involve tool usage.
cbba6db to
e54a275
Compare
596f49f to
0c62d47
Compare
|
@codex please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…uity
Tool messages were saved but not restored, causing context loss and redundant tool calls across conversation turns.
Fixes critical bug affecting tool-based multi-turn conversations