Repository navigation
Description
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 onv0.64.2) - Windows 11, x86_64
- Provider:
copilot(format=chat_completions, endpointapi.enterprise.githubcopilot.com) - Models: reproduced on
claude-opus-4.6andclaude-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 otherwiseIsolation already done
I bisected this fairly thoroughly, so hopefully this saves time:
- Not auth. A hand-rolled
curlto/chat/completionswith the same bearer returns 200.jcode provider-doctor copilotpasses 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,swarmis 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
shyamsridhar123 commentedon Aug 9, 2026
Additional scoping data after further testing — this is specific to the Copilot
chat_completionspath, not to theswarmschema itself.I wired jcode's
openaiprovider (Responses API) directly at Copilot's endpoint:With
swarmenabled and 55 tools loaded,gpt-5.6-solruns 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 theswarmtool definition. That reinforces the serialization-difference theory in the original report rather than anything wrong withswarm's JSON Schema.One unrelated note found along the way, in case it's useful: the
openaiprovider unconditionally sendsservice_tier, and Copilot's/responsesendpoint rejects it at any value with{"error":{"message":"service_tier is not supported","code":"unsupported_parameter"}}. Removingopenai_service_tierfrom config does not suppress it — an internal default still gets sent. Settingopenai_service_tier = ""does suppress it, which works as a workaround but is not obvious.1jehuang commentedon Aug 9, 2026
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
1jehuang commentedon Aug 9, 2026
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
fix: normalize Copilot tool schemas (fixes 1jehuang#855)
chore: sync fork with upstream jcode (fresh merge onto current master) (
fix: normalize Copilot tool schemas (fixes 1jehuang#855)
fix: normalize Copilot tool schemas (fixes 1jehuang#855)
fix: normalize Copilot tool schemas (fixes 1jehuang#855)
fix: normalize Copilot tool schemas (fixes 1jehuang#855)
fix: normalize Copilot tool schemas (fixes 1jehuang#855)
fix: normalize Copilot tool schemas (fixes 1jehuang#855)