87010ea61e
- 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.
36 lines
1.2 KiB
TypeScript
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:");
|
|
});
|
|
});
|