Skip to content

fix: allow environment-only agent runs without a native harness - #138449

Merged
steipete merged 2 commits into
mainfrom
codex/fix-agent-exec-auth-env-only
Sep 4, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/fix-agent-exec-auth-env-only

Conversation

@steipete

@steipete steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users running openclaw agent exec --auth-env-only --model openai/gpt-5.6-sol would fail before inference with an unavailable Codex harness on a fresh configuration. The default runtime preference was treated as an explicit installation requirement before model-specific runtime preparation.

Closes #138421.

Why This Change Was Made

Implicit runtime preferences now reach the existing harness selector, which can select the prepared native runtime or use the built-in OpenClaw runtime when the optional harness is unavailable. Explicit runtime configuration, overrides, and session pins still require their selected registration; execution failures never trigger replay in another runtime. This removes a duplicate policy decision from registration preflight instead of adding a CLI-only runtime override.

The regression came from commit 6c9b388 (#117587), authored by Peter Steinberger on 2026-08-01 and committed by GitHub. Its parent-relative patch replaced the absent-owner return with an unconditional prepared-registry error. The behavior is present in stable v2026.9.1.

User Impact

Environment-only OpenAI API-key runs work on clean installations without requiring an optional native harness. Stable/full release verification now includes a real OpenAI Code Mode regression in native-live-test: a fresh HOME/state/workspace, no authored configuration or runtime override, dependent filesystem calls, and an exact output artifact. A skipped test cannot satisfy that lane's passing-evidence gate.

Evidence

  • The new registration-plus-selection regression fails on the original code with the reported missing Codex error. The candidate passes 216 focused tests across harness registration/selection, runtime plugin preparation, and configless agent exec.
  • Real OpenAI proof uses Blacksmith Testbox tbx_01m1pnxg4tzcbzqaq7ah2p2edq: run. The final live regression failed on original base 0d2bc80eee0c2bcec52fc01e3727844e4c823759 with the unavailable Codex error and passed on the candidate in 6.7 seconds, requiring actual Code Mode engagement, at least two nested calls, DONE, and exact read/write bytes. All 37,539 source entries matched the local candidate fingerprint.
  • The live fixture copies built runtime artifacts outside the source checkout and applies canonical package plugin exclusions; installed dependencies are reused. This tests the built distribution, not npm tarball installation. A source-checkout probe also successfully selected the native Codex runtime; its documented codeModeEngaged: false is distinct from OpenClaw Code Mode.
  • Existing native-live shard discovery automatically includes this file in stable/full release validation. The canonical Vitest build-prerequisite owner builds before workers start, avoiding child builds during concurrent imports.
  • Changed-file formatting, lint, type checks, and structural guards pass; all 441 test-runner routing tests pass. Independent Codex review is clean through P2.
  • Runtime callers, prepared registry lifecycle, existing implicit fallback, explicit owner diagnostics, and native session pins were inspected. Codex source checked at 956aa3f6372ffd73a0df639beff356b3b664b858: codex-rs/login/src/auth/manager.rs (API-key authentication) and codex-rs/core/src/tools/code_mode/execute_spec.rs (native Code Mode contract).
  • Production change: +5/-4 lines (net +1), expressing the implicit-versus-explicit ownership distinction. Test and test-runner support: +165/-3 lines. Documentation: +4/-0. No new configuration, environment variable, schema, or dependency.

The first CI run also exposed a pre-existing Control UI startup-budget failure on main. Unmodified main CI measured 350377 B against a stale 350141 B enforcement limit; a pristine-main build measured 350363 B and the candidate 350380 B. The canonical updater reconciles the recorded baseline to 350377 B, retaining the fixed 358400 B cap, 512 B growth allowance, and 64 B variance allowance. The UI check and all 43 budget-policy tests pass. This is the only incidental CI repair; UI product code is unchanged.

ClawSweeper review disposition: accepted the one-line production increase because it expresses the concrete-versus-implicit runtime distinction without duplicating normalization or weakening explicit pins. The review identifies no correctness/security finding and no simpler net-neutral formulation. The original fix remains patch-identical after rebasing onto current main.

Final published revision 1445526171469010ef5ebcf1d7566d19e906660d also passed the same live OpenAI Code Mode test in 7.0 seconds on a fresh Blacksmith Testbox run, lease tbx_01m1ptp0f4fr6ssem0h5a2qevy. All 37,646 source entries matched the local published revision before execution.

@clawsweeper

clawsweeper Bot commented Sep 4, 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 scripts Repository scripts agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Sep 4, 2026
@steipete
steipete marked this pull request as ready for review September 4, 2026 17:50
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 4, 2026, 2:02 PM ET / 18:02 UTC.

ClawSweeper review

What this changes

The branch lets an implicit unavailable Codex harness preference fall back to OpenClaw’s built-in runtime for environment-only OpenAI agent runs, adds built-distribution live coverage, and documents the behavior.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this maintainer-labelled PR open: current main still rejects the implicit unavailable Codex preference before selection, while the patch restores the selector-owned fallback and preserves explicit-runtime failures. No introduced correctness or security defect was found.

Priority: P1
Reviewed head: e47c732152f6693e15dc418c44e7614b0ac3e0d7

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused owner-boundary fix with strong targeted and release-wired regression coverage; no actionable defect was identified.
Proof confidence 🌊 off-meta tidepool Not applicable: The repository state identifies this as a member-authored PR, so the external-contributor proof gate does not apply. The added test nevertheless exercises copied built distribution with fresh HOME/state/workspace, only an OpenAI key, and exact after-run output; the reported Actions run could not be reopened in this review because GitHub DNS was unavailable.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository state identifies this as a member-authored PR, so the external-contributor proof gate does not apply. The added test nevertheless exercises copied built distribution with fresh HOME/state/workspace, only an OpenAI key, and exact after-run output; the reported Actions run could not be reopened in this review because GitHub DNS was unavailable.
Evidence reviewed 7 items Current-main failure path: Current main still resolves the implicit policy runtime and throws when its plugin registry lacks that harness; it has no implicit-source early return.
Introduced owner-boundary repair: The branch distinguishes a concrete override or pin from an implicit policy and bypasses only registration preflight for the latter; explicit selections still reach the missing-harness error.
Existing fallback is selector-owned: Availability converts only an implicit unavailable Codex runtime to OpenClaw; selection otherwise keeps explicit plugin runtimes fail-closed.
Findings None None.
Security None None.

How this fits together

Agent exec resolves runtime policy, prepares any required plugin harness, then selects the runtime that executes the turn. The selector already owns the implicit Codex-unavailable fallback; this patch prevents preflight from stopping the turn before that decision.

flowchart LR
  A[Agent exec command] --> B[Runtime policy]
  B --> C[Harness plugin preflight]
  C --> D{Explicit runtime or pin?}
  D -->|Yes| E[Require registered harness]
  D -->|No| F[Harness selector]
  F --> G[OpenClaw runtime fallback]
  E --> H[Agent run]
  G --> H
Loading

Before merge

  • Resolve merge risk (P2) - Production code is net +1 line for this bug fix; the named explicit-runtime value is the minimal visible distinction that prevents implicit fallback from weakening explicit pins or policy.
Agent review details

Security

None.

PR surface

Source +1, Tests +156, Docs +4, Other +6. Total +167 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 4 +1
Tests 3 159 3 +156
Docs 2 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 1 6 0 +6
Total 7 174 7 +167

Review metrics

Metric Value Why it matters
Production versus regression coverage production +5/-4; tests and test-support +165/-3; docs +4/-0 The production delta is confined to explicit-versus-implicit runtime ownership, while added coverage exercises both policy boundaries and the built CLI path.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep implicit fallback in the existing selector and retain preflight validation for concrete overrides, pins, and authored model/provider policies; no net-neutral formulation was identified that avoids duplicating runtime normalization.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep implicit fallback in the existing selector and retain preflight validation for concrete overrides, pins, and authored model/provider policies; no net-neutral formulation was identified that avoids duplicating runtime normalization.

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

Yes. Current main’s preflight throws for the implicit missing Codex runtime, while the existing selector already maps that exact implicit-unavailable state to OpenClaw.

Is this the best way to solve the issue?

Yes. The patch removes duplicate policy enforcement at preflight so the existing selection owner can apply its established fallback, without adding a CLI-only override.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: The repaired clean environment-only agent-exec route currently stops before inference, blocking headless OpenAI-key tasks.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies this as a member-authored PR, so the external-contributor proof gate does not apply. The added test nevertheless exercises copied built distribution with fresh HOME/state/workspace, only an OpenAI key, and exact after-run output; the reported Actions run could not be reopened in this review because GitHub DNS was unavailable.

Label justifications:

  • P1: The repaired clean environment-only agent-exec route currently stops before inference, blocking headless OpenAI-key tasks.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies this as a member-authored PR, so the external-contributor proof gate does not apply. The added test nevertheless exercises copied built distribution with fresh HOME/state/workspace, only an OpenAI key, and exact after-run output; the reported Actions run could not be reopened in this review because GitHub DNS was unavailable.

Evidence

What I checked:

  • Current-main failure path: Current main still resolves the implicit policy runtime and throws when its plugin registry lacks that harness; it has no implicit-source early return. (src/agents/harness/runtime-plugin.ts:205, b6a4d0dad430)
  • Introduced owner-boundary repair: The branch distinguishes a concrete override or pin from an implicit policy and bypasses only registration preflight for the latter; explicit selections still reach the missing-harness error. (src/agents/harness/runtime-plugin.ts:205, e47c732152f6)
  • Existing fallback is selector-owned: Availability converts only an implicit unavailable Codex runtime to OpenClaw; selection otherwise keeps explicit plugin runtimes fail-closed. (src/agents/harness/availability.ts:51, e47c732152f6)
  • Focused and live regression coverage: Tests cover explicit override, session-pin, and model-policy failures, while the new live test invokes copied built distribution with isolated paths and asserts Code Mode engagement plus exact filesystem output. (test/agent-exec-code-mode.live.test.ts:18, e47c732152f6)
  • Release-lane wiring: The live-test project includes test live files, prepares the runtime before workers, validates every selected file has a passing assertion, and stable/full release workflows include native-live-test with the OpenAI key. (scripts/test-live-shard.mts:612, e47c732152f6)
  • Regression release provenance: The related merged refactor commit has a recorded parent and is contained in v2026.9.1; its exact parent-relative source hunk could not be read from this partial clone, so no line-level predecessor attribution is made. (6c9b38862d2d)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

Unmodified main b6a4d0d fails the startup gzip check at 350377 B in Linux CI; a pristine source build measures 350363 B. Record the measured main baseline while retaining the fixed cap and existing growth and variance allowances.
@steipete
steipete force-pushed the codex/fix-agent-exec-auth-env-only branch from e47c732 to 1445526 Compare September 4, 2026 18:17
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Resolved the ClawSweeper review disposition: the +1 production line is accepted because it preserves the explicit-versus-implicit ownership distinction without repeating normalization or weakening configured runtimes/session pins. The review found no correctness or security defect and no simpler net-neutral formulation. No Rank-up moves were listed.

The final revision also reconciles an independently reproduced stale Control UI baseline: unmodified main's CI job measured 350377 B, while a pristine-main build measured 350363 B. Fixed cap and existing allowances are retained. The UI budget check and 43 budget-policy tests pass, and independent Codex review remains clean through P2.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 4, 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:

@steipete
steipete merged commit 26f87a3 into main Sep 4, 2026
194 of 195 checks passed
@steipete
steipete deleted the codex/fix-agent-exec-auth-env-only branch September 4, 2026 18:37
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 4, 2026
Reuse the canonical startup baseline from #138449, terminal-parent QA
acknowledgment from #137342, and handle-scoped reclamation fixture from
#138481. Keep the Watch, Rust and Gateway/provider production sources
unchanged from the verified 907 native and real-provider checkpoint.

The four-file delta has a clean independent review. Source binding retains
all 148 native inputs, 10 Rust pins and 3,095 Gateway/auth facts; tests and
baseline proof remain source-specific. No required check, timeout or size
allowance is disabled.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
…claw#138449)

* fix: allow environment-only agent runs without a native harness

* chore(ui): reconcile measured main startup baseline

Unmodified main eebbf9f fails the startup gzip check at 350377 B in Linux CI; a pristine source build measures 350363 B. Record the measured main baseline while retaining the fixed cap and existing growth and variance allowances.
steipete added a commit that referenced this pull request Sep 5, 2026
* feat(watch): add native standalone realtime voice

Add opt-in Talk on Watch with provider-direct WebRTC/Opus, scoped Gateway
control and explicit call/audio ownership. Preserve phone-mediated voice.

Resolve native endpoints consistently across ICE and Network.framework,
fence late resolver/media work after cancellation, and release received
Opus promptly after packet loss while dropping late speech. Keep recoverable
provider notices visible without closing the session; make setup actionable.

Source review passes all eleven sections through P3. Native engine RED/GREEN
passes eleven final cases; real Watch Simulator resolver classification and
held-result cancellation pass fifteen and sixteen cases respectively.
Full device/provider/current-base CI verification remains a landing gate.

Uses the already-landed app-local companion journal; adds no database schema
or protocol-version change. Physical Watch microphone/speaker, background
and endurance behavior remains unverified.

* fix(watch): use OS entropy for ICE credentials

Supply fresh ICE credentials through the native engine's existing owner API
instead of relying on the pinned library's non-cryptographic defaults.
Fail engine creation closed if operating-system entropy is unavailable.

The actual C-ABI regression repeats dependency RNG state: credentials repeat
before the repair; all twelve engine cases pass afterward. The existing locked
getrandom package owns the platform entropy call; no resolved packages,
configuration, database schema, or Gateway protocol are added.

* test(qa): follow canonical ClawHub documentation ownership

* test(ios): retain websocket frames across receive registration

* test(qa): align Watch branch with landed documentation reference

* test(ios): include websocket regressions in selected lifecycle suite

* fix(watchos): remove unused audio startup result

Remove the unused audio-format result through the audio, media-session and controller path. Periphery exposed obsolete fields in a value the sole caller discarded; activation, cancellation and codec policy stay unchanged.

Include the separately reviewed Apple fixture synchronization fixes from #138207 while that prerequisite lands. No Gateway runtime, protocol, configuration or persistence changes.

* chore(watch): sync landed CI prerequisites

Reuse the canonical startup baseline from #138449, terminal-parent QA
acknowledgment from #137342, and handle-scoped reclamation fixture from
#138481. Keep the Watch, Rust and Gateway/provider production sources
unchanged from the verified 907 native and real-provider checkpoint.

The four-file delta has a clean independent review. Source binding retains
all 148 native inputs, 10 Rust pins and 3,095 Gateway/auth facts; tests and
baseline proof remain source-specific. No required check, timeout or size
allowance is disabled.

Co-authored-by: Ayaan Zaidi <[email protected]>

* fix(gateway): compose device reply ownership with watch voice teardown

Use the canonical committed-mutation response owner from #138492 for device
remove, rotate and revoke, preserving immediate fencing and scoped teardown.
Include the separately reviewed #138625 cleanup fix so a retired caller cannot
skip removed-device worker reconciliation. Keep setup/bootstrap on their
existing retirement helper and retain the Watch HTTP invalidation owner.

Validation: 194 owner, Watch and authorization tests passed with zero skips;
fresh scoped managed review found no P0-P3 findings. Full changed checks and
new published-head native/Gateway live proof remain separate landing gates.

* test(watch): isolate platform metadata regressions

---------

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
* feat(watch): add native standalone realtime voice

Add opt-in Talk on Watch with provider-direct WebRTC/Opus, scoped Gateway
control and explicit call/audio ownership. Preserve phone-mediated voice.

Resolve native endpoints consistently across ICE and Network.framework,
fence late resolver/media work after cancellation, and release received
Opus promptly after packet loss while dropping late speech. Keep recoverable
provider notices visible without closing the session; make setup actionable.

Source review passes all eleven sections through P3. Native engine RED/GREEN
passes eleven final cases; real Watch Simulator resolver classification and
held-result cancellation pass fifteen and sixteen cases respectively.
Full device/provider/current-base CI verification remains a landing gate.

Uses the already-landed app-local companion journal; adds no database schema
or protocol-version change. Physical Watch microphone/speaker, background
and endurance behavior remains unverified.

* fix(watch): use OS entropy for ICE credentials

Supply fresh ICE credentials through the native engine's existing owner API
instead of relying on the pinned library's non-cryptographic defaults.
Fail engine creation closed if operating-system entropy is unavailable.

The actual C-ABI regression repeats dependency RNG state: credentials repeat
before the repair; all twelve engine cases pass afterward. The existing locked
getrandom package owns the platform entropy call; no resolved packages,
configuration, database schema, or Gateway protocol are added.

* test(qa): follow canonical ClawHub documentation ownership

* test(ios): retain websocket frames across receive registration

* test(qa): align Watch branch with landed documentation reference

* test(ios): include websocket regressions in selected lifecycle suite

* fix(watchos): remove unused audio startup result

Remove the unused audio-format result through the audio, media-session and controller path. Periphery exposed obsolete fields in a value the sole caller discarded; activation, cancellation and codec policy stay unchanged.

Include the separately reviewed Apple fixture synchronization fixes from openclaw#138207 while that prerequisite lands. No Gateway runtime, protocol, configuration or persistence changes.

* chore(watch): sync landed CI prerequisites

Reuse the canonical startup baseline from openclaw#138449, terminal-parent QA
acknowledgment from openclaw#137342, and handle-scoped reclamation fixture from
openclaw#138481. Keep the Watch, Rust and Gateway/provider production sources
unchanged from the verified 907 native and real-provider checkpoint.

The four-file delta has a clean independent review. Source binding retains
all 148 native inputs, 10 Rust pins and 3,095 Gateway/auth facts; tests and
baseline proof remain source-specific. No required check, timeout or size
allowance is disabled.

Co-authored-by: Ayaan Zaidi <[email protected]>

* fix(gateway): compose device reply ownership with watch voice teardown

Use the canonical committed-mutation response owner from openclaw#138492 for device
remove, rotate and revoke, preserving immediate fencing and scoped teardown.
Include the separately reviewed openclaw#138625 cleanup fix so a retired caller cannot
skip removed-device worker reconciliation. Keep setup/bootstrap on their
existing retirement helper and retain the Watch HTTP invalidation owner.

Validation: 194 owner, Watch and authorization tests passed with zero skips;
fresh scoped managed review found no P0-P3 findings. Full changed checks and
new published-head native/Gateway live proof remain separate landing gates.

* test(watch): isolate platform metadata regressions

---------

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 docs Improvements or additions to documentation maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts 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.

agent exec with environment-only OpenAI authentication fails without Codex

1 participant