Skip to content

feat(codex): execute isolated completions through native runtime - #177227

Merged
vincentkoc merged 5 commits into
mainfrom
openclaw/research-native-codex-20261019
Nov 6, 2026
Merged

vincentkoc merged 5 commits into
mainfrom
openclaw/research-native-codex-20261019

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Problem

Host-authorized isolated completions selecting Codex need the native runtime without losing the selected model, credential owner, schema, or inference admission.

Changes

  • Preserve isolated-completion ownership, dispatch accounting, lazy loaders, and the original bounded fallback deadline.
  • Carry owned inference registration through native turn metadata and release it during cleanup.
  • Bind API-key inference to the exact host-prepared endpoint and private native client, without a direct-provider fallback.
  • Request supported standalone native search when structured source results are required, without changing ordinary hosted search.
  • Add an opt-in real-provider acceptance test for structured output, cancellation, child exit, private-home cleanup, and revoked-owner admission.
  • Preserve caller token and sampling settings through the existing generation-bound inference relay. Unsupported ChatGPT token-sharing limits fail explicitly before native launch.

Stack

Builds on merged #173964. This native boundary is independent of the managed Google adapter and durable research jobs. The native baseline refresh preserves the portable export-privacy corrections already on main. Source publication does not deploy a Gateway.

Verification

  • Personally inspected Codex tag rust-v0.164.0 at 6aaac694803004a63c6f393d153c96d22521a6b9, including output-schema forwarding and distinct API-key / ChatGPT auth-token login owners.
  • Real candidate runCodexIsolatedCompletion: Codex 0.164.0, host-prepared OpenAI API key, selected gpt-6.1-sol and https://api.openai.com/v1; exact structured result passed. A second real turn was cancelled, both native exits were joined, and private homes were absent afterward. The existing system proxy was projected into the test process; no machine proxy configuration changed.
  • Eight focused native/model/route test files across three Vitest shards passed. Targeted lint, extension test typecheck, and fresh independent P2 review passed.
  • The actual-wire request-settings test was red on db14c09b and green with the correction. 36 focused context/native/account tests, targeted lint/typecheck, and fresh final independent P2 review passed.
  • Real token-bounded completion (maxTokens: 1024), cancellation and cleanup passed on the corrected source. The selected model explicitly rejects temperature; the actual-wire regression covers temperature zero.
  • Full pnpm build passed, including declarations, runtime packaging, Control UI, and plugin SDK export checks.
  • 48 existing relay/OAuth authority tests passed on c0a3df24, including real HTTPS relay rejection after owner revocation, revalidation after asynchronous transport preparation, one-refresh retry ownership, and persisted-bearer revocation before native fetch.
  • API-key, legacy OAuth, and SIWC are alternative routes. Live legacy OAuth and SIWC account coverage remains unclaimed; focused owner/admission contract tests cover those alternatives.

Signed candidate: c0a3df24c269271461aa0e60ea509b1b4edfc6e9. Exact-head hosted CI passed, and native completed-hosted preparation qualified this same head.

@clawsweeper

clawsweeper Bot commented Oct 19, 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. 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. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR runs Codex isolated completions through native app-server turns and returns structured native search citations.

Example: An API-key isolated completion selects gpt-6.1-sol with maxTokens: 1024 and a JSON output schema.

  • Before: Codex delegates the host-authorized request to OpenClaw's direct completion transport.
  • After: A private native Codex turn uses the selected endpoint and credential through the owned inference relay.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful native integration with meaningful reported live acceptance, but two reachable provider-request regressions and an unresolved authority proof gate prevent readiness.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: A caller selecting Codex for a bounded completion should retain that runtime, selected account, model and structured-output contract.
Reason: Maintainer authorship establishes direction, and the change extends existing native owners without introducing a research manager or new public configuration.

Regression provenance

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

Merge readiness

⛔ Blocked before merge - 6 items remain

This PR has useful, maintainer-approved scope, but the request-settings correction bypasses existing provider normalization and introduces two HTTP 400 failure cases.

Priority: P2
Reviewed head: c0a3df24c269271461aa0e60ea509b1b4edfc6e9

Before merge

  • Add real behavior proof - Authority-chain proof required: the reported real Codex API-key run covers structured output, a 1024-token bound, cancellation and cleanup, and existing HTTPS/OAuth tests support the shared relay guards; however, the new bounded path's forbidden-model case replaces upstream fetch and its revocation case calls the binding directly, leaving no recorded bounded final-upstream rejection after caller or credential revocation, including retry. Supply redacted request/response evidence through that production relay, with an allowed control; live OAuth account coverage need not be expanded into a full matrix. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Preserve model temperature support before rewriting inference requests (P2) - For an API-key Codex completion using gpt-6.1-sol, this unconditionally adds a supplied temperature even though that model rejects it with HTTP 400. Session observation and activity recaps supply 0.2, and progress narration supplies 0.3. The previous host Responses path called supportsOpenAITemperature and omitted this field; the PR's live acceptance deliberately supplies no temperature. Reuse the existing model-capability decision before registering or applying these settings, preserving compat overrides and temperature zero for models that support it.
  • Retain the Responses minimum output-token normalization (P2) - A valid llm-task or plugin request with maxTokens: 1 now reaches OpenAI as max_output_tokens: 1 and receives HTTP 400. The replaced Responses transport normalized positive limits to at least 16, and its existing live regression explicitly covers this input. Preserve that provider normalization rather than forwarding the raw bound; add coverage at the native wire boundary for a sub-floor request.
  • Resolve security review attention item - No concrete authorization bypass was found, but final-effect evidence for the new bounded authority composition remains incomplete.
  • Resolve merge risk - The PR owner must establish that the new bounded binding rejects revoked caller or credential authority at final upstream I/O, including an OAuth retry.
  • Explain or restore the original intent of Responses request normalization - unknown: The existing transport omits unsupported temperature and floors token limits to avoid provider rejection; scoped history was inspected, but the exact introduction was not established.

Findings

  • [P2] Preserve model temperature support before rewriting inference requests — extensions/codex/src/app-server/inference-context.ts:338
  • [P2] Retain the Responses minimum output-token normalization — extensions/codex/src/app-server/inference-context.ts:337

Provenance

  • Responses request normalization changes intended behavior without addressing why it exists (unknown: The existing transport omits unsupported temperature and floors token limits to avoid provider rejection; scoped history was inspected, but the exact introduction was not established.)

Tests

  • Low-value test extensions/codex/src/app-server/isolated-completion.test.ts: Remove the newly added host-API and SIWC field-forwarding mock cases: the API-boundary suite already exercises those same endpoint, credential and model handoffs through the real relay owners.
  • Missing end-to-end proof: Provide bounded final-effect authority evidence, native search citation output, and a latest-stable upgrade run preserving configured routes and accounts; the reported request-settings red/green run covers raw forwarding, not the two normalization failures.
Agent review details

How this fits together

Core selects the model, credential and caller authority; the Codex plugin creates an ephemeral native turn, relays admitted inference to the provider, and returns the answer and usage.

flowchart LR
  A[Utility or plugin caller] --> B[Core model and auth selection]
  B --> C[Codex isolated completion]
  C --> D[Private native app server]
  D --> E[Generation bound inference relay]
  E --> F[Selected provider endpoint]
  F --> A
Loading

Technical review

Best possible solution:

Keep native execution and the existing relay owner, but preserve the shared Responses capability checks and token normalization before applying caller settings.

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

Source establishes both failing inputs: GPT-6 requests with temperature and Responses requests with maxTokens below 16; existing provider contracts and tests establish why those payloads fail, without executing target code.

Is this the best way to solve the issue?

Reusing native turns and the generation-bound relay is coherent, but raw field forwarding must retain the provider normalization supplied by the replaced transport.

Full review comments:

  • [P2] Preserve model temperature support before rewriting inference requests — extensions/codex/src/app-server/inference-context.ts:338
    For an API-key Codex completion using gpt-6.1-sol, this unconditionally adds a supplied temperature even though that model rejects it with HTTP 400. Session observation and activity recaps supply 0.2, and progress narration supplies 0.3. The previous host Responses path called supportsOpenAITemperature and omitted this field; the PR's live acceptance deliberately supplies no temperature. Reuse the existing model-capability decision before registering or applying these settings, preserving compat overrides and temperature zero for models that support it.
    Confidence: 0.99
  • [P2] Retain the Responses minimum output-token normalization — extensions/codex/src/app-server/inference-context.ts:337
    A valid llm-task or plugin request with maxTokens: 1 now reaches OpenAI as max_output_tokens: 1 and receives HTTP 400. The replaced Responses transport normalized positive limits to at least 16, and its existing live regression explicitly covers this input. Preserve that provider normalization rather than forwarding the raw bound; add coverage at the native wire boundary for a sub-floor request.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Merge-risk options

Maintainer options:

  1. Verify bounded authority at provider I/O (recommended)
    The PR owner supplies a production-relay trace with an allowed control and forbidden or revoked bounded requests, including revocation before OAuth retry.

Provenance checked

Testing

Proof path: in-process harness.

Security

Needs attention: No concrete authorization bypass was found, but final-effect evidence for the new bounded authority composition remains incomplete.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit ec4ae78 adds extensions/codex/src/app-server/isolated-completion.ts:16 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ec4ae78b752e; files: extensions/codex/src/app-server/isolated-completion.ts)
  • Jason (Json): Raw commit 1e0062b adds extensions/codex/src/web-search-provider.runtime.ts:15 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1e0062b44a51; files: extensions/codex/src/web-search-provider.runtime.ts)

PR surface

Source +231, Tests +908, Other +7. Total +1146 across 28 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 13 303 72 +231
Tests 12 931 23 +908
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 7 0 +7
Total 28 1241 95 +1146

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P2: The introduced failures affect auxiliary completions and bounded tasks with specific supported settings.
  • merge-risk: 🚨 compatibility: Existing callers can begin receiving HTTP 400 responses after their requests move from the normalized direct transport to native inference.
  • merge-risk: 🚨 security-boundary: The new credential-consuming bounded binding still lacks demonstrated final-effect rejection for revoked authority.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

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-19T10:24:32.702Z sha 7f1533b :: needs real behavior proof before merge. :: [P2] Preserve request settings when moving host calls to native execution

Reviewed November 6, 2026, 1:32 AM ET / 06:32 UTC (Revision 2).

@vincentkoc
vincentkoc force-pushed the openclaw/research-native-codex-20261019 branch from 7f1533b to 9910412 Compare November 6, 2026 03:32
@vincentkoc
vincentkoc changed the base branch from openclaw/deep-research-bundled-20261016 to openclaw/deep-research-portable-20261016 November 6, 2026 03:33
@vincentkoc
vincentkoc force-pushed the openclaw/deep-research-portable-20261016 branch from a53f23a to 7011c04 Compare November 6, 2026 04:08
@vincentkoc
vincentkoc force-pushed the openclaw/research-native-codex-20261019 branch from 9910412 to 585ac36 Compare November 6, 2026 04:12
Base automatically changed from openclaw/deep-research-portable-20261016 to main November 6, 2026 04:22
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Nov 6, 2026
@vincentkoc vincentkoc self-assigned this Nov 6, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the docs Improvements or additions to documentation label Nov 6, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review November 6, 2026 06:01
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: c0a3df24c269271461aa0e60ea509b1b4edfc6e9
  • Maintainer: @vincentkoc
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/isolated-completion-model-authority.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

The current head is c0a3df24c269271461aa0e60ea509b1b4edfc6e9. The earlier request-settings finding is fixed at the existing generation-bound inference relay, with an actual-wire red/green regression. Real native API-key acceptance now proves structured output, an explicit token bound, cancellation, and joined cleanup. Unsupported ChatGPT token-sharing limits fail explicitly; no credential or direct-provider fallback was added. The PR body contains current proof and the unclaimed alternative live-account coverage.

