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>
80 lines
2.8 KiB
Swift
80 lines
2.8 KiB
Swift
import Foundation
|
|
import Testing
|
|
@testable import Clawdbot
|
|
|
|
@Suite(.serialized)
|
|
struct ClawdbotConfigFileTests {
|
|
@Test
|
|
func configPathRespectsEnvOverride() async {
|
|
let override = FileManager().temporaryDirectory
|
|
.appendingPathComponent("clawdbot-config-\(UUID().uuidString)")
|
|
.appendingPathComponent("clawdbot.json")
|
|
.path
|
|
|
|
await TestIsolation.withEnvValues(["CLAWDBOT_CONFIG_PATH": override]) {
|
|
#expect(ClawdbotConfigFile.url().path == override)
|
|
}
|
|
}
|
|
|
|
@MainActor
|
|
@Test
|
|
func remoteGatewayPortParsesAndMatchesHost() async {
|
|
let override = FileManager().temporaryDirectory
|
|
.appendingPathComponent("clawdbot-config-\(UUID().uuidString)")
|
|
.appendingPathComponent("clawdbot.json")
|
|
.path
|
|
|
|
await TestIsolation.withEnvValues(["CLAWDBOT_CONFIG_PATH": override]) {
|
|
ClawdbotConfigFile.saveDict([
|
|
"gateway": [
|
|
"remote": [
|
|
"url": "ws://gateway.ts.net:19999",
|
|
],
|
|
],
|
|
])
|
|
#expect(ClawdbotConfigFile.remoteGatewayPort() == 19999)
|
|
#expect(ClawdbotConfigFile.remoteGatewayPort(matchingHost: "gateway.ts.net") == 19999)
|
|
#expect(ClawdbotConfigFile.remoteGatewayPort(matchingHost: "gateway") == 19999)
|
|
#expect(ClawdbotConfigFile.remoteGatewayPort(matchingHost: "other.ts.net") == nil)
|
|
}
|
|
}
|
|
|
|
@MainActor
|
|
@Test
|
|
func setRemoteGatewayUrlPreservesScheme() async {
|
|
let override = FileManager().temporaryDirectory
|
|
.appendingPathComponent("clawdbot-config-\(UUID().uuidString)")
|
|
.appendingPathComponent("clawdbot.json")
|
|
.path
|
|
|
|
await TestIsolation.withEnvValues(["CLAWDBOT_CONFIG_PATH": override]) {
|
|
ClawdbotConfigFile.saveDict([
|
|
"gateway": [
|
|
"remote": [
|
|
"url": "wss://old-host:111",
|
|
],
|
|
],
|
|
])
|
|
ClawdbotConfigFile.setRemoteGatewayUrl(host: "new-host", port: 2222)
|
|
let root = ClawdbotConfigFile.loadDict()
|
|
let url = ((root["gateway"] as? [String: Any])?["remote"] as? [String: Any])?["url"] as? String
|
|
#expect(url == "wss://new-host:2222")
|
|
}
|
|
}
|
|
|
|
@Test
|
|
func stateDirOverrideSetsConfigPath() async {
|
|
let dir = FileManager().temporaryDirectory
|
|
.appendingPathComponent("clawdbot-state-\(UUID().uuidString)", isDirectory: true)
|
|
.path
|
|
|
|
await TestIsolation.withEnvValues([
|
|
"CLAWDBOT_CONFIG_PATH": nil,
|
|
"CLAWDBOT_STATE_DIR": dir,
|
|
]) {
|
|
#expect(ClawdbotConfigFile.stateDirURL().path == dir)
|
|
#expect(ClawdbotConfigFile.url().path == "\(dir)/clawdbot.json")
|
|
}
|
|
}
|
|
}
|