Files
oh-my-pi/packages/coding-agent/test/session-provider-section.test.ts
T
can1357 87010ea61e feat: added WebSocket retry logic with configurable budget and enum-based transport policy
- Added automatic retry logic for WebSocket stream closures before response completion with configurable retry budget.
- Changed `providers.openaiWebsockets` setting from boolean to enum with values 'auto', 'off', 'on' for more granular WebSocket policy control.
- Implemented WebSocket stream retry mechanism that attempts reconnection before falling back to SSE transport when retry budget is exhausted.
- Fixed WebSocket stream retry logic to properly handle mid-stream connection closures and preferWebsockets option handling.
- Added helper functions isCodexWebSocketTransportError() and isCodexWebSocketRetryableStreamError() to classify WebSocket errors.
- Reorganized imports across multiple files for better code organization and consistency.
2026-02-14 00:58:42 +01:00

36 lines
1.2 KiB
TypeScript

import { describe, expect, it } from "bun:test";
import { getProviderDetails, type Model } from "@oh-my-pi/pi-ai";
import { renderProviderSection } from "@oh-my-pi/pi-coding-agent/modes/controllers/command-controller";
describe("session provider section", () => {
it("renders codex provider details with transport fields", () => {
const model: Model<"openai-codex-responses"> = {
id: "gpt-5.3-codex-spark",
name: "GPT-5.3 Codex Spark",
api: "openai-codex-responses",
provider: "openai-codex",
baseUrl: "https://chatgpt.com/backend-api",
reasoning: true,
preferWebsockets: true,
input: ["text"],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 128000,
maxTokens: 128000,
};
const details = getProviderDetails({
model,
sessionId: "session-1",
authMode: "oauth",
});
const output = renderProviderSection(details, { fg: (_color: string, text: string) => text });
expect(output).toContain("Name:");
expect(output).toContain("openai-codex");
expect(output).toContain("Transport:");
expect(output).toContain("WebSocket:");
expect(output).toContain("Reuse:");
expect(output).toContain("Auth:");
});
});