Skip to content

fix(codex): combine client configuration and catalog compatibility - #5503

Closed
luvs01 wants to merge 12 commits into
devfrom
stack/codex-client-compat
Closed

luvs01 wants to merge 12 commits into
devfrom
stack/codex-client-compat

Conversation

@luvs01

@luvs01 luvs01 commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Combine the Codex client configuration and catalog compatibility fixes from #4936, #5450, #5293, and #5298 into the bottom layer of one review stack targeting dev.

  • Reconcile the V1 surface inside the coordinated injection write boundary, preserve the exact preimage on refusal, and serialize competing writes.
  • Refuse restoration onto a conflicting retained provider table, while preserving equivalent tables and history state.
  • Bootstrap reasoning metadata during catalog synchronization and recognize the rendered collaboration-mode prompt layer.
  • Preserve original commit attribution and cherry-pick provenance. Only the first four functional/layout commits from fix(codex): reconcile a v1 injection with the global multi_agent_v2 flag #4936 are included; its unsigned desktop bundle and four unrelated fixture-stability follow-ups remain outside this stack.
  • Move the retained-table regression into a registered sibling test file so the combined branch respects the repository file-size limit.

The next stack layer adds Responses Lite V2 forwarding, account-refusal recovery, and served-model diagnostics. Original PRs remain open; this PR does not claim their unrelated changes are superseded.

Related maintainer carry

Shared contribution: #5450 is also carried by maintainer-owned #5506. The retained-provider production file is identical between the two draft replacements; the corresponding regression is registered in a sibling file here. This source remains consolidated; reconcile this layer against dev when the maintainer carry lands.

Verification

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Review readiness

  • Local CI is green on this exact head.
  • Branch is based on the current dev commit at preparation time.
  • All correct Codex and CodeRabbit findings are fixed on the combined head.
  • Ready-for-review confirmation.

luvs01 and others added 10 commits September 22, 2026 17:57
Codex resolves the global features.multi_agent_v2 override before catalog-level multi_agent_version pins. injectCodexConfig() never reconciled it, so a fresh OpenCodex install (multiAgentMode: v1) on a Codex home that had previously enabled v2 produced a catalog claiming v1 while new sessions actually ran v2 and spawned unreadable encrypted child tasks. The explicit mode selectors (ocx v2 mode, PUT /api/v2) already run the format-preserving transition; the injection path now does the same before taking the journal baseline.

The reconcile lives in src/codex/inject/multi-agent-v2.ts so the inject.ts facade stays under its file-size ratchet cap. Validation-only injection and externally managed provider configs remain read-only.

(cherry picked from commit 96dcf81)
The reconcile ran before withCodexWriteLock, so a later ambiguous-baseline, journal, or lock refusal left config.toml changed while the injection failed, and a competing writer could land between the transition and the commit. The feature transition now runs inside the coordinated write boundary: one preimage captured under the lock covers it and the artifact commit, and any later refusal restores the exact original bytes, flag included. The committed bytes are re-derived from the post-transition input so the injection cannot re-enable the flag it just turned off.

The derivation pipeline moves to inject/plan.ts so inject.ts stays under its file-size ratchet cap, and the reconcile tests move to codex-inject-v1-reconcile.test.ts for the same reason. New regressions prove a post-reconcile failure restores byte-exact config and feature state, and that a competing writer is serialized out between the transition and the commit.

(cherry picked from commit 487c1cf)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
(cherry picked from commit 39fb323)
The models.dev effort snapshot was only ever refreshed after a snapshot had already answered a request-time ladder read, so a missing or corrupt snapshot was never bootstrapped. Catalog sync now refreshes the snapshot for configured gated destinations before gathering the catalog, keeping the models.dev fetch off the request path.

(cherry picked from commit a58bee8)
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the bug Something isn't working label Sep 22, 2026
@github-actions

github-actions Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

⚠️ Deterministic hygiene checks failed.

  • missing_coauthor_credit — This pull request says it reimplements, supersedes, carries, or rebases another author's pull request, but no Co-authored-by trailer names that author. Prose in a commit body is not read by anything; the trailer is what GitHub counts. Add it to the description or a commit, or obtain attribution-approved. Paths: #5506.

@luvs01
luvs01 added this pull request to stack #5505 September 22, 2026 09:22
@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 54 / 80

이 PR은 dev를 바닥으로 잡고, 열려 있던 Codex 클라이언트/카탈로그 호환 수정(#4936, #5450, #5293, #5298)을 한 스택의 맨 아래 층으로 합친 것입니다. 핵심은 네 가지입니다. (1) OpenCodex가 v1 표면을 쓰도록 주입할 때 Codex 전역 features.multi_agent_v2가 켜져 있으면 카탈로그는 v1인데 실제 세션은 v2로 돌아가 자식 작업이 암호문처럼 읽히지 않던 문제를, 명시적 모드 전환과 같은 방식으로 맞춥니다. (2) 그 전환을 쓰기 잠금·사전 이미지 안에 넣어, 중간에서 거절되면 플래그와 파일까지 원래 바이트로 되돌리고 경쟁 쓰기도 한 줄로 막습니다. (3) 복원 때 이미 있는 [model_providers.opencodex]가 캡처한 표와 다르면 거절하고 롤백해서, 히스토리 태그가 다른 목적지로 묶이지 않게 합니다(빈 줄만 다른 표는 정규화 비교로 통과). (4) 카탈로그 동기화 때 reasoning 메타데이터를 미리 채우고, 프롬프트 프로브가 collaboration_mode 레이어를 인식하게 합니다. 파일 크기 한도 때문에 주입 계획은 inject/plan.ts, v1 조정은 inject/multi-agent-v2.ts, 관련 테스트는 형제 파일로 나눴습니다. draft로 둔 점과 “원본 PR의 무관한 커밋까지 대체한다고 말하지 않는다”는 설명은 본문과 맞습니다.

라인 - src/codex/inject.ts / inject/plan.ts: 잠금 밖에서는 입학(admitted) 플랜·증인(witness)을 잡고, 잠금 안에서는 reconcile 뒤 바이트로 플랜을 다시 뽑습니다. 의도는 주석에 잘 적혀 있으나, 증인이 가리키는 후보와 실제 커밋 바이트가 어긋나는 창이 있는지 메인테이너가 한 번 더 확인하는 편이 안전합니다.
라인 - src/codex/inject/multi-agent-v2.ts: prepare와 잠금 사이에 플래그가 켜진 드문 경로에서 require("../../cli/v2") 폴백이 있습니다. ESM/번들 경로에서 깨질 여지를 남기므로, 가능하면 prepare와 같은 동적 import로 통일하는 편이 낫습니다.
라인 - src/codex/sync.ts: refreshReasoningMetadataForSyncsyncModelsToCodex 초입과 refreshCatalogForSync 안에서 겹칠 수 있습니다. 멱등이면 큰 문제는 아니지만, 같은 sync 한 번에 models.dev를 두 번 건드릴 수 있습니다.
라인 - CI / 본문 Verification: 작성자도 exact-head CI·보안 리뷰가 남았다고 했고, 로컬에서 codex-sync-api.test.ts Windows subprocess 타임아웃 2건을 실패로 남겼습니다. draft·체크리스트 미완과 맞물려, 이 헤드를 merge 후보로 보기 전에 플랫폼 CI가 이 SHA에서 녹색인지가 먼저입니다.
라인 - 원본 PR 스택: #4936, #5293, #5298은 여전히 draft/open이고 #5450도 open입니다. 이 PR이 흡수한 커밋 범위와 원본에 남는 범위(예: #4936의 unsigned desktop bundle·픽스처 후속)를 머지 전에 표로 고정하지 않으면, 나중에 중복 머지나 “대체됐다”는 오해가 납니다.

메인테이너의 판단이 필요한 지점

이 네 이슈를 한 바닥 PR로 합치는 것이 리뷰·머지 비용을 줄이는지, 아니면 v1 reconcile 경계 / retained-table 거절 / catalog reasoning bootstrap / collaboration probe를 층마다 쪼개는 편이 감사하기 쉬운지. 또 원본 PR들을 이 스택에 흡수된 시점부터 close·supersede 할지, 남은 커밋만 남긴 채 열어둘지.

너의 추천

draft는 유지한 채, 이 헤드(da8b575)에서 Codex 관련 테스트와 CI를 먼저 녹색으로 맞추고, Windows codex-sync-api 타임아웃이 이 변경 때문인지 환경 플레인지 분리하세요. 잠금 안 reconcile→재파생 계약과 require 폴백만 짧게 손보면 바닥 층으로 두기 좋습니다. dev에 들어가면 #4936/#5450/#5293/#5298 중 이 PR에 들어온 기능 커밋은 무효·중복으로 정리(close 또는 남은 범위만 명시)하는 것을 권합니다. preview deploy 이야기는 불필요합니다.

이 댓글은 grok-bot이 작성했습니다

@github-actions

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • hygiene: missing_coauthor_credit.

What to do

  • Fix missing_coauthor_credit — This pull request says it reimplements, supersedes, carries, or rebases another author's pull request, but no Co-authored-by trailer names that author. Prose in a commit body is not read by anything; the trailer is what GitHub counts. Add it to the description or a commit, or obtain attribution-approved. Paths: #5506.

This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@lidge-jun

Copy link
Copy Markdown
Owner

Superseded by #5609, which is open and not yet merged. The v1 reconcile, which is the same change as #4936, is carried there once. The collaboration_mode prompt layer (9df7867) is cherry-picked (authored by you). The reasoning-metadata bootstrap (719d902, 73aa8d5) is reimplemented with you as co-author, with two changes: catalog sync now waits at most 2 seconds for the fetch, and the stale-only background refresh on the read path, which this commit removed, stays in place, so a long-running server still refreshes an expired snapshot. The retained-provider-table work (731256c, 3dba23d, 73ea9de, da8b575) is already on dev via #5506 (c43f29c), which compares parsed values, so it is not applied twice. Thank you!

@lidge-jun lidge-jun closed this Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working intake: hygiene-blocked Deterministic PR hygiene checks failed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants