cloudaxe-opencode/packages/opencode/test
Developer d3a69ad910 fix(mcp): tolerate invalid tool output schemas
Closes #26529.

When an MCP server returns a tool whose \`outputSchema\` contains a
broken \`$ref\` (e.g. Google Stitch's \`#/$defs/ScreenInstance\`), the
SDK's typed \`listTools()\` validator throws and opencode marks the
ENTIRE server as failed — losing every other valid tool the server
exposes.

Catch the schema-reference errors and retry with a tolerant schema
(\`looseObject\` + \`outputSchema: z.unknown().optional()\`) via the raw
\`request\` path so the bad tool's schema is accepted as opaque while
the others load normally.

Equivalent fix shape to #26530 (nicolascancino) — kept his approach
since it's correct. Bundles our reproducer test from
\`kit/issue-reproducers\` so the regression is locked in.

Verified red → green → red → green:
- pre-fix: server marked \`failed\`
- post-fix: server stays \`connected\`, valid tool present
2026-05-09 19:00:34 -04:00
..
account refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
acp ignore: fix typerrs on dev (#26544) 2026-05-09 12:08:00 -05:00
agent feat(core): add scout agent for repo research (#24149) 2026-05-08 20:20:08 +00:00
auth core: move cross-spawn-spawner to root and remove unused types 2026-04-25 14:30:16 -04:00
bus Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
cli chore: generate 2026-05-09 22:47:54 +00:00
config flatten to keybind compatible config (#26421) 2026-05-09 01:29:13 +02:00
control-plane research: delete Hono backend (do not merge) (#25667) 2026-05-09 13:10:42 +00:00
effect fix(instance): run bootstrap from instance store (#25475) 2026-05-02 19:33:38 -04:00
fake refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
file Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
filesystem refactor: rename shared package to core (#24309) 2026-04-25 10:59:17 -04:00
fixture test(server): expand workspace routing fixed-id coverage (#26458) 2026-05-09 00:00:18 -04:00
format core: move cross-spawn-spawner to root and remove unused types 2026-04-25 14:30:16 -04:00
git fix(vcs): avoid unbounded diff memory usage (#25581) 2026-05-03 17:49:46 +05:30
ide
installation Refactor npm config handling (#24565) 2026-04-27 03:54:59 +00:00
lib chore: generate 2026-05-03 00:32:24 +00:00
lsp Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
mcp fix(mcp): tolerate invalid tool output schemas 2026-05-09 19:00:34 -04:00
memory
patch
permission Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
plugin feat(core): copy file changes when warping (#26190) 2026-05-07 10:24:17 -04:00
project research: delete Hono backend (do not merge) (#25667) 2026-05-09 13:10:42 +00:00
provider fix(provider): align Gemini thinking controls (#26279) 2026-05-08 10:22:45 -04:00
pty chore: generate 2026-05-04 02:57:18 +00:00
question Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
server chore: generate 2026-05-09 22:47:54 +00:00
session fix(session): accept legacy summary diffs (#26579) 2026-05-09 16:44:24 -04:00
share refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
shell refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
skill fix(skill): allow missing descriptions (#26391) 2026-05-08 18:50:06 +00:00
snapshot Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
storage fix(storage): default workspace time migration (#26556) 2026-05-09 14:18:55 -04:00
sync feat(core): session warping (#25768) 2026-05-04 21:28:38 -04:00
tool fix(tool/read): match permission patterns against worktree-relative path 2026-05-09 18:46:29 -04:00
util Move schema utilities into core (#26565) 2026-05-09 19:51:09 +00:00
v2 Improve v2 session message rendering (#25634) 2026-05-05 02:35:21 +00:00
AGENTS.md chore: generate 2026-05-09 04:06:08 +00:00
permission-task.test.ts Normalize instance lifecycle wiring (#25501) 2026-05-02 20:39:20 -04:00
preload.ts Refactor v2 session events as schemas (#24512) 2026-05-02 22:09:48 -04:00