Skip to content

fix(codex): use ACP recommended model for compatibility - #631

Merged
madawei2699 merged 4 commits into
cf-sfufrom
codex/codex-chatgpt-model-compat
Oct 17, 2026
Merged

madawei2699 merged 4 commits into
cf-sfufrom
codex/codex-chatgpt-model-compat

Conversation

@madawei2699

@madawei2699 madawei2699 commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

Cause

A direct Codex CLI request using the configured model gpt-6.1-sol returned HTTP 400 with the authenticated ChatGPT account. The same minimal request succeeded with another model. Runtime previously relied on model-ID mappings instead of the current ACP session's recommended model.

Change

Remove Codex model-ID compatibility mappings from the Runtime provider registry. During ACP initialization, advertise the JetBrains AIR recommendedValue capability. For a current model that the bridge explicitly marks with description: null as synthesized and uncataloged, Runtime applies the recommendation only when it is advertised in that same session. Explicit Human model selections are always preserved, even when equal to the current value. Catalog models with an empty description, missing/malformed metadata, and unadvertised recommendations are also preserved. Null-vs-empty description evidence remains internal to the ACP adapter.

Verification

  • go test ./internal/harness ./internal/runtime -count=1 — pass.
  • Isolated real-provider probe using the installed @agentclientprotocol/codex-acp@1.12.0: the negotiated session reported current gpt-6.1-sol as a synthesized description: null option, advertised recommendation gpt-6-astra, and Runtime applied that selection. A harmless no-tools Codex turn returned the expected token — pass.
  • The real-provider probe used a standalone ACP process and temporary workspace; it did not connect to or restart the live Room Runtime.

@madawei2699 madawei2699 changed the title fix(codex): fall back from unsupported ChatGPT model fix(codex): use ACP recommended model for compatibility Oct 17, 2026

@madawei2699 madawei2699 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review at PR head d6a82154e89c3f5e54bfabecd1fe79ccbe120478: CHANGES REQUIRED — DO NOT MERGE YET. The overall ACP metadata approach is correct, and the CI checks are green, but two model-selection safety cases need fixes.

P1: explicit Human selection can still be overwritten. ApplySessionConfigFallbacksFor skips only when selectedValue != option.CurrentValue. If a Human explicitly selected the uncataloged model that is currently active, the new recommended-value fallback silently changes it. Upstream codex-acp intentionally exposes such uncataloged current models as selectable options. For this new fallback skip when the Human config key is present at all, regardless of equality. Cover explicit same-as-current, explicit different, and unconfigured/Keep-current.

P1: empty description is not proof of a synthetic unknown model. Upstream createModelConfigOption emits description:null for a synthetic uncataloged entry, but catalog entries have description:model.description and that string can be empty. The new Go ACP parser reduces null and empty string to ""; the guard !currentHasDescription can therefore auto-switch a known catalog model with an empty description to the recommended default. Preserve null-vs-empty wire semantics and apply this fallback only with positive uncataloged-entry evidence; otherwise preserve the current model. Add tests: uncataloged null → recommended, catalog "" → unchanged, explicit selection → unchanged, missing/malformed metadata and unadvertised recommendation → unchanged.

Acceptance evidence still missing: the direct Codex CLI probe verifies a manually chosen model, not that the current installed codex-acp emits the negotiated metadata or the Free4Chat Runtime applies it successfully. Please record a sanitized installed-bridge, exact-version ACP handshake/model-options/result and one harmless successful scoped turn for the originally failing scenario. Do not restart the live resident Runtime. If the failing model is present in the catalog but not permitted for the account, this fallback won't solve it; don't claim otherwise.

No new model-ID mappings, config schema expansion, polling or transport changes. Update the SAME PR. DO NOT MERGE. Return updated head SHA and validation results.

@madawei2699

Copy link
Copy Markdown
Collaborator Author

Addressed at dbb7596fd07238a7e5f397cfae62f19496397b3b.

  • The recommendation fallback now skips whenever the Human selection map contains the model key, including when its value equals the current model.
  • The ACP parser preserves explicit JSON description: null as internal synthetic-entry evidence; description: "" is treated as a catalog entry and does not trigger fallback.
  • Added deterministic cases for explicit same/different selection, unconfigured fallback, null-vs-empty descriptions, missing/malformed metadata, and unadvertised recommendations.

Validation:

  • go test ./internal/harness ./internal/runtime -count=1 — PASS.
  • Installed bridge @agentclientprotocol/codex-acp@1.12.0, isolated ACP session: current gpt-6.1-sol was reported as a synthesized null-description entry; advertised/negotiated recommendation was gpt-6-astra; adapter selected it and a harmless no-tools turn returned the expected token — PASS.
  • The probe ran outside the Room and did not restart the live Runtime. PR remains open; not merged.

@madawei2699
madawei2699 marked this pull request as ready for review October 17, 2026 02:52
@madawei2699
madawei2699 merged commit f7b3acb into cf-sfu Oct 17, 2026
9 checks passed
@madawei2699
madawei2699 deleted the codex/codex-chatgpt-model-compat branch October 17, 2026 02:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T02:54:45.215264Z dbb7596 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dbb7596fd0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

JetBrains struct {
Air struct {
Version int `json:"version"`
RecommendedValue string `json:"recommendedValue"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Ignore malformed recommendations without dropping session controls

When an ACP provider sends a non-string recommendedValue (for example the numeric value exercised by the new malformed-metadata test), unmarshalling it into this string returns an error, so parseSessionControls returns nil and discards every otherwise-valid mode and config option. The test only verifies that no fallback is applied and therefore misses that explicit Human selections and the controls UI become unavailable; decode this optional extension independently so malformed recommendation metadata alone is ignored.

Useful? React with 👍 / 👎.

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.

2 participants