Skip to content

[bug] Copilot provider: built-in swarm tool makes every request fail with HTTP 400 Bad Request #855

Closed

Description

@shyamsridhar123

Summary

On the GitHub Copilot provider, exposing the built-in swarm tool makes every request fail with HTTP 400 Bad Request (bare body, no JSON error). Because swarm is in the default toolset, this bricks Copilot sessions entirely — no turn can complete.

Disabling one tool fixes it:

[tools]
disabled = ["swarm"]

Environment

  • jcode v0.72.0 (also reproduced on v0.64.2)
  • Windows 11, x86_64
  • Provider: copilot (format=chat_completions, endpoint api.enterprise.githubcopilot.com)
  • Models: reproduced on claude-opus-4.6 and claude-opus-5

Reproduction

jcode run --tools swarm "hi"
# Error: Copilot API error (HTTP 400 Bad Request): Bad Request

jcode run --tools memory "hi"    # works
jcode run --tools browser "hi"   # works
jcode run --disabled-tools swarm "hi"   # works, full toolset otherwise

Isolation already done

I bisected this fairly thoroughly, so hopefully this saves time:

  • Not auth. A hand-rolled curl to /chat/completions with the same bearer returns 200. jcode provider-doctor copilot passes every checkpoint.
  • Not MCP. Reproduced with all MCP servers removed. MCP tools are namespaced mcp__<server>__<tool>, so they cannot collide with built-ins. Every MCP tool schema also passes individually and collectively.
  • Not size. 29 built-ins alone fail; 9 (--tool-profile minimal) succeed. Tool-description lengths up to 32 KB return 200 on this endpoint.
  • It is specifically swarm. Testing built-ins one at a time, swarm is the only one that 400s alone.

What is different about the Copilot path

The same swarm tool works on the openai-compatible provider. I captured both requests:

Provider path tools_json_chars for the single swarm tool Result
openai-compatible 7691 200
copilot 8403 400

I replayed the captured openai-compatible payload verbatim against the Copilot endpoint (only swapping model) and it returned 200 — including with stream: true, tool_choice, and the full 8-message history.

So the schema itself is acceptable to Copilot. Something in the Copilot request builder adds roughly 712 characters to this tool definition that the openai-compatible builder does not, and that addition is what the endpoint rejects.

For reference, the Copilot endpoint returns this same bare Bad Request (no JSON body) for: duplicate tool names, tool names containing ., tool names longer than 64 chars, and empty tool descriptions. A well-formed rejection returns JSON instead, e.g. {"error":{"message":"model ... is not accessible via the /chat/completions endpoint"}}. That suggests the added content trips schema validation at the edge rather than the model router.

swarm has 43 properties and is by far the largest built-in schema, so it may simply be the first tool to cross a threshold that the extra Copilot-side content pushes it over.

Suggested fix

Diff the Copilot provider's tool serialization against the openai-compatible one for the same tool and check what the extra ~712 chars are.

Workaround for anyone hitting this

[tools]
disabled = ["swarm"]

Copilot sessions then work normally with the rest of the toolset.

Activity

  1. shyamsridhar123 commented on Aug 9, 2026

    @shyamsridhar123
    Author

    Additional scoping data after further testing — this is specific to the Copilot chat_completions path, not to the swarm schema itself.

    I wired jcode's openai provider (Responses API) directly at Copilot's endpoint:

    JCODE_OPENAI_API_BASE=https://api.enterprise.githubcopilot.com/v1
    

    With swarm enabled and 55 tools loaded, gpt-5.6-sol runs cleanly over /responses. Same tool, same machine, same Copilot backend — no 400.

    So the failure needs all three: the Copilot provider, format=chat_completions, and the swarm tool definition. That reinforces the serialization-difference theory in the original report rather than anything wrong with swarm's JSON Schema.

    One unrelated note found along the way, in case it's useful: the openai provider unconditionally sends service_tier, and Copilot's /responses endpoint rejects it at any value with {"error":{"message":"service_tier is not supported","code":"unsupported_parameter"}}. Removing openai_service_tier from config does not suppress it — an internal default still gets sent. Setting openai_service_tier = "" does suppress it, which works as a workaround but is not obvious.

  2. added
    bug
    triage: reproducible
    autonomous: clear
    priority: high
    on Aug 9, 2026
  3. 1jehuang commented on Aug 9, 2026

    @1jehuang
    Owner

    Thanks for the unusually thorough isolation. I reproduced the serialization difference in code: the Copilot chat-completions path passes the swarm schema without the normalization used by the compatible path. I am preparing a focused schema-normalization fix with a regression test.

    --- — Jcode agent (automated triage), on behalf of @1jehuang

  4. added
    triage: fixed-pending-release
    on Aug 9, 2026
  5. 1jehuang commented on Aug 9, 2026

    @1jehuang
    Owner

    The verified fix is now in PR #856. Focused regressions passed, and the combined TUI build completed successfully.

    --- — Jcode agent (automated triage), on behalf of @1jehuang

  6. added a commit that references this issue on Aug 9, 2026
    48d7ca6
  7. added a commit that references this issue on Aug 15, 2026
    a8e0afd
  8. added 5 commits that reference this issue on Aug 30, 2026
    22eec2d
    dfe491b
    2ee8750
    4fbc482
    8239a27
  9. added a commit that references this issue on Sep 18, 2026
    cfd2751
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    autonomous: clearbugpriority: hightriage: fixed-pending-releasetriage: reproducible

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions