Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kylehuan/copilot-api
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: partychen/copilot-api
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 4 commits
  • 24 files changed
  • 3 contributors

Commits on Jun 3, 2026

  1. refine and update

    partychen committed Jun 3, 2026
    Configuration menu
    Copy the full SHA
    8dcf445 View commit details
    Browse the repository at this point in the history

Commits on Jun 18, 2026

  1. Apply model mapping in count_tokens handler and add opus-4-8 mapping

    The count_tokens handler was missing the model mapping step that the
    messages and chat-completions handlers already had, so requests using a
    mapped source name (e.g. claude-opus-4-8) failed model lookup and
    returned a default token count, surfacing as "model not found" in
    clients. Add the same mapping logic and register claude-opus-4-8.
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    partychen and claude committed Jun 18, 2026
    Configuration menu
    Copy the full SHA
    6d72e92 View commit details
    Browse the repository at this point in the history
  2. Fix assistant-prefill 400 on tool-terminated conversations

    GitHub Copilot's claude-opus-4.8 rejects requests whose final upstream
    message is not a user message ("assistant message prefill"). A trailing
    Anthropic tool_result translates to an OpenAI `tool` role message, so
    conversations ending in a tool call hit a 400. Append a placeholder user
    message when the translated conversation does not end with a user turn.
    
    Also switch local Claude CLI config to claude-opus-4-8.
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    partychen and claude committed Jun 18, 2026
    Configuration menu
    Copy the full SHA
    f6afbdd View commit details
    Browse the repository at this point in the history
  3. Only inject Continue placeholder on assistant-terminated turns

    The assistant-prefill fix in f6afbdd used the condition `role !== "user"`,
    which also matched tool-terminated turns. In the Claude Code agent loop, a
    turn whose final user message carries only a tool_result translates to an
    OpenAI `tool` role message, so every tool round hit the condition and got a
    spurious `{role:"user", content:"Continue."}` appended — making the model
    respond to "Continue." instead of the real tool result.
    
    Verified directly against api.githubcopilot.com that claude-opus-4.8 returns
    200 for tool-terminated conversations and only 400s on assistant-terminated
    ones ("This model does not support assistant message prefill. The
    conversation must end with a user message."). Narrow the condition to
    `role === "assistant"` so only genuine prefill is patched.
    
    Add regression tests covering both: tool_result-terminated must NOT append
    Continue, assistant-terminated must.
    
    Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
    partychen and claude committed Jun 18, 2026
    Configuration menu
    Copy the full SHA
    e778793 View commit details
    Browse the repository at this point in the history
Loading