|
| 1 | +import { describe, expect, it } from "vitest"; |
| 2 | +import { |
| 3 | +codexPromptOverlayContext, |
| 4 | +GPT5_CONTRACT_MODEL_ID, |
| 5 | +NON_GPT5_CONTRACT_MODEL_ID, |
| 6 | +sharedGpt5PersonalityConfig, |
| 7 | +} from "../../test/helpers/agents/prompt-overlay-runtime-contract.js"; |
| 8 | +import { buildCodexProvider } from "./provider.js"; |
| 9 | + |
| 10 | +describe("Codex prompt overlay runtime contract", () => { |
| 11 | +it("adds the shared GPT-5 behavior contract to Codex GPT-5 provider runs", () => { |
| 12 | +const provider = buildCodexProvider(); |
| 13 | +const contribution = provider.resolveSystemPromptContribution?.( |
| 14 | +codexPromptOverlayContext({ modelId: GPT5_CONTRACT_MODEL_ID }), |
| 15 | +); |
| 16 | + |
| 17 | +expect(contribution?.stablePrefix).toContain("<persona_latch>"); |
| 18 | +expect(contribution?.sectionOverrides?.interaction_style).toContain( |
| 19 | +"This is a live chat, not a memo.", |
| 20 | +); |
| 21 | +}); |
| 22 | + |
| 23 | +it("respects shared GPT-5 prompt overlay config for Codex runs", () => { |
| 24 | +const provider = buildCodexProvider(); |
| 25 | +const contribution = provider.resolveSystemPromptContribution?.( |
| 26 | +codexPromptOverlayContext({ |
| 27 | +modelId: GPT5_CONTRACT_MODEL_ID, |
| 28 | +config: sharedGpt5PersonalityConfig("off"), |
| 29 | +}), |
| 30 | +); |
| 31 | + |
| 32 | +expect(contribution?.stablePrefix).toContain("<persona_latch>"); |
| 33 | +expect(contribution?.sectionOverrides).toEqual({}); |
| 34 | +}); |
| 35 | + |
| 36 | +it("does not add the shared GPT-5 overlay to non-GPT-5 Codex provider runs", () => { |
| 37 | +const provider = buildCodexProvider(); |
| 38 | + |
| 39 | +expect( |
| 40 | +provider.resolveSystemPromptContribution?.( |
| 41 | +codexPromptOverlayContext({ modelId: NON_GPT5_CONTRACT_MODEL_ID }), |
| 42 | +), |
| 43 | +).toBeUndefined(); |
| 44 | +}); |
| 45 | +}); |