fix: extend Sub2API compact proxy timeout
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { renderCodexLocalConsumerToml } from "./src/platform-infra-sub2api-codex";
|
||||
import { renderCaddySiteBlock, renderCodexLocalConsumerToml } from "./src/platform-infra-sub2api-codex";
|
||||
|
||||
function assertCondition(condition: unknown, message: string, detail: unknown = {}): void {
|
||||
if (!condition) throw new Error(`${message}: ${JSON.stringify(detail)}`);
|
||||
@@ -58,11 +58,19 @@ const disabled = renderCodexLocalConsumerToml(existing, {
|
||||
assertCondition(disabled.includes("supports_websockets = false"), "disabled localCodex policy must render provider WebSocket transport off", disabled);
|
||||
assertCondition(disabled.includes("responses_websockets_v2 = false"), "disabled localCodex policy must render Responses WebSocket v2 off", disabled);
|
||||
|
||||
const caddyBlock = renderCaddySiteBlock("sub2api.example.test", "http://127.0.0.1:21880", 180);
|
||||
|
||||
assertCondition(caddyBlock.includes("sub2api.example.test {"), "Caddy site block must use the configured domain", caddyBlock);
|
||||
assertCondition(caddyBlock.includes("reverse_proxy 127.0.0.1:21880"), "Caddy site block must use the configured local upstream", caddyBlock);
|
||||
assertCondition(caddyBlock.includes("response_header_timeout 180s"), "Caddy response header timeout must allow long Codex compact requests", caddyBlock);
|
||||
assertCondition(!caddyBlock.includes("response_header_timeout 30s"), "Caddy site block must not retain the old 30s compact timeout", caddyBlock);
|
||||
|
||||
console.log(JSON.stringify({
|
||||
ok: true,
|
||||
checks: [
|
||||
"existing Codex TOML is upgraded to the Sub2API WSv2 consumer settings",
|
||||
"fresh Codex TOML creates provider and feature sections with WSv2 enabled",
|
||||
"disabled localCodex WebSocket policy renders both consumer flags off",
|
||||
"Caddy site block uses the YAML-controlled long response-header timeout",
|
||||
],
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user