Skip to content

test: align Codex provider payload test#74536

Merged
jalehman merged 2 commits into
openclaw:mainfrom
jalehman:frida-416fa805-fix-openai-baseline-test
Apr 29, 2026
Merged

test: align Codex provider payload test#74536
jalehman merged 2 commits into
openclaw:mainfrom
jalehman:frida-416fa805-fix-openai-baseline-test

Conversation

@jalehman

Copy link
Copy Markdown
Contributor

What

Aligns the OpenAI provider Codex payload composition test with the current native Codex transport route.

Why

ChatGPT-hosted Codex requests now swap in OpenClaw native Responses transport for attribution, so the test fake upstream stream no longer observes the payload directly.

Changes

  • Mock native Codex transport
  • Keep service_tier coverage
  • Assert transport handoff

Testing

  • pnpm test extensions/openai/openai-provider.test.ts -- --reporter=verbose
  • pnpm test:changed
  • pnpm exec oxfmt --check --threads=1 extensions/openai/openai-provider.test.ts
  • pnpm check:changed
  • git diff --check

@clawsweeper

clawsweeper Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes:

The PR updates extensions/openai/openai-provider.test.ts to mock the provider stream-family SDK subpath, inject a native Codex transport mock, keep payload assertions, and assert the Codex native transport handoff.

Maintainer follow-up before merge:

This is an open implementation PR with a protected maintainer label; the remaining action is maintainer review and CI validation, especially around whether the mocked SDK wrapper chain should be revised before landing.

Security review:

Security review cleared: The patch is limited to a Vitest test file and does not change runtime code, workflows, dependencies, lockfiles, package scripts, publishing metadata, permissions, downloaded artifacts, or secret handling.

Review details

Best possible solution:

Keep the PR open for maintainer review and CI. The desired end state is a focused OpenAI provider test that verifies the Codex native transport handoff while preserving confidence that the provider still uses the canonical SDK stream-family behavior.

Acceptance criteria:

  • pnpm test extensions/openai/openai-provider.test.ts -- --reporter=verbose
  • pnpm test:changed
  • pnpm exec oxfmt --check --threads=1 extensions/openai/openai-provider.test.ts
  • pnpm check:changed
  • git diff --check

What I checked:

  • Protected label: The provided GitHub context lists the maintainer label on this open PR, so the cleanup policy requires explicit maintainer handling rather than auto-close or repair automation.
  • PR diff scope: The public PR diff modifies only extensions/openai/openai-provider.test.ts, adding a hoisted mock object, mocking openclaw/plugin-sdk/provider-stream-family, resetting the native transport mock before each test, and asserting the Codex native transport call. (extensions/openai/openai-provider.test.ts:1, 79dac5e4b309)
  • Production native Codex route: Current main's attribution wrapper routes openai-codex traffic through codexNativeTransportStreamFn when injected, otherwise through createOpenAIResponsesTransportStreamFn(), matching the PR's stated native transport concern. (src/agents/pi-embedded-runner/openai-stream-wrappers.ts:491, 7c51cd2baf1c)
  • SDK hook composition: Current main's OpenAI Responses stream-family hook composes attribution, fast mode, service tier, text verbosity, Codex native web search, string content, thinking-level, reasoning compatibility, and context management wrappers. (src/plugin-sdk/provider-stream.ts:103, 7c51cd2baf1c)
  • OpenAI plugin SDK boundary: The OpenAI plugin builds provider hooks from OPENAI_RESPONSES_STREAM_HOOKS via the plugin SDK subpath and wraps it with provider-local native web search behavior, so the PR is changing a test around the same boundary production uses. (extensions/openai/shared.ts:86, 7c51cd2baf1c)
  • Current main test path: Current main's Codex wrapper composition test still calls runWrappedPayloadCase, whose fake upstream stream invokes options.onPayload; that is the path the PR replaces with a native transport mock for Codex. (extensions/openai/openai-provider.test.ts:679, 7c51cd2baf1c)

Likely related people:

  • steipete: Recent public history shows OpenAI provider, native web search, native transport, and OpenAI provider test maintenance, including the native attribution transport change this PR adapts to. (role: recent maintainer; confidence: high; commits: d1b2d81752b8, 713807b55d0b, a81c4757311a; files: src/agents/pi-embedded-runner/openai-stream-wrappers.ts, extensions/openai/openai-provider.test.ts, extensions/openai/shared.ts)
  • vincentkoc: Public history links this maintainer to shared provider stream hook families and provider stream wrapper composition, which is the SDK boundary mocked by the PR. (role: SDK stream-family owner; confidence: medium; commits: eea7ba53455a, 30479b4ee049, 7ad72281f73d; files: src/plugin-sdk/provider-stream.ts, src/plugin-sdk/provider-stream-family.ts)
  • jalehman: Although this person authored the PR, they also appear in merged history for moving provider replay/runtime ownership into plugins, which is adjacent to the OpenAI provider test and plugin boundary touched here. (role: prior provider runtime contributor; confidence: medium; commits: 799c6f40aa69; files: extensions/openai/openai-provider.test.ts, extensions/openai/shared.ts, src/plugin-sdk/provider-stream.ts)
  • a-tokyo: Public history links this contributor to OpenAI Responses thinking-level mapping in the current stream-family chain, which maintainers may want to keep aligned when reviewing the mocked chain. (role: adjacent wrapper contributor; confidence: low; commits: c92490881b71; files: src/plugin-sdk/provider-stream.ts, src/agents/pi-embedded-runner/openai-stream-wrappers.ts)

Remaining risk / open question:

  • I did not run tests because this review was explicitly read-only; the PR body reports targeted test, changed-test, formatter, changed-check, and diff-check runs.
  • The PR mock reimplements the SDK stream-family chain to inject the native transport and does not include the non-exported string-content or thinking-level wrappers from current main's production hook; this was not a proven bug in the changed assertion, but it is the main point for maintainer review.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 7c51cd2baf1c.

@jalehman jalehman force-pushed the frida-416fa805-fix-openai-baseline-test branch from e002916 to 541c14b Compare April 29, 2026 19:08
@jalehman jalehman force-pushed the frida-416fa805-fix-openai-baseline-test branch from 541c14b to 79dac5e Compare April 29, 2026 19:51
@jalehman jalehman merged commit f05b789 into openclaw:main Apr 29, 2026
76 of 77 checks passed
lxe pushed a commit to lxe/openclaw that referenced this pull request May 6, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant