Skip to content

fix: explicit Codex runtime policies reach embedded attempts - #126259

Merged
vincentkoc merged 1 commit into
mainfrom
fix/qa-codex-runtime-override
Aug 20, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/qa-codex-runtime-override

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 19, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Explicit provider/model Codex runtime policy was resolved by the gateway auto-reply path, then dropped before the embedded attempt was prepared. The attempt could therefore select the default OpenAI runtime instead of native Codex app-server.

Why This Change Was Made

The command and auto-reply paths forward explicit, non-implicit policy as a transient agentHarnessRuntimePreparationHint. The embedded orchestrator applies that hint only to candidate zero. Fallback candidates continue resolving their own runtime policy, while explicit harness ids and runtime overrides remain authoritative across the full chain.

The transient field lives on RunEmbeddedAgentInternalParams, so it does not expand the public plugin runtime contract. githubPublicationAvailable remains forwarded unchanged, agent identity is preserved, and agent-runner-fallback-candidate.ts is untouched.

Production delta: +15/-4. Test delta: +159/-1.

User Impact

Explicit Codex runtime policy prepares native Codex for the requested embedded attempt without writing a durable harness id, pinning fallbacks, changing provider remapping, or losing non-default agent identity.

Evidence

  • Exact PR head: 52c37be00173761a48cc1d5fa26d8b9467ae1895.
  • Approved scope: exactly seven files; production +15/-4 and tests +159/-1.
  • Focused tests: 138/138 passed across command attempt execution, prepared-harness source delivery, and auto-reply execution runtime.
  • Exact-head CI: 184 passed, 38 skipped, zero failed or pending in https://github.com/openclaw/openclaw/actions/runs/32351521523.
  • Integration QA: https://github.com/openclaw/openclaw/actions/runs/32414251985 audited the inner runtime pair at 1/1 passed.
  • Native Codex evidence showed initialize -> account/login/start -> thread/start, exactly one login, no duplicate inline auth, read-tool continuity across the model switch, correct model receipts, and rerouted=false.
  • The outer integration workflow was cancelled during teardown after an invalid global /v1/responses assertion. That wrapper result is not presented as green CI: native Codex legitimately uses Responses. The exact-head CI run above is the green CI evidence.
  • Direct Codex contract inspection confirmed model and model_provider are accepted and forwarded in codex-rs/app-server-protocol/src/protocol/v2/thread.rs:55-59 and codex-rs/app-server/src/request_processors/thread_processor.rs:878-933,1294-1327.
  • OpenClaw sends model and modelProvider through extensions/codex/src/app-server/thread-requests.ts:153-194 and extensions/codex/src/app-server/thread-lifecycle-io.ts:467-493.

ClawSweeper Rank-up Moves

  • Direct Codex app-server contract inspection: satisfied by the source inspection cited above.
  • Current-head runtime selection proof: satisfied by the focused exact-head tests plus the integration runtime-pair evidence above.
  • Restart-capability behavior is separately owned by fix(qa): wait for config restart wake completion #126721 and is not part of this routing repair.
  • Cell/process transport-verifier attribution is a separate QA-infrastructure follow-up; it does not change this production owner boundary.

@clawsweeper

clawsweeper Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@vincentkoc vincentkoc self-assigned this Aug 19, 2026
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels Aug 19, 2026
@vincentkoc
vincentkoc force-pushed the fix/qa-codex-runtime-override branch from 2d28085 to 6e63569 Compare August 19, 2026 08:44
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 19, 2026
@clawsweeper

clawsweeper Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 20, 2026, 5:04 AM ET / 09:04 UTC.

ClawSweeper review

What this changes

The PR forwards explicit runtime policy into preparation of the primary embedded-agent candidate while preserving full-chain behavior for explicit overrides and independent fallback policy resolution.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for maintainer review. The OpenClaw-side change is internally coherent and has no discrete code finding, but the required direct Codex source inspection is unavailable and the cited runtime-pair proof is neither current-head nor complete. Likely related people: Jesse Merhi (prepared-runtime history, medium confidence) and Bill (fallback-boundary history, medium confidence).

Priority: P2
Reviewed head: 52c37be00173761a48cc1d5fa26d8b9467ae1895
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The source patch and focused coverage are solid, while upstream-contract inspection and a successful current-head runtime scenario remain unresolved.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: This member-authored PR is outside the external-contributor proof gate; its cited earlier hosted runtime run remains useful but incomplete evidence rather than merge-clearing proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored PR is outside the external-contributor proof gate; its cited earlier hosted runtime run remains useful but incomplete evidence rather than merge-clearing proof.
Evidence reviewed 7 items Primary-only preparation: The PR gives an explicit harness id or override precedence over the new hint, and applies a hint only to candidate zero; later candidates remain unpinned unless a concrete override exists.
Both production callers forward only explicit policy: The command and auto-reply paths set the internal hint only when runtime policy is non-implicit.
Focused regression coverage: Tests cover command forwarding, auto-reply forwarding, primary-only Codex preparation, an unpinned plugin-owned fallback, and authoritative explicit overrides.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

pnpm openclaw --help
runner@runnervmzvulz:/tmp/clawsweeper-live-proof-126259-nwNBFG/target$ pnpm openclaw --help
pnpm openclaw --help
$ node scripts/run-node.mjs --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 103.96 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

[tsdown-build] invocation 2/2 finished in 13.3s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 10 phases completed in 4159ms (slowest: built plugin control-plane loads 3397ms)

OpenClaw 2026.8.1 (52c37be) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console
… output truncated …

Assertions:

  • PASS expect_output: Usage:

How this fits together

Command and auto-reply flows resolve a provider/model runtime policy, then the embedded-agent runner prepares harness candidates before an attempt runs. This change carries the resolved policy into that preparation step without pinning fallback candidates.

flowchart LR
  A[Command or auto-reply] --> B[Runtime policy resolution]
  B --> C[Embedded run request]
  C --> D[Candidate preparation]
  D --> E[Primary runtime]
  D --> F[Fallback runtime]
  E --> G[Agent attempt]
  F --> G
Loading

Decision needed

Question Recommendation
Should this PR wait for the repository-required direct Codex contract inspection and a successful current-head runtime-pair result before merge? Hold for complete proof: Require direct Codex source inspection plus a successful current-head runtime-pair result before merging.

Why: The local source establishes the OpenClaw handoff, but repository policy makes upstream Codex inspection mandatory for a Codex runtime verdict, and the available hosted result is incomplete and predates the current head.

Before merge

  • Resolve merge risk (P1) - The repository-required direct Codex app-server contract inspection cannot be completed because sibling Codex source is unavailable in this read-only environment.
  • Resolve merge risk (P1) - The PR body cites a 24/25 runtime-pair result for earlier head e331c80; it does not prove the current head’s remaining restart-capability scenario.
Agent review details

Security

None.

PR surface

Source +11, Tests +158. Total +169 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 4 15 4 +11
Tests 3 159 1 +158
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 174 5 +169

Review metrics

Metric Value Why it matters
Production versus test delta production +15/-4; tests +159/-1 The small internal runtime handoff is paired with focused coverage of both callers, fallback ownership, and override precedence.

Merge-risk options

Maintainer options:

  1. Complete runtime and contract proof (recommended)
    Before merge, inspect the sibling Codex contract directly and publish a redacted successful runtime-pair result for the current head, including the restart-capability scenario.
  2. Accept source-only confidence
    A maintainer can explicitly accept the focused source coverage and partial earlier runtime evidence, acknowledging the unresolved protocol and current-head proof gap.

Technical review

Best possible solution:

Retain the internal primary-only hint, then obtain direct Codex-contract inspection and a successful current-head runtime trace for the restart-capability scenario before merging.

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

Yes, from source: current main resolves explicit runtime policy in command and auto-reply flows but passes neither an override nor a preparation hint to the runner, whose candidate preparation therefore cannot apply that policy.

Is this the best way to solve the issue?

Yes, provisionally: the internal hint fixes the producer-to-preparation handoff while retaining concrete override precedence and fallback-owned policy; the remaining upstream Codex contract gate prevents a complete merge verdict.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: The PR repairs explicit runtime selection for embedded attempts with bounded but real operator impact.
  • merge-risk: 🚨 compatibility: Changing preparation can alter existing explicit provider/model runtime and fallback behavior.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored PR is outside the external-contributor proof gate; its cited earlier hosted runtime run remains useful but incomplete evidence rather than merge-clearing proof.

Evidence

What I checked:

Likely related people:

  • Jesse Merhi: Recent commits address prepared runtime ownership, generation reuse, and lightweight runtime plugin scope—the owner boundary this PR prepares. (role: recent prepared-runtime contributor; confidence: medium; commits: 02272c345f3e, b9f2eba17770, 7eaf2fccf7ca; files: src/agents/prepared-model-runtime.plugin-context.ts, src/agents/embedded-agent-runner/run-orchestrator.ts)
  • Bill: History identifies this contributor on the embedded CLI-dispatch fallback boundary adjacent to the candidate semantics preserved here. (role: fallback-boundary contributor; confidence: medium; commits: 3590f7df7ee1; files: src/agents/model-fallback-attempt.ts, src/agents/model-fallback-runner.ts)

Rank-up moves

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

  • Inspect the direct Codex app-server contract required by repository policy.
  • Publish a redacted successful current-head runtime-pair trace covering restart-capability behavior.

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.

History

Review history (5 earlier review cycles)
  • reviewed 2026-08-19T11:57:52.678Z sha 6e63569 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-19T19:27:33.239Z sha c23eb86 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-20T05:34:22.427Z sha 2452233 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-20T07:57:56.597Z sha e331c80 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-20T08:44:07.155Z sha e331c80 :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc force-pushed the fix/qa-codex-runtime-override branch from 6e63569 to a575ce5 Compare August 19, 2026 16:51
@vincentkoc
vincentkoc marked this pull request as ready for review August 19, 2026 16:52
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Exact head a575ce57015ceaf44ec2bf5a94527863c22d65bf is rebased onto current main. The production fix remains the reviewed transient-primary preparation hint; tests now also prove non-default agent scope survives primary and fallback preparation.

@clawsweeper

clawsweeper Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc
vincentkoc force-pushed the fix/qa-codex-runtime-override branch from a575ce5 to c23eb86 Compare August 19, 2026 17:13
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Exact head c23eb86eed263425d09de92d63ff7d58ca858e0c fixes the local review finding by keeping agentHarnessRuntimePreparationHint on RunEmbeddedAgentInternalParams, outside the plugin runtime API. Focused Vitest, core typecheck, core-test typecheck, formatting, and diff checks pass.

@clawsweeper

clawsweeper Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 19, 2026
@vincentkoc
vincentkoc force-pushed the fix/qa-codex-runtime-override branch from c23eb86 to 2452233 Compare August 20, 2026 05:20
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc
vincentkoc force-pushed the fix/qa-codex-runtime-override branch from 2452233 to e331c80 Compare August 20, 2026 07:51
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc
vincentkoc force-pushed the fix/qa-codex-runtime-override branch from e331c80 to 52c37be Compare August 20, 2026 08:58
@vincentkoc
vincentkoc merged commit c19bdb3 into main Aug 20, 2026
230 checks passed
@vincentkoc
vincentkoc deleted the fix/qa-codex-runtime-override branch August 20, 2026 22:32
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 21, 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 maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant