Skip to content

fix(codex): preserve cache when reasoning effort changes - #182397

Merged
roboclaw-bot merged 7 commits into
mainfrom
openclaw/x-2113899049841799180-codex-reasoning-cache
Oct 24, 2026
Merged

roboclaw-bot merged 7 commits into
mainfrom
openclaw/x-2113899049841799180-codex-reasoning-cache

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes native Codex conversations rebuilding their request-level reasoning configuration when users change thinking level between turns. The built-in OpenAI Responses runtime already supports eligible cache-preserving changes; the bundled Codex 0.162.1 still defaults its native feature off.

User Impact

Managed native Codex threads can use history-scoped reasoning changes on models whose Codex catalog supports them, including with native code mode disabled. Unsupported models and an explicit thread-config opt-out retain ordinary request-level effort. There is no dependency, schema, permission, or public configuration change.

The isolated live Gateway acceptance now passes with GPT-6.1 Sol and API-key authentication. Landing remains subject to exact-head CI and repository checks.

Why This Change Was Made

Enable Codex's existing reasoning_effort_override feature in the shared thread configuration, leaving eligibility, pinned effort, and replay entirely with Codex. This follows upstream Codex #56163. Latest stable 0.164.0 also has this flag off; upstream main enables it. Its prompt presets are a separate CLI feature and need no reasoning-cache adapter.

Requested by @vincentkoc, interpreting “opencai” in the original request as OpenAI.

Work sessions

Evidence

  • Real bundled Codex regression: low → high → medium on one thread. Before the fix, serialized request effort changed each time; with the fix it stays low and appends configuration updates without rewriting prior input. Three cases pass: supported model, unsupported model, explicit opt-out. Test time 1.64s; warm wall time 13.3s.
  • 190 focused tests pass: new native wire regression (3), existing same-thread effort test (1), built-in Responses effort controls (13), lifecycle tests (74), binding tests (99).
  • Extension production and extension-test typechecks pass; touched-file lint, format, diff whitespace, and documentation link audit pass (0 broken links).
  • Independent Codex autoreview: no actionable P0–P2 findings. Simplification retained one existing decision owner: +5 production lines (including comments), no additional cache/replay machinery.
  • Live Gateway harness passes: the real plugin-owned Codex app-server executed Gateway agent turns with GPT-6.1 Sol and API-key auth (24.01s test, 54.88s wall). Selecting a fresh named profile corrected the original service identity mismatch; normal service guards passed, and no installed service was stopped, restarted, or modified. This proves live acceptance, not a measured cache-hit ratio.
  • Native compatibility regression rerun: all 3 cases pass (1.33s test). Prompt-prefix stability: all 11 tests pass.
  • Fixed PR-caused prompt snapshot drift by regenerating the native start/resume config snapshots; pnpm prompt:snapshots:check now passes (6 files).
  • Cleanup review note: 2026-11-07 is a review date, not a runtime expiry. Remove the opt-in only when the minimum supported Codex release defaults it on and native tests retain explicit opt-out and unsupported-model behavior.
  • Total diff: 188 additions + 23 deletions = 211 changed lines, strictly below 2,000. Updated-head PR CI remains the broad gate.

Worked on by


View the OpenClaw team session

roboclaw-bot and others added 2 commits October 24, 2026 07:58
Enable native Codex reasoning-effort history controls for managed threads, while retaining model eligibility and explicit opt-out. Prove the native wire request stays append-only across effort changes.

Co-authored-by: vincentkoc <[email protected]>
Worked on by:
- @vincentkoc

Co-authored-by: vincentkoc <[email protected]>
OpenClaw-Publication: fd27139a-d686-43c2-b8d7-8afee77f2434
@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: codex size: S labels Oct 24, 2026
Review removal on 2026-11-07 only after the minimum supported Codex release defaults the feature on and native compatibility tests retain explicit opt-out and unsupported-model behavior. The date does not change runtime behavior.

Co-authored-by: vincentkoc <[email protected]>
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
Regenerate the native thread start and resume request snapshots for the enabled reasoning-effort override. Only the expected config fields and derived diff hashes/offsets change.

Co-authored-by: vincentkoc <[email protected]>
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Enable Codex’s existing history-scoped reasoning-effort updates for managed threads.

