Skip to content

fix(codex): native patches fail and fast mode is ignored - #114907

Merged
steipete merged 1 commit into
mainfrom
codex/114574-live-patch-codex-perf
Jul 28, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/114574-live-patch-codex-perf

Conversation

@steipete

@steipete steipete commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Related: #114574

What Problem This Solves

Fixes an issue where users running the real GPT-5.6 Codex harness would see native apply_patch fail or disappear from the transcript, while fast-mode comparisons incorrectly ran Codex without its priority service tier. This also made patch tool counts and mock-based performance conclusions unreliable.

Why This Change Was Made

Recognize authenticated Codex native and code-mode patch events at the runtime boundary; preserve canonical working-directory and sandbox-denial evidence; count a successful nested file change exactly once; and propagate fast mode consistently into the Codex app-server and QA runtime. Reject ambiguous, spoofed, and non-canonical shell or code-mode representations.

User Impact

Real OpenAI-backed OpenClaw and Codex runs can both apply workspace patches, report denied and invalid patches accurately, respect fast mode, and produce comparable runtime and token measurements without mock-provider timing samples.

Evidence

Exact-head hosted CI: https://github.com/openclaw/openclaw/actions/runs/30326857394

Real provider, not mock-ai: openai/gpt-5.6-sol, medium thinking, fast mode, and an OpenAI key read through 1Password CLI without printing or storing the key. Redacted actual output from .artifacts/qa-e2e/pr-114574-final-matched-native-patch/qa-suite-summary.json:

scenario=runtime-tool-apply-patch status=pass

openclaw:
  status=pass
  wallClockMs=15451
  bootstrapWallClockMs=11129
  toolCalls=[apply_patch:success, apply_patch:tool-result-error]
  inputTokens=1503 outputTokens=213
  cacheRead=65076 cacheWrite=16086
  denied: ../runtime-tool-fixture-denied.txt escapes the workspace sandbox root
  outside file: unchanged

codex:
  status=pass
  wallClockMs=23360
  bootstrapWallClockMs=12487
  toolCalls=[apply_patch:success, apply_patch:tool-result-error]
  inputTokens=6 outputTokens=111
  cacheRead=48302 cacheWrite=217
  denied: patch rejected: writing outside of the project; rejected by user approval settings
  outside file: unchanged

runtime pair: pass

The two calls represent one verified successful workspace patch and one verified rejected out-of-workspace patch for each runtime. Cached tokens are reported separately; cache reads and writes must not be interpreted as new model input. Successful nested Codex code-mode patch calls are not double-counted.

Remote full pnpm check:changed: passed. Remote native Codex audit: 40 tests passed, including authenticated invalid patches and sandbox denials, strict shell and code-mode spoof rejection, canonical inner-event deduplication, and effective-working-directory escapes. Remote QA runtime-tool fixture: 62 tests passed. Production and test extension TypeScript checks, all Codex run-attempt tests, and QA gateway configuration tests passed. Fresh independent GPT-5.6 autoreview: clean, no actionable findings.

Direct upstream Codex contract inspection

Personally checked the current sibling openai/codex source rather than relying on wrappers, generated schemas, or bot review:

  • codex-rs/core/src/apply_patch.rs:37 and :72: patch approval rejection is returned as FunctionCallError::RespondToModel("patch rejected: ...") before a successful file-change item exists.
  • codex-rs/core/src/safety.rs:16: the canonical out-of-project rejection is writing outside of the project; rejected by user approval settings.
  • codex-rs/core/src/tools/handlers/apply_patch.rs:418 and :581: successful approved patches use the native ToolEmitter::apply_patch_for_environment path.
  • codex-rs/core/src/tools/events.rs:217, :581, and :681: canonical successful patch audit is owned by native FileChange items.
  • codex-rs/app-server-protocol/src/protocol/v2/thread.rs:73, :145, :174, and :358: thread start/resume protocol carries service-tier configuration and explicitly opts in to raw provider response events.
  • codex-rs/core/src/session/mod.rs:634, :899, and :3075: session service-tier selection and raw response-item emission.
  • codex-rs/core/src/config/config_tests.rs:8725 and :8747: upstream confirms fast maps to the supported priority request service tier.

ClawSweeper rank-up and owner decisions

Real behavior proof: addressed above with actual redacted live-provider output and independently inspectable exact-head hosted CI. Upstream event/security contract: addressed above with personally verified upstream source and passing spoof, containment, failure, and deduplication regressions. Protected maintainer/owner review: this is an explicit owner-requested maintainer follow-up authored by the repository maintainer; the repository-native review artifacts record READY FOR /prepare-pr, zero findings, and explicit boundary-by-boundary owner evidence. Final five-scenario real-provider performance measurements will be captured against the confirmed landed merge commit.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 28, 2026
@clawsweeper

clawsweeper Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 11:50 PM ET / July 28, 2026, 03:50 UTC.

ClawSweeper review

What this changes

The branch recognizes real native Codex patch events in tool transcripts, preserves patch success or rejection evidence, and makes fast-mode QA runs request Codex priority service tier.

Merge readiness

