fix(session): keep GitHub Copilot compaction requests valid#22371
fix(session): keep GitHub Copilot compaction requests valid#22371Hona merged 6 commits intoanomalyco:devfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Extends the existing “inject a noop tool when tool-call history exists but no tools are active” compatibility behavior to also cover the @ai-sdk/github-copilot provider, keeping compaction requests valid.
Changes:
- Expand the noop-tool injection condition from LiteLLM proxies to include
@ai-sdk/github-copilot. - Preserve request validity when tool-call history exists during scenarios like compaction (no active tools).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // LiteLLM/Bedrock rejects requests where the message history contains tool | ||
| // calls but no tools param is present. When there are no active tools (e.g. | ||
| // during compaction), inject a stub tool to satisfy the validation requirement. | ||
| // The stub description explicitly tells the model not to call it. | ||
| if (isLiteLLMProxy && Object.keys(tools).length === 0 && hasToolCalls(input.messages)) { | ||
| if ( | ||
| (isLiteLLMProxy || input.model.api.npm === "@ai-sdk/github-copilot") && | ||
| Object.keys(tools).length === 0 && | ||
| hasToolCalls(input.messages) |
There was a problem hiding this comment.
The compatibility comment block above this condition is now inaccurate: the dummy-tool injection is no longer LiteLLM-only, but also applies when input.model.api.npm === "@ai-sdk/github-copilot". Please update the surrounding comments (including the "This is enabled for" list and the "LiteLLM/Bedrock rejects..." wording) so future readers understand why GitHub Copilot is included here.
Summary
@ai-sdk/github-copilotTesting