Commit Graph
3 Commits
Author SHA1 Message Date
yetone def6a83584 workbuddy 0.1.33: a oneOf of objects with no type reaches Kimi typed object (#378)
congee949 found that kimi-k3.1-pro on workbuddy and workbuddy-ai answers
400 "Invalid request parameters" to a tool whose parameters hold a oneOf
with no type. This happens even when every branch is an object, either as
a $ref's target or deeper in it (dsh's REA tools). The same request with
"type": "object" beside the oneOf gets 200, in three real dsh runs with
all 198 tools. fitTools now runs typeUnions after fitShape. typeUnions
gives such a oneOf type "object" when each branch is typed object, either
directly or through a chain of local $refs. A union of other or mixed
types, an anyOf, and a $ref that is missing, external or circular are left
as they came. Only schema keywords are walked, so examples and defaults are
not.

Tests use the issue's literal parameters: the minimal $ref → oneOf, the
nested oneOf that all three routes refused, and the REA $ref-branch case.
They also cover what is left alone.

Run: `bun test` in packages/workbuddy with a sandbox HOME/TMPDIR and a dead
HTTPS_PROXY: 152 pass, 0 fail. `bun scripts/check.mjs workbuddy`: ok.
scripts/try.sh with magpie origin/main 4dfd88206 lists workbuddy (15) and
workbuddy-ai (16). Broken by hand: with the typeUnions call taken out of
fitTools, tools.test.mjs goes 1 red; with $ref branches not followed, 1 red.
Not tried: a real WorkBuddy account. The rule is the one the reporter
verified on the live API.
2026-10-25 14:54:25 +08:00
yetone a6bed5ec54 workbuddy 0.1.22: an MCP server's tool schemas reach Kimi and DeepSeek, not 400 11133 "Invalid request parameters" (#122, clearmann)
Cause: Kimi's tool-schema check (kimi-k3-1, also kimi-k2.7) turns away
schemas that MCP servers and plugins commonly send, with 400 11133
"the request parameters were rejected by the model provider". It is
the request's content, not the account: on the owner's China account
each shape alone in an otherwise plain chat failed every time, and the
same chat with it mended passed. Shapes refused: an enum with no type
(all strings too, under items, anyOf, an unused $defs), an empty enum,
an enum whose type lists two types besides null, true/false where a
schema goes (properties.x, items), a required that isn't a list, and an
unknown type ("any", "String"). Claude Code's own 24 tools have none of
these, which is why tool-less side requests passed for the reporter.

fitShape walks schema positions only (a property named enum or type is a
name) and gives each the shape Kimi takes, meaning the same: an untyped
enum takes its values' type, or [T, "null"]; several types become an
anyOf of typed enums; true is {}, false is {"not": {}};
additionalProperties booleans are left. An empty enum (which nothing
fits) is left out. It runs for every model, as fitTools already does.

WorkBuddy 5.5.6's own CLI (codebuddy.js, read-only) only cleans schemas
for Gemini and only drops temperature for kimi-k3, so it would hit the
same 400 with such an MCP tool.

Ran, real account (China build, plugin loader fetch, old vs new):
- 14 refused shapes on kimi-k3-1: each 400 11133 before, 200 after.
- one MCP-like tool holding all of them: kimi-k3-1 and kimi-k2.7 400
  11133 -> 200; deepseek-v4.1-flash and deepseek-v4-pro 400 11129 ->
  200; glm-5.3 400 11133 -> 200; minimax-m3 and hy3 200 both.
- HOME=$(mktemp -d) bun test in packages/workbuddy: 89 pass; the new
  tests go red (4 fail) with the fitShape call taken out.
- bun scripts/check.mjs: ok.
Not tried: WorkBuddy AI (international) models, and a real MCP server
through Claude Code end to end. glm-5.1 answers 11150 to every chat on
this account (unrelated, also before).
2026-10-14 21:15:24 +08:00
yetone 17e75329b1 workbuddy 0.1.12: a chat's tools get shapes WorkBuddy AI's models take, so ZCode's and DeepSeek Harness's chats on deepseek-v4.1-flash aren't 400 "Invalid request parameters" (wyh on Discord)
WorkBuddy AI answers 11133 "Invalid request parameters" (the model
provider rejected them) when a tool's parameters or name are of a shape
its model turns away. Tried on the owner's account through magpie:
deepseek-v4.1-flash and -sg refuse each of a pattern's \0, a root anyOf,
parameters with no type, empty parameters, a tuple's items, and a name
holding . : / a space or CJK; Kimi, GPT, Gemini and GLM refuse some;
MiniMax none. Every client protocol reached the same error, so it is the
tools, not the protocol.

fitTools now gives each the shape that passes: an object root (unions
merged as magpie's provider.ObjectRoot does), \0 as \u0000, a tuple's
items as one anyOf, and a safe name, with the model's calls named back in
JSON and streamed answers and the history's calls named as sent. A clean
chat goes as the same bytes.

Run: HOME=$(mktemp -d) bun test packages/workbuddy (54 pass), bun
scripts/check.mjs workbuddy; through a sandbox magpie gateway with this
package, deepseek-v4.1-flash, -sg, glm-5.3, gpt-5.4, gemini-3.5-flash and
kimi-k3 answer 200 to every shape above (400 before), and an Anthropic
Messages call of a tool named fs.read, streamed and not, comes back as
fs.read. wyh's own ZCode/DeepSeek Harness tool set was not seen.
2026-10-08 17:39:00 +08:00