Repository navigation
[codex] Add prompt overlay runtime contracts - #71044
100yenadmin wants to merge 3 commits into
Conversation
Greptile SummaryThis PR adds three test-only files locking the Phase 1 prompt-overlay runtime contracts for GPT-5 overlays on the core agent surface and the Codex provider extension. The
Confidence Score: 4/5Safe to merge for test infrastructure, but one Codex contract test has a silent gap that will fail to catch a future regression in provider scoping. Three of four Codex tests and all core agent tests are correct. One contract test passes vacuously because provider.ts drops the provider ID before reaching the scoping logic, making the OpenAI-family fallback membership check untested. This is a P1 gap in test fidelity — it won't cause a production defect today, but it undermines the stated regression-lock intent of the PR. extensions/codex/prompt-overlay-runtime-contract.test.ts (lines 39–49) and extensions/codex/provider.ts (lines 93–94) where providerId is not forwarded. Prompt To Fix All With AIThis is a comment left during a code review.
Path: extensions/codex/prompt-overlay-runtime-contract.test.ts
Line: 39-49
Comment:
**Contract test passes vacuously — provider scoping not actually verified**
`provider.ts` line 93–94 destructures only `{ config, modelId }` from the `resolveSystemPromptContribution` context and never forwards `provider` as `providerId` to `resolveCodexSystemPromptContribution`. So when this callback runs, `resolveGpt5PromptOverlayMode` is called with `params.providerId = undefined`, making `canUseOpenAiPluginFallback = !undefined = true` unconditionally.
The `provider: CODEX_CONTRACT_PROVIDER_ID` value injected via the `as never` cast is silently dropped before it ever reaches the scoping logic. The test confirms the OpenAI plugin fallback is available to Codex, but for the wrong reason: it would pass equally if `"codex"` were removed from `OPENAI_FAMILY_GPT5_PROMPT_OVERLAY_PROVIDERS`, because the `!providerId` short-circuit fires first. The regression the contract is supposed to lock cannot be caught by this test as written.
To make the contract meaningful, `provider.ts` should pass the provider ID explicitly — `resolveCodexSystemPromptContribution({ config, modelId, providerId: provider })` — so the set-membership check is actually exercised.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "test: add prompt overlay runtime contrac..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 77169629c9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Adds Phase 1 “prompt overlay runtime contract” coverage for RFC #71004 by introducing shared fixtures and contract tests that lock current GPT‑5 overlay behavior across core and the Codex provider surface (test-only; no production runtime changes).
Changes:
- Added a shared test helper to generate minimal config shapes for GPT‑5 overlay scenarios.
- Added core contract tests for
resolveGpt5SystemPromptContribution(behavior contract + friendly style defaults, config overrides, provider scoping, non‑GPT‑5 exclusion). - Added Codex provider contract tests to ensure Codex GPT‑5 runs consume the shared overlay behavior and respect shared/plugin config.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| test/helpers/agents/prompt-overlay-runtime-contract.ts | Shared constants + config builders used by both core and Codex contract tests. |
| src/agents/prompt-overlay-runtime-contract.test.ts | Core GPT‑5 overlay contract tests for default/override/scoping behavior. |
| extensions/codex/prompt-overlay-runtime-contract.test.ts | Codex provider-side contract tests for GPT‑5 overlay contribution behavior. |
There was a problem hiding this comment.
Pull request overview
Adds Phase 1 “prompt overlay” runtime contract tests to lock current GPT‑5 overlay scoping and configuration behavior across the shared resolver and the Codex provider surface, without changing production runtime behavior.
Changes:
- Added a shared test helper fixture for GPT‑5 prompt-overlay contract inputs (provider/model ids + config constructors + Codex context builder).
- Added core contract tests for
resolveGpt5SystemPromptContribution()covering default behavior, shared config override, OpenAI plugin fallback scoping, and non‑GPT‑5 behavior. - Added Codex extension contract tests asserting Codex provider runs consume the shared GPT‑5 overlay behavior and respect shared config.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/helpers/agents/prompt-overlay-runtime-contract.ts | Shared contract constants + config builders + Codex ProviderSystemPromptContributionContext builder used by tests. |
| src/agents/prompt-overlay-runtime-contract.test.ts | Contract tests for core GPT‑5 overlay resolver behavior/scoping. |
| extensions/codex/prompt-overlay-runtime-contract.test.ts | Contract tests verifying Codex provider integrates the shared GPT‑5 overlay behavior and respects config. |
|
@steipete gpt 5.4 fixes contract layer |
Summary
Adds the prompt-overlay contract rung from RFC #71004. This is test-only: no production prompt, provider runtime, Pi runner, or Codex app-server behavior changes.
Files Changed And Why
test/helpers/agents/prompt-overlay-runtime-contract.tssrc/agents/prompt-overlay-runtime-contract.test.tsextensions/codex/prompt-overlay-runtime-contract.test.tsContract Matrix
agents.defaults.promptOverlays.gpt5.personality = offdisables friendly style but preserves behavior contract.plugins.entries.openai.config.personalityfallback affects OpenAI-family GPT-5 providers but does not leak to non-OpenAI GPT-5 providers.How This Helps The RuntimePlan Work
Prompt overlays are OpenClaw-owned policy. The plan should compute overlay chains once and hand them to whichever adapter runs the model. These tests prevent OpenAI plugin personality fallback from leaking into unrelated providers while keeping Codex/OpenAI-family behavior aligned.
Reviewer Notes
Verification
node scripts/run-vitest.mjs run --config test/vitest/vitest.agents.config.ts src/agents/prompt-overlay-runtime-contract.test.tsnode scripts/run-vitest.mjs run --config test/vitest/vitest.extensions.config.ts extensions/codex/prompt-overlay-runtime-contract.test.ts./node_modules/.bin/oxlint --tsconfig tsconfig.oxlint.core.json test/helpers/agents/prompt-overlay-runtime-contract.ts src/agents/prompt-overlay-runtime-contract.test.ts extensions/codex/prompt-overlay-runtime-contract.test.tsgit diff --check -- test/helpers/agents/prompt-overlay-runtime-contract.ts src/agents/prompt-overlay-runtime-contract.test.ts extensions/codex/prompt-overlay-runtime-contract.test.tsRefs #71004
Follows #71009, #71029, #71038, #71039, #71042