Skip to content

fix(session): keep GitHub Copilot compaction requests valid#22371

Merged
Hona merged 6 commits intoanomalyco:devfrom
Hona:fix/copilot-enterprise-compat
Apr 14, 2026
Merged

fix(session): keep GitHub Copilot compaction requests valid#22371
Hona merged 6 commits intoanomalyco:devfrom
Hona:fix/copilot-enterprise-compat

Conversation

@Hona
Copy link
Copy Markdown
Member

@Hona Hona commented Apr 14, 2026

Summary

  • Extend the existing noop tool compatibility path to @ai-sdk/github-copilot
  • Keep compaction requests valid when tool history exists but no active tools are present
  • Isolate just this session fix from the original mixed commit

Testing

  • Not run (per request)

Copilot AI review requested due to automatic review settings April 14, 2026 01:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines 204 to +211
// 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)
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@Hona Hona merged commit f9d99f0 into anomalyco:dev Apr 14, 2026
9 of 12 checks passed
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.

2 participants