@clawsweeper

clawsweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 6, 2026
@vincentkoc
vincentkoc merged commit 8d92219 into main Nov 6, 2026
160 checks passed
@vincentkoc
vincentkoc deleted the openclaw/research-native-codex-20261019 branch November 6, 2026 06:41
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 7, 2026
…nclaw#177227)

* fix(research): keep evidence types in their leaf contract

* test(codex): account for native research boundary coverage

* fix: refresh the reviewed correction baseline

Baseline-Refresh: 56cba6d677304e4e46c4b749aff438a3bc768a5c

* test(codex): prove native research acceptance

* fix(codex): preserve isolated completion request settings

Co-authored-by: Vincent Koc <[email protected]>
obviyus added a commit that referenced this pull request Nov 10, 2026
…ls that reject it (#196641)

fix(agents): drop temperature for models that reject it in isolated completions

Since #177227, isolated completions such as Activity recaps run through the Codex app-server, and the Codex relay copies streamParams.temperature into the Responses body. Codex itself never sends temperature (ResponsesApiRequest in codex-rs/codex-api/src/common.rs:279 at ce0323f2 has no such field), so the value comes only from OpenClaw. The normal OpenAI transports skip temperature when supportsOpenAITemperature(model) is false, but the isolated path never ran that check, so recaps on models such as gpt-6-luna failed with HTTP 400 "Unsupported parameter: 'temperature'". resolveIsolatedStreamParams, which already adapts these params to the prepared model, now also drops temperature when that existing check says the model rejects it. No config or wording is new.

Evidence: main and this change built in secretless node:24.22.1 Docker with the real Codex app-server (@openai/codex 0.164.0), the provider on the official api.openai.com route with a synthetic key, and a local stand-in endpoint returning the issue's exact 400 when a gpt-6-luna request carried temperature. Each run sent a chat turn and then requested the recap through sessions.activitySummary.ensure. On main the gpt-6-luna recap sent temperature 0.2 and failed; with this change it sent no temperature and succeeded. A gpt-5.5 control sent temperature 0.2 and succeeded on both, and the Codex chat-turn bodies are identical on both. Details: #196641.

Closes #196617. Thanks @Marvinthebored for the report.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 11, 2026
…ls that reject it (openclaw#196641)

fix(agents): drop temperature for models that reject it in isolated completions

Since openclaw#177227, isolated completions such as Activity recaps run through the Codex app-server, and the Codex relay copies streamParams.temperature into the Responses body. Codex itself never sends temperature (ResponsesApiRequest in codex-rs/codex-api/src/common.rs:279 at ce0323f2 has no such field), so the value comes only from OpenClaw. The normal OpenAI transports skip temperature when supportsOpenAITemperature(model) is false, but the isolated path never ran that check, so recaps on models such as gpt-6-luna failed with HTTP 400 "Unsupported parameter: 'temperature'". resolveIsolatedStreamParams, which already adapts these params to the prepared model, now also drops temperature when that existing check says the model rejects it. No config or wording is new.

Evidence: main and this change built in secretless node:24.22.1 Docker with the real Codex app-server (@openai/codex 0.164.0), the provider on the official api.openai.com route with a synthetic key, and a local stand-in endpoint returning the issue's exact 400 when a gpt-6-luna request carried temperature. Each run sent a chat turn and then requested the recap through sessions.activitySummary.ensure. On main the gpt-6-luna recap sent temperature 0.2 and failed; with this change it sent no temperature and succeeded. A gpt-5.5 control sent temperature 0.2 and succeeded on both, and the Codex chat-turn bodies are identical on both. Details: openclaw#196641.

Closes openclaw#196617. Thanks @Marvinthebored for the report.

Co-authored-by: Ayaan Zaidi <[email protected]>
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: codex 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. security-sensitive-changed 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