Example: A supported native Codex conversation changes thinking level from low to high to medium.

  • Before: Each turn changes the request-level reasoning effort.
  • After: Request-level effort stays low while appended configuration updates select high and medium.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused, source-supported patch with meaningful native wire coverage; inspectable shipped-entry-point evidence is limited.
Proof confidence 🦐 gold shrimp (3/6) Maintainer-authored bot PR is outside the ordinary contributor proof gate; native tests exercise the real bundled app-server against fixture HTTP responses, while live Gateway acceptance is reported without an inspectable trace or measured cache-hit result. Source inspection supports clearing the earlier migration concern because the history representation and replay owner already exist.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Changing thinking level in native Codex conversations changes request-level reasoning configuration and prevents the intended prefix-preserving behavior.
Reason: Maintainer-authored direction and upstream adoption support the bounded change, which adds no competing cache or replay implementation.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR makes a focused change using Codex’s existing reasoning controls, with no concrete introduced defect found.

Priority: P2
Reviewed head: c653d2ef9b0744cfe7c18a86135758392d17ba91

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The reported live Gateway acceptance has no inspectable three-turn request trace establishing the changed serialization behavior.
Agent review details

How this fits together

The Codex plugin translates OpenClaw thread and turn settings into app-server requests; Codex owns model eligibility, history updates, and provider serialization.

flowchart LR
  A[OpenClaw thinking selection] --> B[Codex thread configuration]
  B --> C[Native Codex app server]
  C --> D[Model eligibility]
  D --> E[Conversation history]
  E --> F[Responses request]
Loading

Technical review

Best possible solution:

Keep the shared thread-config opt-in and let Codex retain ownership of eligibility, effort pinning, and replay.

Do we have a high-confidence way to reproduce the issue?

Current main omits the feature flag while bundled Codex defaults it off; the supplied native regression captures the resulting request-effort changes, but no target code was executed during this review.

Is this the best way to solve the issue?

This is the smallest complete integration change: enable the existing native mechanism at the shared configuration owner and retain independent compatibility cases.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against ee855ce57341.

Provenance checked

  • Shared native thread configuration keeps the original intent (refactor(codex): split app-server thread lifecycle #108414: The lifecycle split established focused request builders; subsequent refactoring preserved one shared configuration merge path and its precedence.)
  • Native reasoning-effort default changes intended behavior with a stated reason (unknown: Pinned Codex marks this existing feature under development and disabled by default; upstream subsequently approved stable default enablement.)
  • OpenAI model documentation keeps the original intent (f73b5c0: The provider documentation split preserved the distinction between built-in Responses behavior and the native Codex owner; the updated paragraph retains that boundary.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Introduced change and current main: The introduced production change adds one existing feature flag before caller configuration, preserving explicit thread opt-out and leaving eligibility with Codex; fetched main lacks that flag. (extensions/codex/src/app-server/thread-requests.ts:280, c653d2ef9b07)
  • Authoritative dependency contract: The patch configures and tests the bundled Codex runtime, making its contract directly applicable. Personally inspected sibling source matches rust-v0.162.1: eligibility requires an OpenAI provider and catalog support, and disabled or unsupported requests filter configuration updates without rewriting saved history. (codex-rs/core/src/client.rs:556, 092d3acd6bec)
  • Existing persistence and replay contract: Pinned source already implements durable effort updates, resumed-effort refresh, and saved-history recovery with the feature disabled or model unsupported; this PR changes no serialization schema. (codex-rs/core/tests/suite/reasoning_effort_override.rs:1230, 092d3acd6bec)
  • Stable-state compatibility: The latest stable OpenClaw release bundles Codex 0.160.0, whose protocol already recognizes ConfigurationUpdate; the unchanged pinned reader and existing replay owner support a no-migration assessment. (extensions/codex/package.json:11, fe06181dc5ec)
  • Stable history representation: Codex 0.160.0 already defines ConfigurationUpdate as a durable backend input control. (codex-rs/protocol/src/models.rs:1238)
  • Upstream direction: Enable reasoning effort overrides by default openai/codex#56163 promotes the existing feature to stable and enables it by default, supporting this bounded opt-in for the older bundled version. (2f3fb111be71)

Likely related people:

  • Peter Steinberger: Raw commit 5ccae76 adds extensions/codex/src/app-server/thread-requests.ts:266 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5ccae7677f71; files: extensions/codex/src/app-server/thread-requests.ts)
  • Dmitry Golubev: Raw commit eb87bb1 adds extensions/codex/src/app-server/thread-requests.ts:281 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: eb87bb1fd7ba; files: extensions/codex/src/app-server/thread-requests.ts)

