Skip to content

fix(local-review): use selected Codex CLI - #541

Merged
brokemac79 merged 3 commits into
mainfrom
codex/csw-038-local-only-codex-path
Jul 13, 2026
Merged

brokemac79 merged 3 commits into
mainfrom
codex/csw-038-local-only-codex-path

Conversation

@brokemac79

@brokemac79 brokemac79 commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Use the operator-selected Codex CLI for local-only reviews and matching local preflight, while preserving a Windows Desktop Codex fallback when no runnable PATH launcher exists.

Problem

review --local-only injected CLAWSWEEPER_PREFER_WINDOWS_CODEX_APP=1, forcing the Windows Desktop app binary at %LOCALAPPDATA%\OpenAI\Codex\bin\codex.exe. On the reported host that binary is stale and rejects the requested model, while the user's normal PATH Codex CLI works. The local preflight selected the same Desktop binary, which could validate a different executable than the review runner.

Implementation

  • Stop forcing the Desktop app binary for local-only reviews and local preflight.
  • Preserve explicit CODEX_BIN precedence.
  • On Windows, resolve in order: explicit CODEX_BIN, the first spawnable PATH codex, then the installed Desktop binary only if PATH has no runnable launcher.
  • Prefer a real PATHEXT launcher over npm's co-located extensionless shell shim; skip unsupported shims and continue searching later PATH entries.
  • Resolve relative PATH entries from the worker's actual launch directory so preflight and the review subprocess make the same selection.
  • Document the ordered behavior and add focused regression coverage.

Production .github/actions/setup-codex remains separate and pinned at @openai/codex 0.139.0; this PR does not modify it.

Validation

  • node --test test/codex-process.test.ts test/command.test.ts test/clawsweeper.test.ts — passed (90 tests).
  • pnpm run build:all — passed.
  • pnpm run lint:scripts — passed for the original local-preflight script change; the follow-up changes no scripts.
  • Focused oxfmt --check for all changed source, documentation, and test files — passed.
  • git diff --check — passed.
  • Native Windows preflight: pnpm run codex:local:check — passed. It selected C:\Windows\System32\cmd.exe ... C:\Users\marti\AppData\Roaming\npm\codex.cmd and completed the gpt-5.6-sol smoke test.
  • Native Windows local runner: pnpm run review -- --local-only --target-repo openclaw/clawsweeper --target-dir <clean detached checkout> --item-number 541 --artifact-dir <temp> — completed successfully in 3m54s with local-only artifacts only; no GitHub comment, label, or branch mutation was performed.
  • pnpm run check previously completed build and lint, then hit unrelated native-Windows prerequisite failures in existing unit tests: unavailable WSL /bin/bash for Bash-helper tests, Windows symlink permissions, and npm.cmd EINVAL in runtime packaging. This PR does not broaden into test-harness or platform-policy changes.

Proof boundary: native Windows local launcher selection only; no workflow or CI-matrix changes.

Codex review closeout

  • codex review --uncommitted initially identified three accepted P2 edge cases: an unspawnable extensionless shim, relative PATH entries resolved from the wrong cwd, and a valid later PATH launcher shadowed by an unsupported earlier shim. Each was fixed with regression coverage.
  • Final codex review --uncommitted: clean — no blocking correctness issues.
  • codex review --base origin/main after commit a6163ddff2: clean — explicit overrides, runnable PATH selection, and Desktop fallback were all verified.

Risks and rollout

Windows local-only review now preserves desktop-only installations while preventing a stale Desktop binary from overriding the user's working PATH CLI. The behavior is limited to local launcher selection and uses no local CLI pin or update. Production setup remains unchanged. This branch is independent of #539.

@brokemac79
brokemac79 requested a review from a team as a code owner July 13, 2026 18:56

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Jul 13, 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 repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 13, 2026, 5:02 PM ET / 21:02 UTC.

Summary
Changes local-only review and preflight launcher resolution to prefer explicit CODEX_BIN or a spawnable PATH Codex command, retain the Windows Desktop binary as fallback, and add documentation and regression coverage.

Reproducibility: yes. On current behavior, a Windows local-only review with a stale Desktop Codex installation and a working PATH CLI selects the forced Desktop executable; the contributor reports native after-fix preflight and review runs using the PATH launcher.

Review metrics: 2 noteworthy metrics.

  • Changed surface: 9 files, +126/-17. The patch spans launcher selection, a shared command resolver, local-review orchestration, documentation, and focused tests rather than changing only one call site.
  • Current checks: 7 successful, 1 skipped. The head passes the repository check, Windows launcher, CodeQL, analysis, and integration jobs.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Confirm the PATH-first Windows compatibility contract before merge.

Risk before merge

  • [P1] Windows users who currently rely on the Desktop Codex binary while another runnable codex exists on PATH will silently switch executables after upgrading; that PATH executable may use a different version, authentication state, or model support.
  • [P1] The PATHEXT-before-extensionless change is implemented in the shared Windows command resolver, so the compatibility effect is broader than only the local-review Codex call sites.

Maintainer options:

  1. Confirm and land PATH-first behavior (recommended)
    Accept that PATH represents the operator-selected Codex installation and merge with the existing Desktop fallback and compatibility tests.
  2. Make PATH-first selection explicit
    Preserve Desktop-first behavior for upgrades and add an explicit opt-in when operators want local review to use PATH.