⛔ Blocked until stronger real behavior proof is added - 5 items remain

Keep this PR open for explicit owner review. It has the protected maintainer label, and the available context shows a focused follow-up to recently merged Codex/QA work, but the review environment rejected even read-only terminal inspection before the required source and upstream-Codex contract pass could be completed.

Priority: P2
Reviewed head: 1eeb54a133a2856730175bb12a76e823037b063b
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The change has focused intent and substantial stated validation, but independently inspectable real-behavior proof and the required upstream-contract pass are absent from this review.
Proof confidence 🦪 silver shellfish (2/6) Needs stronger real behavior proof before merge: The body gives detailed claims of a real OpenAI-backed run and successful focused checks, but no inspectable terminal output, redacted log, recording, or linked artifact was available in the supplied review context to verify the after-fix behavior independently. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The body gives detailed claims of a real OpenAI-backed run and successful focused checks, but no inspectable terminal output, redacted log, recording, or linked artifact was available in the supplied review context to verify the after-fix behavior independently. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 4 items PR runtime boundary change: The submitted patch records raw native tool items before assistant projection, enabling the transcript layer to correlate native patch evidence with tool results.
Fast-mode propagation: The submitted patch forwards attempt fast mode into the Codex runtime and maps QA fast mode to the existing serviceTier: "priority" app-server configuration.
Related merged provenance: The PR body links a merged Codex/QA predecessor, whose merge commit is 37cf0c6064006c95bcbb7f8329557edcfed6936c; this PR is presented as a follow-up repair rather than a duplicate of that merged work.
Findings None None.
Security None None.

How this fits together

The Codex extension converts app-server events into OpenClaw tool-call transcripts and prepares runtime attempts. QA Lab configures controlled Codex runs, so its fast-mode setting must reach the same Codex service-tier request used by the runtime.

flowchart LR
  A[Codex app-server events] --> B[Codex transcript projection]
  B --> C[OpenClaw tool transcript]
  D[Fast-mode QA run] --> E[Codex attempt setup]
  E --> F[Priority service tier]
  C --> G[Patch evidence and QA measurements]
Loading

Decision needed

Question Recommendation
Does the Codex/QA owner approve this native-event recognition and fast-mode propagation after directly checking the current app-server contract and sibling runtime paths? Complete contract review: Compare the parser and service-tier forwarding with the current upstream Codex protocol and merge only if all sibling transcript paths preserve the same security and counting invariants.

Why: The PR changes how externally generated native patch evidence is accepted and reported, and it is explicitly marked for maintainer handling; that boundary cannot be safely approved from the available metadata alone.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The body gives detailed claims of a real OpenAI-backed run and successful focused checks, but no inspectable terminal output, redacted log, recording, or linked artifact was available in the supplied review context to verify the after-fix behavior independently. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The native-patch transcript parser consumes externally produced app-server and shell/code-mode representations; its acceptance and spoof-rejection rules need a direct comparison with the upstream Codex protocol before merge.
  • Resolve merge risk (P1) - The protected maintainer label requires explicit human handling even if the focused CI and claimed live proof remain positive.
  • Complete next step (P2) - The protected maintainer label and unverified upstream event contract require an owner review rather than automated repair or closure.
Agent review details

Security

None.

PR surface

Source +307, Tests +730. Total +1037 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 5 329 22 +307
Tests 4 735 5 +730
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 1064 27 +1037

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: extensions/codex/src/app-server/event-projector-tool-transcript.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify canonical native event forms before merge (recommended)
    Confirm the parser accepts only upstream-documented native patch representations and preserves rejection evidence without converting arbitrary shell or code text into a patch event.
  2. Pause for owner protocol decision
    Pause the PR if upstream behavior is ambiguous or if accepting code-mode/shell representations would create an unsupported transcript contract.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Recheck upstream Codex native patch event shapes, then add or retain focused regressions for accepted, denied, and spoofed representations.

Technical review

Best possible solution:

Have the Codex/QA owner complete a direct upstream-contract and current-main regression review, then retain the narrow runtime-boundary fix only if real native patch success, denial, transcript counts, and fast-mode priority behavior all agree.

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

Unclear. The PR body describes live OpenAI-backed failures and successful after-fix runs, but the sandbox prevented an independent current-main reproduction or inspection of the stated artifacts.

Is this the best way to solve the issue?

Unclear. Recognizing canonical native events at the transcript boundary and forwarding the existing fast-mode fact are plausible narrow fixes, but a direct upstream Codex contract review is required to confirm they are the safest path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 77e1f213b6ee.

Labels