PR surface

Source +5, Tests +156, Docs +4. Total +165 across 7 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 5 0 +5
Tests 5 177 21 +156
Docs 1 6 2 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 188 23 +165

Review metrics

Metric Value Why it matters
Production versus regression support Production +5 lines; tests and test routing +154 lines The small configuration change reuses the existing owner; native process coverage protects wire behavior that mocked lifecycle tests cannot establish.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦪 silver shellfish.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: Improves prefix reuse when supported native Codex conversations change thinking level, with limited scope.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦪 silver shellfish.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach a redacted Gateway request trace showing low → high → medium with pinned request effort and append-only configuration updates.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-24T08:15:35.556Z sha 0943999 :: blocked before merge. :: none

Reviewed October 24, 2026, 4:38 AM ET / 08:38 UTC (Revision 2).

Worked on by:
- @vincentkoc

Co-authored-by: vincentkoc <[email protected]>
OpenClaw-Publication: 946e9fa6-b7df-4ba1-bae5-e07a6d3d73bb
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

The reviewed head was 0943999f8c07fcb8993e6be59b9e4b69721bfd94; the current head is 2bb487c56a6e2146ef802b9cf133fb48d6d7c0e9. The acceptance hold in the old body is resolved: the real isolated Gateway/Codex harness now passes against GPT-6.1 Sol with API-key auth (24.01s test, 54.88s wall), after selecting a dedicated profile. No installed service or safety guard was changed. Native serialization tests independently cover low → high → medium with append-only history, unsupported models, and explicit opt-out. The 11 prompt-prefix stability tests also pass.

The patch does not change OpenClaw storage schemas, migrations, Codex dependency version, or the native history format. The existing bundled Codex 0.162.1 already owns the same configuration-update representation and replay; it also has native resume coverage in codex-rs/core/tests/suite/reasoning_effort_override.rs::reasoning_effort_override_resume_refreshes_selected_effort (source). I do not see a source-backed incompatible-data change that would require a separate OpenClaw schema migration or make the absence of a full release-upgrade run a blocker. This is not a claim that such an upgrade run was executed.

Also added the requested cleanup review condition for 2026-11-07, and regenerated the two native request snapshot artifacts responsible for the initial CI failure. Updated-head snapshot checks pass. No automatic date-based disabling or guessed version gate was introduced.

@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

roboclaw-bot and others added 2 commits October 24, 2026 08:31
Preserve the requested review date and removal condition without a forbidden TODO marker.

Co-authored-by: vincentkoc <[email protected]>
Worked on by:
- @vincentkoc

Co-authored-by: vincentkoc <[email protected]>
OpenClaw-Publication: c0355f8e-3516-4740-9e05-c45ee9c8a21b
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@roboclaw-bot
roboclaw-bot enabled auto-merge (squash) October 24, 2026 08:36
@roboclaw-bot
roboclaw-bot merged commit 00c611d into main Oct 24, 2026
116 checks passed
@roboclaw-bot
roboclaw-bot deleted the openclaw/x-2113899049841799180-codex-reasoning-cache branch October 24, 2026 08:40
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash auto-merge.

steipete added a commit that referenced this pull request Oct 24, 2026
Align the bounded media thread assertions with the intentional reasoning-effort override introduced in #182397. Retain the exact configuration comparison and all bounded-thread restrictions.

Validation: both affected tests reproduce the missing-field failure on the base; all 15 media-provider tests pass with the corrected expectation. No production behavior changes.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
…2397)

* fix(codex): preserve cache when reasoning effort changes

Enable native Codex reasoning-effort history controls for managed threads, while retaining model eligibility and explicit opt-out. Prove the native wire request stays append-only across effort changes.

Co-authored-by: vincentkoc <[email protected]>

* fix(codex): preserve cache when reasoning effort changes

