Skip to content

[codex] Add transport params runtime contracts#71048

Closed
100yenadmin wants to merge 4 commits intoopenclaw:mainfrom
electricsheephq:contract-first/transport-params-runtime-contracts
Closed

[codex] Add transport params runtime contracts#71048
100yenadmin wants to merge 4 commits intoopenclaw:mainfrom
electricsheephq:contract-first/transport-params-runtime-contracts

Conversation

@100yenadmin
Copy link
Copy Markdown
Contributor

@100yenadmin 100yenadmin commented Apr 24, 2026

Summary

Adds the transport-params contract rung from RFC #71004. This is test-only: it documents OpenClaw-owned GPT-5/OpenAI-family transport policy that must stay stable while Pi and Codex move toward a shared AgentRuntimePlan.

No production runtime behavior changes.

flowchart TD
  ModelRef["Resolved model/provider"] --> ExtraParams["Pi/OpenAI extra params"]
  Config["OpenClaw config + think level"] --> ExtraParams
  Hooks["Provider prep + transport patch hooks"] --> ExtraParams
  ExtraParams --> Defaults["GPT-5 transport defaults"]
  ExtraParams --> Payload["Responses payload mutation"]
  ExtraParams --> StreamOptions["Stream options propagation"]
  Defaults --> Contract["Transport params contract"]
  Payload --> Contract
  StreamOptions --> Contract
Loading

Files Changed And Why

File Purpose
test/helpers/agents/transport-params-runtime-contract.ts Shared transport-default constants/cases.
src/agents/transport-params-runtime-contract.test.ts Pi/OpenAI transport policy rows for defaults, payload mutation, reasoning, warmup, and provider prep composition.

Contract Matrix

Surface Covered behavior
OpenAI-family GPT-5 defaults openai/* and openai-codex/* receive exact shared GPT-5 defaults.
Non-OpenAI providers Non-OpenAI GPT-5 providers do not inherit OpenAI transport defaults.
API family handling parallel_tool_calls support includes openai-codex-responses.
Payload mutation openai-codex/gpt-5.4 Responses-family payloads receive the expected transport patch.
WS warmup OpenAI GPT-5 warmup defaults propagate with openaiWsWarmup: false.
Reasoning OpenAI GPT-5 thinking level maps into Responses reasoning.effort when the reasoning wrapper is active.
Provider prep Provider preparation composes before transport patch resolution.

Intentional Boundary

Codex app-server startup config and turn-start effort mapping are intentionally excluded from this PR. Those are Codex adapter lifecycle concerns, not shared Pi/OpenAI transport-param policy, and should be covered when Codex consumes AgentRuntimePlan.

How This Helps The RuntimePlan Work

Transport params are currently easy to scatter by API string and wrapper path. These tests define the shared policy that the plan should compute once, especially around openai-codex-responses and GPT-5 defaults.

Reviewer Notes

  • Test-only; no production transport code changes.
  • Captures the audit’s Bug 2 class and the Bug 5 warmup default guard.
  • Scope is deliberately Pi/OpenAI transport policy, not Codex app-server lifecycle.

Verification

  • node scripts/run-vitest.mjs run --config test/vitest/vitest.agents.config.ts src/agents/transport-params-runtime-contract.test.ts
  • ./node_modules/.bin/oxlint --tsconfig tsconfig.oxlint.core.json test/helpers/agents/transport-params-runtime-contract.ts src/agents/transport-params-runtime-contract.test.ts
  • git diff --check -- test/helpers/agents/transport-params-runtime-contract.ts src/agents/transport-params-runtime-contract.test.ts

Refs #71004
Follows #71009, #71029, #71038, #71039, #71042, #71044, #71046

@100yenadmin 100yenadmin marked this pull request as ready for review April 24, 2026 09:38
Copilot AI review requested due to automatic review settings April 24, 2026 09:38
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 24, 2026

Greptile Summary

This PR adds a test-only Phase 1 runtime contract suite covering OpenAI/Pi transport defaults, alias normalization, API-family parallel_tool_calls payload boundaries, hook composition order, and Codex app-server turn params. No production code is modified; all contracts accurately reflect the existing implementations in extra-params.ts, provider-api-families.ts, and thread-lifecycle.ts.

Confidence Score: 5/5

Safe to merge — test-only change with no production runtime impact.

All remaining findings are P2 style/robustness suggestions (fragile optional-chain lookup, unused api fixture fields). The contract logic correctly mirrors the production implementations verified by reading the source files.

No files require special attention beyond the two P2 comments.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/agents/transport-params-runtime-contract.test.ts
Line: 119-120

Comment:
The `?.thinkLevel` optional chain here silently produces `undefined` if `"high"` is ever removed from `CODEX_REASONING_EFFORT_CASES`, causing the test to pass with no `thinkingLevel` rather than failing loudly. Since the intent is simply to pick a high-effort level for the hook-order test, a direct literal avoids the fragility entirely.

```suggestion
      thinkingLevel: "high",
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: test/helpers/agents/transport-params-runtime-contract.ts
Line: 6-27

Comment:
The `api` field in `OPENAI_GPT5_TRANSPORT_DEFAULT_CASES` and `NON_OPENAI_GPT5_TRANSPORT_CASE` is exported but never consumed by any test — `resolveExtraParams` only takes `{ cfg, provider, modelId }`. If the intent is to document which API family each case corresponds to, a comment would make that clearer; if it was meant to feed a future API-boundary assertion, a note to that effect would help future readers.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "test: add transport params runtime contr..." | Re-trigger Greptile

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Phase 1, test-only runtime contract suite to lock down transport-parameter behavior across the Pi/OpenAI path and the Codex app-server adapter, as groundwork for a shared AgentRuntimePlan (RFC #71004).

Changes:

  • Introduces shared contract fixtures for GPT-5 transport defaults, API-family payload patch boundaries, and Codex adapter inputs.
  • Adds Pi-side contract tests covering OpenAI GPT-5 defaults, alias normalization, payload patch eligibility, and provider hook ordering.
  • Adds Codex app-server contract tests covering adapter transport config preservation and think-level → effort mapping.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
test/helpers/agents/transport-params-runtime-contract.ts Shared fixtures/constants used by both Pi and Codex contract tests.
src/agents/transport-params-runtime-contract.test.ts Pi/OpenAI runtime contract tests for defaults, alias normalization, payload patch support, and hook ordering.
extensions/codex/src/app-server/transport-params-runtime-contract.test.ts Codex adapter contract tests for app-server runtime options and turn effort mapping.

Comment thread src/agents/transport-params-runtime-contract.test.ts Outdated
Comment thread test/helpers/agents/transport-params-runtime-contract.ts
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1eddd6ba1e

ℹ️ 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".

Comment thread extensions/codex/src/app-server/transport-params-runtime-contract.test.ts Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ba03cbbdd2

ℹ️ 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".

Comment thread src/agents/transport-params-runtime-contract.test.ts
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread src/agents/transport-params-runtime-contract.test.ts
Comment thread src/agents/transport-params-runtime-contract.test.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@steipete
Copy link
Copy Markdown
Contributor

Closing as superseded by #71096, which consolidates this contract shard into the single RuntimePlan / Pi-Codex parity review branch.

Codex review note: keeping the individual shard open would split the same contract surface across multiple stale branches now that #71096 carries the combined stack.

@steipete steipete closed this Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants