Skip to content

fix: support --model for codex sessions#128

Closed
Asm3r96 wants to merge 4 commits intoopenclaw:mainfrom
Asm3r96:fix-codex-model-flag
Closed

fix: support --model for codex sessions#128
Asm3r96 wants to merge 4 commits intoopenclaw:mainfrom
Asm3r96:fix-codex-model-flag

Conversation

@Asm3r96
Copy link
Copy Markdown
Contributor

@Asm3r96 Asm3r96 commented Mar 12, 2026

Summary

  • apply Codex --model after session/new via session/set_config_option
  • normalize common Codex model aliases like GPT-5-2 to gpt-5.2
  • add tests and sync Codex-facing docs

Closes #49

Validation

  • used Codex to help develop this PR
  • tested locally against a real running Codex session and confirmed the requested model was applied
  • ran local tests with pnpm run test and they passed
  • did a manual human end-to-end check locally

Notes

  • pnpm run check in this environment still fails at the repo-wide coverage gate due to overall baseline coverage totals that are unrelated to this change

@dutifulbob
Copy link
Copy Markdown
Collaborator

Triage result

Human attention: ⚠️ Required
Recommendation: 🏁 escalate to a human
Human decision needed: ready for human landing decision

Quick read

This PR is a narrow bug fix for Codex model selection. It applies --model to Codex sessions after session/new via session/set_config_option, normalizes common aliases like GPT-5-2 to gpt-5.2, adds focused tests, and updates Codex-facing docs.

Intent

Make the existing --model flag actually work for Codex sessions, including on session creation, and accept common GPT-style model aliases users are likely to type.

Why

acpx was already threading model selection through Claude-style session metadata, but Codex ACP does not reliably honor that path. As a result, Codex sessions could stay on the default model even when the user passed --model. This PR addresses that Codex-specific gap directly in the session creation/config path.

Codex review

GitHub Codex review data for the current head was empty.

Local Codex review ran successfully and produced usable output. It reported two P2, non-blocking concerns:

  • prompt-time session recreation may still ignore --model in some reconnect/recreate paths
  • the new Codex model normalizer lowercases arbitrary model IDs, which could affect custom or case-sensitive IDs

No P0 or P1 findings remained, so autonomous review treated the PR as clear to continue.

CI/CD

Targeted regression validation reproduced and confirmed the fix:

  • passed on PR head
  • failed after local-only ablation of the code change
  • passed again after restoring the PR branch state

Targeted validation commands:

  • pnpm run build:test
  • node --test dist-test/test/cli.test.js dist-test/test/client.test.js dist-test/test/prompt-runner.test.js

CI status:

  • the PR workflow was initially approval-blocked
  • approval was applied successfully
  • the rerun completed green
  • remaining annotations were only non-blocking GitHub Actions deprecation warnings for pnpm/action-setup@v4

Merge status:

  • initial conflict check: clean
  • final conflict check: clean

Recommendation

Escalate to a human for landing judgment. The autonomous lane found the fix good enough, validation confirmed the regression and fix, CI is green, and no merge conflicts remain. The remaining decision is whether the non-blocking P2 Codex review notes should be addressed now or deferred.

@osolmaz
Copy link
Copy Markdown
Contributor

osolmaz commented Mar 29, 2026

Superseded by the landed replacement PR #192.

@osolmaz
Copy link
Copy Markdown
Contributor

osolmaz commented Mar 29, 2026

Landed via replacement PR #192 because the original fork branch could not be updated from this maintainer environment even though the PR was marked editable.\n\nThe landed change preserves the core fix from this PR and credits the original author. Thanks @Asm3r96.

@osolmaz osolmaz closed this Mar 29, 2026
@osolmaz
Copy link
Copy Markdown
Contributor

osolmaz commented Mar 29, 2026

Triage result

Human attention: ⚠️ Required
Recommendation: 🏁 escalate to a human
Human decision needed: have a maintainer with access push local commit f6e35d4 to fix-codex-model-flag (or grant write/edit access to that fork branch), then rerun the final CI/conflict gates.

Quick read

The underlying bug fix is validated and the PR direction is still right-shaped.
Blocking review findings are not present.
The remaining blocker is operational: the final conflict-resolution commit was created locally, but git push head HEAD:fix-codex-model-flag was rejected by GitHub with permission denied.
Recent PR head SHAs also did not receive GitHub Actions runs/check suites, so final CI cannot finish until the updated branch is on GitHub.

Intent

Make acpx honor --model for Codex sessions by applying the model after session creation with session/set_config_option("model", ...), instead of only forwarding Claude-style metadata.

Why

Validation established both the broken behavior and the fix:

  • On the PR base commit, the repro only showed newParams._meta.claudeCode.options.model = "GPT-5-2"; there was no post-create model config call.
  • On the PR branch, the same repro additionally issued session/set_config_option("model", ...), which is the needed Codex behavior.

The final merge against origin/main later produced conflicts in src/cli-core.ts and test/mock-agent.ts, but those conflicts had a clear mechanical resolution and were resolved locally. The focused Codex repro still passed after that local merge resolution. The flow is blocked because the resolved merge commit f6e35d4 exists only locally and could not be pushed to the PR head branch.

Codex review

GitHub Codex review data for the current head contained no blocking findings.
The stored local Codex review was established and only raised one P2 concern about wrapper-command detection for Codex overrides. No P0/P1 findings remain.

CI/CD

Earlier CI passed on an older PR SHA, but later SHAs did not get GitHub Actions workflow runs or check suites at all, so there was nothing approval-blocked to approve.
After the local merge resolution, the required push to the fork branch failed with permission denied, so the updated head never reached GitHub for final CI.
Once a maintainer pushes f6e35d4, CI should be rerun and GitHub Actions/check creation should be verified.

Recommendation

  1. A maintainer with access should push commit f6e35d4 to fix-codex-model-flag, or grant the automation a way to update that fork branch.
  2. Rerun the final CI path on the updated head and confirm that GitHub actually creates workflow runs/check suites for it.
  3. If workflows still do not appear, investigate the repository/fork Actions settings separately; the code-path fix itself is already validated.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add --model and --allowed-tools flags for agent passthrough

3 participants