Worked on by:
- @vincentkoc

Co-authored-by: vincentkoc <[email protected]>
OpenClaw-Publication: fd27139a-d686-43c2-b8d7-8afee77f2434

* docs(codex): bound reasoning override cleanup review

Review removal on 2026-11-07 only after the minimum supported Codex release defaults the feature on and native compatibility tests retain explicit opt-out and unsupported-model behavior. The date does not change runtime behavior.

Co-authored-by: vincentkoc <[email protected]>

* test(codex): refresh reasoning feature request snapshots

Regenerate the native thread start and resume request snapshots for the enabled reasoning-effort override. Only the expected config fields and derived diff hashes/offsets change.

Co-authored-by: vincentkoc <[email protected]>

* Publish openclaw/x-2113899049841799180-codex-reasoning-cache

Worked on by:
- @vincentkoc

Co-authored-by: vincentkoc <[email protected]>
OpenClaw-Publication: 946e9fa6-b7df-4ba1-bae5-e07a6d3d73bb

* docs(codex): use lint-compatible cleanup review note

Preserve the requested review date and removal condition without a forbidden TODO marker.

Co-authored-by: vincentkoc <[email protected]>

* Publish openclaw/x-2113899049841799180-codex-reasoning-cache

Worked on by:
- @vincentkoc

Co-authored-by: vincentkoc <[email protected]>
OpenClaw-Publication: c0355f8e-3516-4740-9e05-c45ee9c8a21b

---------

Co-authored-by: vincentkoc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
Align the bounded media thread assertions with the intentional reasoning-effort override introduced in openclaw#182397. Retain the exact configuration comparison and all bounded-thread restrictions.

Validation: both affected tests reproduce the missing-field failure on the base; all 15 media-provider tests pass with the corrected expectation. No production behavior changes.
RomneyDa added a commit that referenced this pull request Oct 28, 2026
* fix(codex): preserve cache when reasoning effort changes

Enable native Codex reasoning-effort history controls for managed threads, while retaining model eligibility and explicit opt-out. Prove the native wire request stays append-only across effort changes.

Co-authored-by: vincentkoc <[email protected]>

* fix(codex): preserve cache when reasoning effort changes

Worked on by:
- @vincentkoc

Co-authored-by: vincentkoc <[email protected]>
OpenClaw-Publication: fd27139a-d686-43c2-b8d7-8afee77f2434

* docs(codex): bound reasoning override cleanup review

Review removal on 2026-11-07 only after the minimum supported Codex release defaults the feature on and native compatibility tests retain explicit opt-out and unsupported-model behavior. The date does not change runtime behavior.

Co-authored-by: vincentkoc <[email protected]>

* test(codex): refresh reasoning feature request snapshots

Regenerate the native thread start and resume request snapshots for the enabled reasoning-effort override. Only the expected config fields and derived diff hashes/offsets change.

Co-authored-by: vincentkoc <[email protected]>

* Publish openclaw/x-2113899049841799180-codex-reasoning-cache

Worked on by:
- @vincentkoc

Co-authored-by: vincentkoc <[email protected]>
OpenClaw-Publication: 946e9fa6-b7df-4ba1-bae5-e07a6d3d73bb

* docs(codex): use lint-compatible cleanup review note

Preserve the requested review date and removal condition without a forbidden TODO marker.

Co-authored-by: vincentkoc <[email protected]>

* Publish openclaw/x-2113899049841799180-codex-reasoning-cache

Worked on by:
- @vincentkoc

Co-authored-by: vincentkoc <[email protected]>
OpenClaw-Publication: c0355f8e-3516-4740-9e05-c45ee9c8a21b

---------

Co-authored-by: vincentkoc <[email protected]>
Bounded beta.5 adaptation: enable the native reasoning-effort default before authored config so explicit opt-out and forced safety flags survive. Preserve richer baseline code and prompt snapshots; regenerate only exact current snapshot changes. Include native supported/unsupported/opt-out wire proofs, code-mode enabled/disabled config controls and correct database-broker routing. No runtime expiry, unsupported eligibility override, custody grant or release qualification claim.

(cherry picked from commit 00c611d)
Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docs Improvements or additions to documentation extensions: codex P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant