Files
openclaw/extensions/codex/prompt-overlay-runtime-contract.test.ts
pashpashpash 5bcc321343 Scope Codex heartbeat guidance to heartbeat turns (#76788)
* fix(codex): scope heartbeat guidance to collaboration mode

* fix heartbeat tool direct context

* test prompt heartbeat collaboration snapshots

* fix heartbeat changelog credit
2026-05-04 01:58:39 +09:00

49 lines
1.7 KiB
TypeScript

import {
codexPromptOverlayContext,
GPT5_CONTRACT_MODEL_ID,
NON_GPT5_CONTRACT_MODEL_ID,
sharedGpt5PersonalityConfig,
} from "openclaw/plugin-sdk/agent-runtime-test-contracts";
import { describe, expect, it } from "vitest";
import { buildCodexProvider } from "./provider.js";
describe("Codex prompt overlay runtime contract", () => {
it("adds the shared GPT-5 behavior contract to Codex GPT-5 provider runs", () => {
const provider = buildCodexProvider();
const contribution = provider.resolveSystemPromptContribution?.(
codexPromptOverlayContext({ modelId: GPT5_CONTRACT_MODEL_ID }),
);
expect(contribution?.stablePrefix).toContain("<persona_latch>");
expect(contribution?.sectionOverrides?.interaction_style).toContain(
"This is a live chat, not a memo.",
);
expect(contribution?.sectionOverrides?.interaction_style).not.toContain(
"The purpose of heartbeats is to make you feel magical and proactive.",
);
});
it("respects shared GPT-5 prompt overlay config for Codex runs", () => {
const provider = buildCodexProvider();
const contribution = provider.resolveSystemPromptContribution?.(
codexPromptOverlayContext({
modelId: GPT5_CONTRACT_MODEL_ID,
config: sharedGpt5PersonalityConfig("off"),
}),
);
expect(contribution?.stablePrefix).toContain("<persona_latch>");
expect(contribution?.sectionOverrides).toEqual({});
});
it("does not add the shared GPT-5 overlay to non-GPT-5 Codex provider runs", () => {
const provider = buildCodexProvider();
expect(
provider.resolveSystemPromptContribution?.(
codexPromptOverlayContext({ modelId: NON_GPT5_CONTRACT_MODEL_ID }),
),
).toBeUndefined();
});
});