Repository navigation
[codex] Add schema normalization runtime contracts - #71046
100yenadmin wants to merge 6 commits into
Conversation
Greptile SummaryThis PR adds four test-only files that lock the Phase 1 schema-normalization runtime contracts described in RFC #71004. No production code is changed. The helper module, provider-hooks contracts, HTTP/WS transport alignment contracts, and Codex app-server passthrough/fingerprint contracts are all well-structured and consistent with the production implementations reviewed ( Confidence Score: 5/5Safe to merge — test-only addition with no production code changes. All four files are new test-only additions. The contract assertions are logically consistent with the production code paths reviewed. The single finding is a P2 style observation about unnecessary vi.fn() wrappers that have no effect on correctness. No files require special attention. Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/plugin-sdk/schema-normalization-runtime-contract.test.ts
Line: 13-15
Comment:
**`vi.fn()` at describe scope adds no observable value here**
`normalizeToolSchemas` and `inspectToolSchemas` are wrapped with `vi.fn()` at describe-scope and the mocks are never reset between tests, so call-count/call-argument history accumulates across every test in the suite. Since none of the assertions in this file inspect those mocks (only the return values matter), the `vi.fn()` wrapping is a no-op that silently makes the mock history stale after the first test. The same pattern appears in `src/agents/schema-normalization-runtime-contract.test.ts` (lines 13–14). Either assert on the mocks or call the functions directly to keep the intent clear.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "test: add schema normalization runtime c..." | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
Adds Phase 1 schema-normalization runtime contract tests (RFC #71004) to lock current executable tool-schema behavior across provider-compat hooks, OpenAI HTTP/WS transports, and the Codex app-server adapter—explicitly test-only with no production behavior changes.
Changes:
- Introduces shared test fixtures for parameter-free, strict-compatible, and permissive tool schemas plus native/proxy OpenAI(-Codex) model stubs.
- Adds contract tests in
plugin-sdkfor OpenAI-family provider tool-schema normalization (native vs proxy behavior). - Adds contract tests in
agentsandextensions/codexto ensure OpenAI HTTP/WS strict-flag alignment, parameter-free normalization, and Codex dynamic-tool schema pass-through + fingerprint invalidation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/helpers/agents/schema-normalization-runtime-contract.ts | Shared fixtures for tool schemas and native/proxy OpenAI(-Codex) model stubs used by contract tests. |
| src/plugin-sdk/schema-normalization-runtime-contract.test.ts | Provider tool-compat contract tests for OpenAI-family schema normalization behavior (native vs proxy, parameter-free normalization). |
| src/agents/schema-normalization-runtime-contract.test.ts | Transport contract tests ensuring HTTP Responses and WebSocket align on strict flags and parameter-free schema normalization. |
| extensions/codex/src/app-server/schema-normalization-runtime-contract.test.ts | Codex adapter contract tests for dynamic tool schema pass-through at thread start and fingerprint invalidation on schema changes. |
|
@steipete gpt 5.4 fixes contract layer |
Summary
Adds the schema-normalization contract rung from RFC #71004. This is test-only: no production schema normalization, OpenAI transport, Pi runner, or Codex app-server behavior changes.
Files Changed And Why
test/helpers/agents/schema-normalization-runtime-contract.tssrc/plugin-sdk/schema-normalization-runtime-contract.test.tssrc/agents/schema-normalization-runtime-contract.test.tsextensions/codex/src/app-server/schema-normalization-runtime-contract.test.tsContract Matrix
strict:falsedowngrade.todo.Known Red Row
How This Helps The RuntimePlan Work
Tool schema normalization is OpenClaw-owned policy. The runtime plan should normalize executable schemas once before Pi or Codex transports see them. These tests prevent HTTP Responses, WS, compaction, and Codex dynamic-tool boundaries from drifting during that migration.
Reviewer Notes
Verification
node scripts/run-vitest.mjs run --config test/vitest/vitest.unit-fast.config.ts src/plugin-sdk/schema-normalization-runtime-contract.test.ts— 4 passednode scripts/run-vitest.mjs run --config test/vitest/vitest.unit-fast.config.ts src/agents/schema-normalization-runtime-contract.test.ts— 4 passed, 1 todonode scripts/run-vitest.mjs run --config test/vitest/vitest.extensions.config.ts extensions/codex/src/app-server/schema-normalization-runtime-contract.test.ts./node_modules/.bin/oxlint --tsconfig tsconfig.oxlint.core.json test/helpers/agents/schema-normalization-runtime-contract.ts src/plugin-sdk/schema-normalization-runtime-contract.test.ts src/agents/schema-normalization-runtime-contract.test.ts extensions/codex/src/app-server/schema-normalization-runtime-contract.test.tsgit diff --check -- test/helpers/agents/schema-normalization-runtime-contract.ts src/plugin-sdk/schema-normalization-runtime-contract.test.ts src/agents/schema-normalization-runtime-contract.test.ts extensions/codex/src/app-server/schema-normalization-runtime-contract.test.tsRefs #71004
Follows #71009, #71029, #71038, #71039, #71042, #71044