Skip to content

🐛 fix openai codex reasoning and thinking - openai/gpt-5.1-codex currently breaks with 400#61982

Merged
steipete merged 4 commits intoopenclaw:mainfrom
a-tokyo:hotfix/openai-codex-reasoning
Apr 21, 2026
Merged

🐛 fix openai codex reasoning and thinking - openai/gpt-5.1-codex currently breaks with 400#61982
steipete merged 4 commits intoopenclaw:mainfrom
a-tokyo:hotfix/openai-codex-reasoning

Conversation

@a-tokyo
Copy link
Copy Markdown
Contributor

@a-tokyo a-tokyo commented Apr 6, 2026

Closes #62045
Closes #64069

Summary

  • Problem: The openai-responses-defaults stream family never maps ctx.thinkingLevel to reasoning.effort in the API payload. For models like gpt-5.1-codex and gpt-5.3-codex that only accept specific effort values (e.g. "medium"), the missing mapping causes buildOpenAIResponsesParams to fall back to reasoning: { effort: "none" }, which the API rejects with HTTP 400.
  • Why it matters: Any OpenAI/Codex reasoning model that restricts supported effort values is unusable — every request fails. The /think command has no effect on OpenAI providers despite working correctly for OpenRouter and Kilocode.
  • What changed: Added createOpenAIThinkingLevelWrapper (mirrors the existing createOpenRouterWrapper pattern) and wired it as the innermost wrapper in the openai-responses-defaults stream family chain — its onPayload fires first, overriding the SDK's fallback before outer wrappers run. Gated by shouldApplyOpenAIReasoningCompatibility(model) (same capability check as the compat wrapper) so proxy routes and non-OpenAI endpoints are excluded. The wrapper only mutates an existing reasoning object — it never creates one from scratch, so non-reasoning models (which have no reasoning in the payload) are left untouched. Extracted shared mapThinkingLevelToReasoningEffort to reasoning-effort-utils.ts to eliminate duplication with the OpenRouter/Kilocode wrapper. Added unit tests.
  • What did NOT change (scope boundary): The buildOpenAIResponsesParams fallback (reasoning: { effort: "none" }) is untouched — the wrapper overrides it via onPayload. No PI SDK changes. No config schema changes.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: The openai-responses-defaults stream family in provider-stream-family.ts (and the duplicate in provider-stream.ts) has ctx.thinkingLevel available on the context but never passes it to any wrapper. createOpenAIReasoningCompatibilityWrapper only applies payload policy (store mode), not reasoning effort injection. By contrast, the openrouter-thinking and kilocode-thinking families correctly extract ctx.thinkingLevel and pass it to their wrappers which call normalizeProxyReasoningPayload.
  • Missing detection / guardrail: No unit test verified that the openai-responses-defaults family propagates thinkingLevel to the API payload's reasoning.effort field.
  • Contributing context (if known): The OpenAI Codex provider (openai-codex) uses buildProviderStreamFamilyHooks("openai-responses-defaults") — the same family as the regular openai provider. When gpt-5.1-codex was added with restricted reasoning effort support (only "medium"), the missing mapping became a hard failure instead of a silent default.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/agents/pi-embedded-runner/openai-stream-wrappers.test.ts
  • Scenario the test should lock in: When createOpenAIThinkingLevelWrapper is given a thinkingLevel and a reasoning-capable model (payload already has reasoning), the resulting StreamFn overrides reasoning.effort via onPayload. All ThinkLevel values map correctly ("off""none", "adaptive""medium", others pass through). Existing reasoning.effort values from upstream wrappers are overridden. Other reasoning properties (e.g. summary) are preserved. Non-reasoning models (no reasoning in payload) are left untouched. Proxy routes and completions API are skipped via capability gate.
  • Why this is the smallest reliable guardrail: Unit tests on the wrapper function directly verify payload mutation without needing a live model or full agent runtime.
  • Existing test that already covers this (if any): pi-embedded-runner-extraparams.test.ts tests the OpenAI wrapper chain but did not assert reasoning.effort injection from thinkingLevel. Updated to wire the new wrapper into the test helper.
  • If no new test is added, why not: New test file added (openai-stream-wrappers.test.ts).

User-visible / Behavior Changes

  • /think <level> now correctly propagates to OpenAI and OpenAI Codex models. Previously it had no effect — the API payload always used the buildOpenAIResponsesParams fallback.
  • Models like gpt-5.1-codex that only accept specific reasoning effort values will no longer fail with HTTP 400 when the resolved thinking level matches a supported value.

Diagram (if applicable)

Before:
  ctx.thinkingLevel = "medium"
    → openai-responses-defaults wrapStreamFn
      → createOpenAIReasoningCompatibilityWrapper (policy only, no effort injection)
        → buildOpenAIResponsesParams: reasoning = { effort: "none" }  ← HARDCODED FALLBACK
          → API rejects: 400 "none" not supported

After (onPayload fires inner-to-outer):
  ctx.thinkingLevel = "medium"
    → openai-responses-defaults wrapStreamFn
      → createOpenAIThinkingLevelWrapper (innermost — fires first)
        → createOpenAIReasoningCompatibilityWrapper (fires second — can strip for compat endpoints)
          → createOpenAIResponsesContextManagementWrapper (fires last — store/cache policy)
            → buildOpenAIResponsesParams: reasoning = { effort: "none" }
              → onPayload[1] thinking wrapper: effort overwritten to "medium"
                → onPayload[2] compat wrapper: preserves or strips based on endpoint policy
                  → onPayload[3] context mgmt: store/cache policy
                    → API accepts: 200 OK

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No

Repro + Verification

Environment

  • OS: macOS (Docker)
  • Runtime/container: OpenClaw v2026.4.5, Docker (node:22)
  • Model/provider: openai-codex / gpt-5.1-codex
  • Integration/channel (if any): Slack
  • Relevant config (redacted): Default config with agent.model: "openai/gpt-5.1-codex"

Steps

  1. Configure agent.model to openai/gpt-5.1-codex (or any Codex model with restricted reasoning effort)
  2. Send any message to the agent
  3. Observe gateway logs for the API request

