Skip to content

Copilot SSE streaming endpoint API specification#2922

Merged
aofei merged 1 commit intogoplus:devfrom
nighca:issue-2901
Mar 10, 2026
Merged

Copilot SSE streaming endpoint API specification#2922
aofei merged 1 commit intogoplus:devfrom
nighca:issue-2901

Conversation

@nighca
Copy link
Copy Markdown
Collaborator

@nighca nighca commented Mar 9, 2026

Update #2901

@gemini-code-assist

This comment was marked as outdated.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a significant and well-executed migration of the main copilot's tool-use mechanism from a custom XML format to the provider's standard tool-call API. The changes span across documentation, OpenAPI specifications, and frontend logic, including a new SSE-based streaming implementation. The implementation is robust, with thorough handling of backward compatibility for persisted sessions and a comprehensive new test suite. My review found one area for improvement in the OpenAPI specification to reduce duplication.

Comment thread docs/openapi.yaml Outdated
Comment thread docs/openapi.yaml

The response is a Server-Sent Events (SSE) stream where each `data:` line contains a single JSON object.

#### Event semantics
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

这里的定义与 OpenAI-compatible API 概念一致,不过有细微的区别,如

  • 结构上更简单,没有 choices 等我们不需要的概念
  • 数据字段名与其他接口数据命名风格保持一致为小驼峰

@nighca nighca marked this pull request as ready for review March 9, 2026 07:57
Copilot AI review requested due to automatic review settings March 9, 2026 07:57
@nighca nighca changed the title Copilot: migrate tool-use from custom XML format to provider's standard tool-call API Copilot SSE streaming endpoint API specification Mar 9, 2026
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

Updates the Copilot API spec to support provider-standard tool calling and introduces a structured SSE streaming endpoint to improve tool-call reliability and client parsing.

Changes:

  • Replaces inline Copilot message request bodies with a shared CopilotMessageRequest schema.
  • Redefines CopilotMessage as a discriminated union (user / copilot / tool) with structured toolCalls and tool-result messages.
  • Adds POST /copilot/sse/message with defined SSE event semantics and schemas for structured streaming.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/openapi.yaml
Comment thread docs/openapi.yaml Outdated
Comment thread docs/openapi.yaml Outdated
Comment thread docs/openapi.yaml
Comment thread docs/openapi.yaml Outdated
Comment thread docs/openapi.yaml
Comment thread docs/openapi.yaml
Comment thread docs/openapi.yaml
Comment thread docs/openapi.yaml
@xgopilot
Copy link
Copy Markdown
Contributor

xgopilot bot commented Mar 9, 2026

The schema refactoring is well-structured overall — the discriminated oneOf for CopilotMessage, the shared CopilotMessageRequest, and the SSE event schema hierarchy are all clean additions. Inline comments cover the notable issues: wrong HTTP status code for streaming (201 vs 200), an unenforced schema invariant on CopilotCopilotMessage, a tool_name enum vs example contradiction, int64 for a JS-facing index, and extensibility gaps in finishReason and CopilotSSEErrorEvent.reason.

@aofei aofei merged commit 934d93b into goplus:dev Mar 10, 2026
5 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.

3 participants