Label changes:

  • add P2: This is a bounded correctness repair in the Codex runtime and QA comparison path, with no evidence here of an active core outage.
  • add merge-risk: 🚨 compatibility: Fast-mode propagation changes the service tier requested by existing Codex QA runs and needs direct confirmation that current runtime and QA expectations remain aligned.
  • add merge-risk: 🚨 security-boundary: The patch classifies native patch and workspace-denial evidence from app-server output, so an overly broad accepted representation could weaken the integrity of sandbox-related reporting.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The body gives detailed claims of a real OpenAI-backed run and successful focused checks, but no inspectable terminal output, redacted log, recording, or linked artifact was available in the supplied review context to verify the after-fix behavior independently. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This is a bounded correctness repair in the Codex runtime and QA comparison path, with no evidence here of an active core outage.
  • merge-risk: 🚨 security-boundary: The patch classifies native patch and workspace-denial evidence from app-server output, so an overly broad accepted representation could weaken the integrity of sandbox-related reporting.
  • merge-risk: 🚨 compatibility: Fast-mode propagation changes the service tier requested by existing Codex QA runs and needs direct confirmation that current runtime and QA expectations remain aligned.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The body gives detailed claims of a real OpenAI-backed run and successful focused checks, but no inspectable terminal output, redacted log, recording, or linked artifact was available in the supplied review context to verify the after-fix behavior independently. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • PR runtime boundary change: The submitted patch records raw native tool items before assistant projection, enabling the transcript layer to correlate native patch evidence with tool results. (extensions/codex/src/app-server/event-projector.ts:686, 1eeb54a133a2)
  • Fast-mode propagation: The submitted patch forwards attempt fast mode into the Codex runtime and maps QA fast mode to the existing serviceTier: "priority" app-server configuration. (extensions/codex/src/app-server/run-attempt-runtime.ts:104, 1eeb54a133a2)
  • Related merged provenance: The PR body links a merged Codex/QA predecessor, whose merge commit is 37cf0c6064006c95bcbb7f8329557edcfed6936c; this PR is presented as a follow-up repair rather than a duplicate of that merged work. (37cf0c606400)
  • Required local review blocked: A read-only command intended to inspect AGENTS.md, the maintainer-review skill, and repository state was rejected by the sandbox before producing repository output, so current-main callers, scoped policy files, tests, history, and sibling ../codex source could not be independently verified.

Likely related people:

  • steipete: The linked merged Codex/QA predecessor and this follow-up both identify steipete as author, tying them to the recent native Codex and QA runtime work. (role: recent feature contributor; confidence: medium; commits: 37cf0c606400, 1eeb54a133a2; files: extensions/codex/src/app-server/event-projector-tool-transcript.ts, extensions/codex/src/app-server/run-attempt-runtime.ts, extensions/qa-lab/src/qa-gateway-config.ts)

Rank-up moves

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

  • Attach or link redacted terminal output or logs showing one successful in-workspace native patch, one denied outside-workspace patch, correct transcript call counts, and fast-mode priority selection.
  • Have the Codex/QA owner compare the accepted event forms with the current upstream Codex protocol before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 27f62f3 into main Jul 28, 2026
135 of 146 checks passed
@steipete
steipete deleted the codex/114574-live-patch-codex-perf branch July 28, 2026 04:00
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete

Copy link
Copy Markdown
Contributor Author

Post-merge real-provider verification at landed commit 27f62f3e8e2216c3354bf961d1ef38700c2e8220.

Provider: openai/gpt-5.6-sol, live-frontier, medium thinking, fast mode; OpenAI authentication was read with 1Password CLI and never printed. Result: 5/5 matched scenario pairs passed. Both generated gates return pass: runtime parity and cache-aware token efficiency.

Live scenario OpenClaw Codex Result
approval + tool follow-through 11.944 s 19.166 s both pass
source/docs discovery 124.050 s 163.543 s both pass
repo instruction follow-through 30.708 s 45.336 s both pass
genuine native apply-patch success + sandbox denial 15.459 s 24.775 s both pass; exactly 2 actual patch calls each
first-hour 20-turn workload 63.407 s 64.299 s both pass
all five matched passing scenarios 245.568 s 317.119 s 5/5

Token totals, reported separately from cache traffic:

  • OpenClaw: 21,632 new input tokens; 3,968 output tokens; 1,282,505 cache-read tokens; 111,086 cache-write tokens.
  • Codex: 25,546 new input tokens; 1,355 output tokens; 608,729 cache-read tokens; 52,786 cache-write tokens.

The pre-fix patch scenario failed on both runtimes with zero real token usage, so it is excluded from the before/after speed comparison. Across the four scenarios that passed in both the original real-provider baseline and the landed run, Codex measures 280.329 s before vs. 292.344 s after. This run therefore does not establish an aggregate Codex speedup; it establishes the repaired patch behavior, accurate non-duplicated tool accounting, correctly propagated priority tier, valid cache accounting, and five passing live scenario pairs. The source/docs workload is model-variable (23 OpenClaw tool calls and 17 Codex tool calls in the landed sample), so one sample must not be presented as a stable optimization.

Artifacts:

  • .artifacts/qa-e2e/pr-114907-landed-27f62f3e8e22-live-gpt56/qa-suite-summary.json
  • .artifacts/qa-e2e/pr-114907-landed-27f62f3e8e22-live-gpt56/runtime-parity/qa-runtime-parity-summary.json
  • .artifacts/qa-e2e/pr-114907-landed-27f62f3e8e22-live-gpt56/runtime-parity/qa-runtime-token-efficiency-summary.json

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

Labels

extensions: codex extensions: qa-lab maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant