openclaw/test/inbound-contract.providers.test.ts
Jon Shapiro 92697edb7c fix(venice): add compat settings to prevent HTTP 400 errors
Venice's API doesn't support certain OpenAI-compatible parameters that
Clawdbot sends by default:

- `store`: Venice returns HTTP 400 with no body when this is present
- `developer` role: Not supported by Venice's API

This adds VENICE_COMPAT settings (supportsStore: false,
supportsDeveloperRole: false) to all Venice model definitions, both
from the static catalog and dynamically discovered models.

Fixes issues reported in PR #1666 where users experienced silent
failures (HTTP 400, no body) when using Venice models.

Co-authored-by: jonisjongithub <jonisjongithub@users.noreply.github.com>
Co-authored-by: Clawdbot <bot@clawd.bot>
2026-01-26 17:56:01 -08:00

163 lines
4.0 KiB
TypeScript

import { describe, it } from "vitest";
import type { MsgContext } from "../src/auto-reply/templating.js";
import { finalizeInboundContext } from "../src/auto-reply/reply/inbound-context.js";
import { expectInboundContextContract } from "./helpers/inbound-contract.js";
describe("inbound context contract (providers + extensions)", () => {
const cases: Array<{ name: string; ctx: MsgContext }> = [
{
name: "whatsapp group",
ctx: {
Provider: "whatsapp",
Surface: "whatsapp",
ChatType: "group",
From: "123@g.us",
To: "+15550001111",
Body: "[WhatsApp 123@g.us] hi",
RawBody: "hi",
CommandBody: "hi",
SenderName: "Alice",
},
},
{
name: "telegram group",
ctx: {
Provider: "telegram",
Surface: "telegram",
ChatType: "group",
From: "group:123",
To: "telegram:123",
Body: "[Telegram group:123] hi",
RawBody: "hi",
CommandBody: "hi",
GroupSubject: "Telegram Group",
SenderName: "Alice",
},
},
{
name: "slack channel",
ctx: {
Provider: "slack",
Surface: "slack",
ChatType: "channel",
From: "slack:channel:C123",
To: "channel:C123",
Body: "[Slack #general] hi",
RawBody: "hi",
CommandBody: "hi",
GroupSubject: "#general",
SenderName: "Alice",
},
},
{
name: "discord channel",
ctx: {
Provider: "discord",
Surface: "discord",
ChatType: "channel",
From: "group:123",
To: "channel:123",
Body: "[Discord #general] hi",
RawBody: "hi",
CommandBody: "hi",
GroupSubject: "#general",
SenderName: "Alice",
},
},
{
name: "signal dm",
ctx: {
Provider: "signal",
Surface: "signal",
ChatType: "direct",
From: "signal:+15550001111",
To: "signal:+15550002222",
Body: "[Signal] hi",
RawBody: "hi",
CommandBody: "hi",
},
},
{
name: "imessage group",
ctx: {
Provider: "imessage",
Surface: "imessage",
ChatType: "group",
From: "group:chat_id:123",
To: "chat_id:123",
Body: "[iMessage Group] hi",
RawBody: "hi",
CommandBody: "hi",
GroupSubject: "iMessage Group",
SenderName: "Alice",
},
},
{
name: "matrix channel",
ctx: {
Provider: "matrix",
Surface: "matrix",
ChatType: "channel",
From: "matrix:channel:!room:example.org",
To: "room:!room:example.org",
Body: "[Matrix] hi",
RawBody: "hi",
CommandBody: "hi",
GroupSubject: "#general",
SenderName: "Alice",
},
},
{
name: "msteams channel",
ctx: {
Provider: "msteams",
Surface: "msteams",
ChatType: "channel",
From: "msteams:channel:19:abc@thread.tacv2",
To: "msteams:channel:19:abc@thread.tacv2",
Body: "[Teams] hi",
RawBody: "hi",
CommandBody: "hi",
GroupSubject: "Teams Channel",
SenderName: "Alice",
},
},
{
name: "zalo dm",
ctx: {
Provider: "zalo",
Surface: "zalo",
ChatType: "direct",
From: "zalo:123",
To: "zalo:123",
Body: "[Zalo] hi",
RawBody: "hi",
CommandBody: "hi",
},
},
{
name: "zalouser group",
ctx: {
Provider: "zalouser",
Surface: "zalouser",
ChatType: "group",
From: "group:123",
To: "zalouser:123",
Body: "[Zalo Personal] hi",
RawBody: "hi",
CommandBody: "hi",
GroupSubject: "Zalouser Group",
SenderName: "Alice",
},
},
];
for (const entry of cases) {
it(entry.name, () => {
const ctx = finalizeInboundContext({ ...entry.ctx });
expectInboundContextContract(ctx);
});
}
});