Expected

  • API request includes reasoning: { effort: "medium" } (or the user's /think level)
  • Model responds successfully

Actual (before fix)

  • API request includes reasoning: { effort: "none" } (hardcoded fallback)
  • API returns HTTP 400: 'none' is not supported with the 'gpt-5.1-codex' model. Supported values are: 'medium'
  • Agent falls back to next model in failover chain

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Gateway log before fix:

candidate_failed requested=openai/gpt-5.1-codex reason=format next=anthropic/claude-haiku-4-5

Human Verification (required)

  • Verified scenarios: OpenAI codex 5.1 works, codex 5.3 works, 5.4 works.
  • Edge cases checked: thinkingLevel undefined (wrapper is a no-op, returns underlying directly), thinkingLevel "off" (maps to "none"), thinkingLevel "adaptive" (maps to "medium"), existing reasoning object with other properties preserved, no reasoning object in payload (wrapper is a no-op — non-reasoning models are safe), proxy routes with custom baseUrl (skipped via capability gate), completions API (skipped).
  • What you did not verify: Full pnpm build and pnpm test (build is very slow on this machine). Did not verify WebSocket transport path end-to-end (only traced code). Did not verify with live gpt-5.1-codex API call post-fix.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Risks and Mitigations

  • Risk: The wrapper overrides reasoning.effort on any existing reasoning object.
    • Mitigation: The wrapper is innermost — its onPayload fires first. Outer wrappers (createOpenAIReasoningCompatibilityWrapper, createOpenAIResponsesContextManagementWrapper) run after and can still strip or adjust based on endpoint policy. The same shouldApplyOpenAIReasoningCompatibility capability gate excludes proxy routes and non-OpenAI endpoints. If a model doesn't support the requested effort level, the API returns a clear error (same behavior as OpenRouter).
  • Risk: Non-reasoning models could receive an unexpected reasoning payload.
    • Mitigation: The wrapper only mutates an existing reasoning object — it never creates one. The SDK only adds reasoning for models with model.reasoning === true, so non-reasoning models are inherently excluded.
  • Risk: mapThinkingLevelToReasoningEffort is shared across OpenAI and OpenRouter/Kilocode wrappers via reasoning-effort-utils.ts.
    • Mitigation: Extracted to a single source of truth to eliminate drift risk. Both openai-stream-wrappers.ts and proxy-stream-wrappers.ts import from the shared util.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M labels Apr 6, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 6, 2026

Greptile Summary

Adds createOpenAIThinkingLevelWrapper to the openai-responses-defaults stream family, wiring ctx.thinkingLevel into the reasoning.effort field of the API payload. Previously, the buildOpenAIResponsesParams fallback of reasoning: { effort: "none" } was always used, causing HTTP 400 for models like gpt-5.1-codex that only accept specific effort values. The fix mirrors the existing createOpenRouterWrapper/createKilocodeWrapper pattern and is covered by comprehensive new unit tests.

Confidence Score: 5/5

Safe to merge — the fix is additive, matches established patterns, and is well-tested.

The only remaining finding is P2 (duplicated mapper function, already acknowledged in the PR description). The wrapper chain ordering is correct: as the outermost wrapper, createOpenAIThinkingLevelWrapper's patchPayload runs after inner patches, giving it the final say on reasoning.effort. Tests are comprehensive.

No files require special attention.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/agents/pi-embedded-runner/openai-stream-wrappers.ts
Line: 220-230

Comment:
**Duplicated mapper function**

The new `mapThinkingLevelToReasoningEffort` (lines 220–230) is byte-for-byte identical to `mapThinkingLevelToOpenRouterReasoningEffort` in `proxy-stream-wrappers.ts` (same `"off" → "none"`, `"adaptive" → "medium"`, pass-through mapping). The PR already acknowledges this and proposes a follow-up cleanup. Worth flagging so it doesn't get forgotten — extracting a shared util to `openai-stream-wrappers.ts` (or a new `reasoning-effort-utils.ts`) and re-exporting from `proxy-stream-wrappers.ts` would eliminate the drift risk.

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

Reviews (1): Last reviewed commit: "Merge branch 'main' into hotfix/openai-c..." | Re-trigger Greptile

Comment thread src/agents/pi-embedded-runner/openai-stream-wrappers.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: d248d450fc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/plugin-sdk/provider-stream-family.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: c203b479c6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/agents/pi-embedded-runner/openai-stream-wrappers.ts Outdated
@a-tokyo a-tokyo force-pushed the hotfix/openai-codex-reasoning branch from c203b47 to 2f8ea2e Compare April 6, 2026 17:01
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: 2f8ea2ecf8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/agents/pi-embedded-runner/openai-stream-wrappers.ts Outdated
@a-tokyo a-tokyo changed the title 🐛 fix openai codex reasoning and thinking - openai/gpt-5.1-codex currently breaks with 400 🐛 fix openai codex reasoning and thinking - openai/gpt-5.1-codex currently breaks with 400 on 5.1-codex Apr 6, 2026
@a-tokyo a-tokyo changed the title 🐛 fix openai codex reasoning and thinking - openai/gpt-5.1-codex currently breaks with 400 on 5.1-codex 🐛 fix openai codex reasoning and thinking - openai/gpt-5.1-codex currently breaks with 400 Apr 6, 2026
@a-tokyo a-tokyo changed the title 🐛 fix openai codex reasoning and thinking - openai/gpt-5.1-codex currently breaks with 400 🐛 fix openai codex reasoning and thinking - openai/gpt-5.1-codex currently breaks with 400 Apr 6, 2026
@a-tokyo a-tokyo force-pushed the hotfix/openai-codex-reasoning branch from 5182e9c to 6d9aac3 Compare April 6, 2026 17:24
@a-tokyo
Copy link
Copy Markdown
Contributor Author

a-tokyo commented Apr 6, 2026

@codex review

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: 5f622af5ed

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/agents/pi-embedded-runner/openai-stream-wrappers.ts
@a-tokyo
Copy link
Copy Markdown
Contributor Author

a-tokyo commented Apr 6, 2026

@codex review

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: c188699452

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/agents/pi-embedded-runner/openai-stream-wrappers.ts
@a-tokyo
Copy link
Copy Markdown
Contributor Author

a-tokyo commented Apr 6, 2026

@codex review

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: c188699452

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/agents/pi-embedded-runner/openai-stream-wrappers.ts Outdated
@a-tokyo
Copy link
Copy Markdown
Contributor Author

a-tokyo commented Apr 6, 2026

@codex, review

@a-tokyo a-tokyo force-pushed the hotfix/openai-codex-reasoning branch from fddcc01 to 88a7044 Compare April 8, 2026 09:45
@a-tokyo
Copy link
Copy Markdown
Contributor Author

a-tokyo commented Apr 8, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@G7CNF
Copy link
Copy Markdown

G7CNF commented Apr 12, 2026

Please add Closes #62045 and Closes #64069 to the PR description so both issues will auto-close when this merges. I already cross-linked both issues in comments.

@a-tokyo
Copy link
Copy Markdown
Contributor Author

a-tokyo commented Apr 12, 2026

@G7CNF Done 💪🏻

@steipete steipete force-pushed the hotfix/openai-codex-reasoning branch from 2e35fa2 to 6632171 Compare April 21, 2026 03:47
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: 6632171fca

ℹ️ 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 on lines +259 to +260
(existingReasoning as Record<string, unknown>).effort =
mapThinkingLevelToReasoningEffort(thinkingLevel);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reapply OpenAI effort compat before overriding reasoning

This assignment writes mapThinkingLevelToReasoningEffort(thinkingLevel) straight into payload.reasoning.effort, which bypasses the existing OpenAI normalization/compat path. In practice, /think minimal now emits "minimal" instead of the normalized "low", and models with compatibility remaps (for example low→medium for Codex mini) can be overwritten back to unsupported values, causing request 400s that the transport layer currently avoids. Please run the same OpenAI effort normalization/model-compat mapping before setting payload.reasoning.effort in this wrapper.

Useful? React with 👍 / 👎.

@steipete steipete force-pushed the hotfix/openai-codex-reasoning branch from 6632171 to ceddfe2 Compare April 21, 2026 04:19
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Apr 21, 2026
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: ceddfe2901

ℹ️ 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 on lines +259 to +260
(existingReasoning as Record<string, unknown>).effort =
mapThinkingLevelToReasoningEffort(thinkingLevel);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve model effort remap before setting reasoning.effort

createOpenAIThinkingLevelWrapper writes the raw /think mapping directly into payload.reasoning.effort, which overrides the model-specific compatibility remap already applied in buildOpenAIResponsesParams (e.g. minimal|low -> medium for gpt-5.1-codex-mini / gpt-5.4-mini). On those models, /think low can now send "low" again and trigger OpenAI 400s that the transport remap path was avoiding. Fresh evidence in this commit: the new openai-stream-wrappers.test.ts case "passes through all thinking levels correctly" asserts passthrough of unsupported levels for Codex models instead of compatibility-normalized values.

Useful? React with 👍 / 👎.

@steipete steipete force-pushed the hotfix/openai-codex-reasoning branch from ceddfe2 to 28b91ba Compare April 21, 2026 04:31
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: 28b91ba7eb

ℹ️ 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 on lines +243 to +246
if (thinkingLevel === "off") {
if (existingReasoning !== undefined) {
delete payloadObj.reasoning;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Clear reasoning include when disabling thinking payload

In /think off mode this branch deletes payload.reasoning but does not clear include, so OpenAI Responses requests can retain include: ["reasoning.encrypted_content"] from buildOpenAIResponsesParams (src/agents/openai-transport-stream.ts) while reasoning is absent. That produces an inconsistent payload shape and can trigger 400s on strict endpoints or silently keep reasoning-specific response plumbing active even though thinking was explicitly disabled.

Useful? React with 👍 / 👎.

const distRuntimeAddedPaths = distRuntimeAddedPathSummary.topologyAddedPaths.length;
const distRuntimeIgnoredDependencyAddedPaths =
distRuntimeAddedPathSummary.ignoredDependencyAddedPaths.length;
const distRuntimeFileGrowth = distRuntimeAddedPaths;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Measure dist-runtime file growth from file counts

This now sets distRuntimeFileGrowth from added topology path count, but diff.added is built from listTreeEntries (same file), which includes directories and root entries, not just files. The distRuntimeFileGrowth gate can therefore overcount and fail on directory-only changes or rename churn where net file growth is unchanged. Use snapshot file deltas (or filter added entries to files) before comparing against distRuntimeFileGrowthMax.

Useful? React with 👍 / 👎.

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: aaee702fc8

ℹ️ 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 on lines +633 to +635
distRuntimeAddedPaths === 0
? 0
: post.distRuntime.apparentBytes - pre.distRuntime.apparentBytes;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep byte-growth checks for rewritten dist-runtime files

This change zeroes distRuntimeByteGrowth whenever no new topology paths are added, so in-place rewrites of existing dist-runtime files (same path set, larger files) will bypass distRuntimeByteGrowthMax entirely. In that scenario the watch-regression gate can silently pass substantial dist-runtime churn that previously would have been caught by the snapshot byte delta.

Useful? React with 👍 / 👎.

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: 0de8d8743f

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

}

export function createBundledRuntimeDependencyInstallArgs(missingSpecs) {
return ["install", "--ignore-scripts", ...missingSpecs];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep dev deps out of eager bundled-runtime installs

createBundledRuntimeDependencyInstallArgs now emits only npm install --ignore-scripts <specs>, removing the previous dev-omit behavior. In runBundledPluginPostinstall, that install runs with cwd: packageRoot, so when OPENCLAW_EAGER_BUNDLED_PLUGIN_DEPS=1 is enabled on packaged installs, npm can reify the root manifest and pull devDependencies in addition to the missing runtime specs, which can massively increase install size/time and fail in restricted or offline environments; this path should keep an explicit dev omit (--omit=dev or equivalent env).

Useful? React with 👍 / 👎.

@steipete steipete force-pushed the hotfix/openai-codex-reasoning branch from 0de8d87 to 782bc55 Compare April 21, 2026 06:11
@steipete steipete force-pushed the hotfix/openai-codex-reasoning branch from 782bc55 to 40462cb Compare April 21, 2026 06:20
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: 40462cb049

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

}

export function createBundledRuntimeDepsInstallArgs(missingSpecs: readonly string[]): string[] {
return ["install", "--ignore-scripts", ...missingSpecs];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep dev deps excluded in bundled runtime dep installs

createBundledRuntimeDepsInstallArgs now runs npm install --ignore-scripts <specs> without any dev-omit flag, and installBundledRuntimeDeps executes that in each plugin root. On npm defaults (omit=[]), this can reify plugin devDependencies alongside the missing runtime specs, which significantly increases startup install size/time and can fail in constrained/offline environments when ensureBundledPluginRuntimeDeps runs during plugin load. Please restore an explicit dev exclusion for this install path.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Reviewed/reworked before landing.

Key changes:

  • native OpenAI Responses /think off now omits/deletes reasoning; enabled levels set reasoning.effort through a shared mapper (adaptive -> medium, max -> xhigh).
  • proxy/OpenRouter/Kilocode reasoning uses the same mapper while preserving off -> none.
  • qa-lab JSON parsing now tolerates startup repair/plugin logs before compact or pretty JSON.
  • gateway topology guard ignores only repaired shared runtime deps under dist-runtime/extensions/node_modules/**.
  • bundled runtime dependency install no longer passes npm-only flags to pnpm-backed runners.
  • bundled runtime dependency repair now honors normal package-root module resolution, avoiding redundant QA/startup repairs.

Validation:

  • pnpm check:changed
  • focused OpenAI/provider/QA/runtime-deps suites
  • mock qa suite thread-memory-isolation and approval-turn-tool-followthrough with openai/gpt-5.4
  • live OpenAI Responses smoke via .profile key on gpt-5.4-nano
  • GitHub CI / Install Smoke / Workflow Sanity / Parity gate on c7f3958a2b

Thanks @a-tokyo!

@steipete steipete merged commit 0532feb into openclaw:main Apr 21, 2026
92 checks passed
Copy link
Copy Markdown
Contributor

Landed via rebase on main.

Source head: c7f3958a2bae83a05fe1ac919784a1e5aca2c2c5
Main commit: 0532feb0d3b2b288f457199942361ba325e92969

Thanks again @a-tokyo.

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: c7f3958a2b

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

.toSorted((left, right) => left.localeCompare(right));
const missingSpecs = deps
.filter((dep) => !fs.existsSync(path.join(installRoot, dependencySentinelPath(dep.name))))
.filter((dep) => !hasDependencySentinel(dependencySearchRoots, dep))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Check runtime dep versions before skipping plugin install

The new missingSpecs check now treats any parent node_modules/<dep>/package.json as “installed” via hasDependencySentinel, but it never validates that the resolved version satisfies the plugin’s declared dep.version. In the case where dist/node_modules or package-root node_modules contains the same package name at an incompatible version, ensureBundledPluginRuntimeDeps will skip installation and the plugin will run against that incompatible dependency. Please compare resolved versions (or semver-satisfy against dep.version) before considering parent-root dependencies as satisfied.

Useful? React with 👍 / 👎.

@a-tokyo
Copy link
Copy Markdown
Contributor Author

a-tokyo commented Apr 21, 2026

@steipete Awesome, Thank you! ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: qa-lab scripts Repository scripts size: L

Projects

None yet

3 participants