Next step before merge

  • [P2] A maintainer should confirm the intentional Windows executable-precedence change; no concrete code defect remains for an automated repair worker.

Maintainer decision needed

  • Question: Should Windows local-only reviews treat a runnable PATH codex as the operator-selected default when both PATH and Codex Desktop installations exist?
  • Rationale: The patch is technically coherent, but it intentionally changes a documented default and may switch the executable used by existing Windows installations; only repository owners can accept that compatibility contract.
  • Likely owner: steipete — The choice changes the repository's documented Windows local-review default and requires product-level compatibility ownership.
  • Options:
    • Adopt PATH-first precedence (recommended): Merge the current contract so explicit CODEX_BIN wins, PATH represents operator selection, and Desktop remains the absence fallback.
    • Keep Desktop-first compatibility: Revise the patch to preserve the existing default and require an explicit environment or configuration opt-in for PATH-first selection.

Security
Cleared: The diff changes local executable discovery and tests without altering workflow permissions, secrets, dependencies, downloads, publishing, or production Codex setup.

Review details

Best possible solution:

Adopt one documented launcher contract—explicit CODEX_BIN, then the first spawnable PATH launcher, then the Desktop fallback—and retain regression coverage for PATH-present, unsupported-shim, relative-PATH, and Desktop-only upgrade scenarios.

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

Yes. On current behavior, a Windows local-only review with a stale Desktop Codex installation and a working PATH CLI selects the forced Desktop executable; the contributor reports native after-fix preflight and review runs using the PATH launcher.

Is this the best way to solve the issue?

Yes, conditionally. Centralizing spawnable PATH discovery while retaining explicit override and Desktop fallback is maintainable, but the PATH-first default must be intentionally accepted as the upgrade contract.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix native Windows live results for both preflight launcher selection and a completed local-only review, with the selected PATH command and no GitHub mutation stated.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides after-fix native Windows live results for both preflight launcher selection and a completed local-only review, with the selected PATH command and no GitHub mutation stated.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded Windows local-review reliability improvement with limited production blast radius and no core runtime outage.
  • merge-risk: 🚨 compatibility: Merging changes the documented executable precedence for existing Windows users who have both PATH and Desktop Codex installations.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides after-fix native Windows live results for both preflight launcher selection and a completed local-only review, with the selected PATH command and no GitHub mutation stated.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix native Windows live results for both preflight launcher selection and a completed local-only review, with the selected PATH command and no GitHub mutation stated.
Evidence reviewed

What I checked:

  • Prior blocker resolved: Commit a6163ddff2b68a5b288a7cef2922c6669686cfa1 restores the Windows Desktop executable when no spawnable PATH launcher exists, resolving the previous review finding without restoring Desktop-first precedence. (src/codex-spawn.ts:18, a6163ddff2b6)
  • Explicit override remains authoritative: codexProcessCommand returns a configured CODEX_BIN before performing Windows PATH or Desktop discovery. (src/codex-spawn.ts:22, a6163ddff2b6)
  • Shared Windows command resolution: The patch prefers PATHEXT launchers, skips unsupported extensionless files, and continues through later PATH directories; this fixes npm-shim selection but also changes the shared Windows resolver used beyond the immediate local-review call site. (src/command.ts:163, a6163ddff2b6)
  • Launch-directory alignment: The process wrapper passes the actual requested working directory into Codex command selection so relative PATH entries are interpreted consistently with the review subprocess. (src/codex-process.ts:90, a6163ddff2b6)
  • Focused regression coverage: Tests cover explicit overrides, PATH-first selection, unsupported shims, later PATH entries, relative PATH entries, and Desktop-only fallback behavior. (test/codex-process.test.ts:85, a6163ddff2b6)
  • Native Windows behavior proof: The PR body reports a native Windows preflight selecting the npm codex.cmd launcher and completing the requested model smoke test, followed by a successful 3m54s local-only review run with no GitHub mutation. (a6163ddff2b6)

Likely related people:

  • steipete: Repository policy explicitly routes ClawSweeper operational decisions through Peter, making him the best available owner for the Windows launcher-precedence compatibility choice; concrete line-level ownership history was not established from the supplied context. (role: likely repository policy and merge decision owner; confidence: low; files: src/codex-spawn.ts, src/command.ts, src/clawsweeper.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (1 earlier review cycle)
  • reviewed 2026-07-13T20:00:59.749Z sha c8899b5 :: needs real behavior proof before merge. :: [P1] Preserve the Desktop binary as a fallback

@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 priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. labels Jul 13, 2026
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. 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. and removed 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. labels Jul 13, 2026
@brokemac79
brokemac79 merged commit 3b4a189 into main Jul 13, 2026
13 checks passed
@brokemac79
brokemac79 deleted the codex/csw-038-local-only-codex-path branch July 13, 2026 21:50
vincentkoc added a commit that referenced this pull request Jul 14, 2026
…pair-ops

* origin/main:
  fix(local-review): use selected Codex CLI (#541)
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
* fix(local-review): use selected Codex CLI

* chore: retrigger PR checks

* fix(local-review): preserve Windows Codex fallback
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
…pair-ops

* origin/main:
  fix(local-review): use selected Codex CLI (openclaw#541)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant