Skip to content

[Feature]: opt into Codex client compaction without disabling V2 routing #3978

Closed

Description

@cb8010d6

Area

Multiple areas

What are you trying to accomplish?

Keep OpenCodex V2 subagent routing, including provider-selected plaintext delivery or encrypted task passthrough, while letting Codex perform client-side context compaction. New compacted history should remain replayable after ocx restore or the dashboard Codex OFF action.

What prevents this today?

On an ordinary loopback install, OpenCodex uses Design B and injects only a root openai_base_url. Codex therefore keeps the built-in openai provider identity and selects native remote compaction for every routed model.

For noncanonical providers, OpenCodex converts the compaction turn into a summarizer request and stores the result as type: "compaction" with encrypted_content: "ocx1:<base64>". OpenCodex can decode that envelope while it remains in the path, but native ChatGPT cannot verify it after routing is disabled. This is the forward-looking cause behind the recovery case in #3916.

The V2 task-delivery capability and compaction ownership are independent, but the current loopback injection makes them behave as one choice.

Verified on dev commit 900567af3f (package 2.48.0):

  • src/codex/inject.ts selects the root openai_base_url Design B form for authenticated loopback routing.
  • The same file already supports a dedicated [model_providers.opencodex] form for non-loopback and authless Desktop routing.
  • src/responses/compaction.ts documents and emits the OpenCodeX-owned ocx1: envelope for routed remote compaction V2.
  • Codex client compaction uses a bare context_compaction marker followed by ordinary summary history, so it does not require OpenCodeX to decode a provider-private blob.

What should OpenCodex do?

Offer an explicit, default-off Codex client-compaction compatibility mode. When enabled on loopback routing, OpenCodex should use its dedicated opencodex model-provider table with requires_openai_auth = true, rather than overriding the built-in openai provider. This lets Codex select client compaction while retaining the normal ChatGPT sign-in gate and all existing OpenCodex request routing.

The setting should not change provider-level V2 agent-task policy. allowEncryptedV2AgentTasks, plaintext delivery, and recovery/fallback behavior must remain independent.

Observable requirements:

Example usage or interface

ocx system settings --client-compaction on
ocx sync

Equivalent configuration:

{
  "codexClientCompaction": true
}

Expected managed Codex shape:

model_provider = "opencodex"

[model_providers.opencodex]
name = "OpenCodex Proxy"
base_url = "http://127.0.0.1:10100/v1"
wire_api = "responses"
requires_openai_auth = true

Provider configuration remains separate:

{
  "providers": {
    "example": {
      "adapter": "openai-responses",
      "baseUrl": "https://example.invalid/v1",
      "allowEncryptedV2AgentTasks": true
    }
  }
}

Alternatives or workarounds

  • Keep Design B and use routed remote compaction. This preserves the built-in provider identity but continues creating OpenCodeX-owned ocx1: state for noncanonical providers.
  • Enable codexDesktopAuthless. It already selects the provider-table form, but it also disables the Desktop ChatGPT login gate and is therefore not equivalent.
  • Manually maintain a custom model_provider. OpenCodeX intentionally preserves external provider ownership and then does not manage normal routing or catalog convergence.
  • Repair each affected thread after the fact. This is necessary for existing history but does not prevent new incompatible compaction state.

Additional context

This proposal is intentionally limited to selecting the existing Codex provider-table injection form. It does not redesign the Responses relay, V2 task transport, compaction model routing, or history recovery.

Checks

  • I searched existing issues and documentation.
  • This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
  • I removed secrets and personal data.

Activity

  1. lidge-jun commented on Sep 8, 2026

    @lidge-jun
    Owner

    리뷰 · 우선순위 61 / 80

    이 이슈는 OpenCodex V2 라우팅(플레인텍스트/암호화 task 전달)은 유지한 채, Codex가 클라이언트 쪽 context compaction을 쓰게 하는 opt-in을 요청합니다. 지금 dev HEAD c15662855(package 2.48.0)의 보통 loopback 설치는 Design B입니다. src/codex/inject.ts가 root openai_base_url만 심으면 Codex는 내장 openai provider identity를 유지하고, 모델마다 native remote compaction을 고릅니다. noncanonical provider로 넘어가면 src/responses/compaction.ts가 summarizer 결과를 type: "compaction" + encrypted_content: "ocx1:<base64>"로 저장합니다. 프록시가 붙어 있을 때는 디코드할 수 있지만, ocx restore나 대시보드 Codex OFF 뒤에는 native ChatGPT가 그 blob을 검증하지 못합니다. 이게 #3916 복구 케이스의 앞단 원인으로 이 이슈가 적는 그림이고, HEAD에서도 inject Design B / provider-table([model_providers.opencodex]) / context_compaction 마커 설명이 그대로 있습니다. 제안은 default-off codexClientCompaction(예시 CLI ocx system settings --client-compaction on)으로 loopback에서도 provider-table 폼(requires_openai_auth = true)을 고르게 해, 클라이언트 compaction이 일반 summary history만 남기게 하자는 것입니다. codexDesktopAuthless는 이미 table 폼을 쓰지만 로그인 게이트까지 풀어서 동치가 아닙니다. types/config 분할 캠페인과 직접 충돌하지는 않지만, 새 설정 키를 넣으면 src/types/config.ts / src/config.ts zod / management config-routes / system-command에 같은 패턴으로 슬롯이 필요합니다.

    경로 src/codex/inject.ts · Design B vs provider-table - 이 이슈의 핵심 스위치 지점입니다. 이미 authless Desktop이 table 폼을 고르므로, “auth는 유지한 table 폼” 분기만 신중히 추가하면 됩니다.
    경로 src/responses/compaction.ts · ocx1 envelope - 기존 remote compaction V2 소유권은 유지하고, 이 모드에서는 새 compaction이 ocx1을 안 만들게 하는 쪽이 목표입니다. 과거 히스토리 자동 재작성은 범위 밖으로 둔 선택이 맞습니다.
    경로 #3916 / #3920 - 복구 이슈·PR은 아직 OPEN입니다. 이 이슈는 예방 스위치이고, 복구 레일은 별도로 남겨야 합니다.
    경로 설정 표면 - codexDesktopAuthless와 이름이 비슷한 새 플래가라, CLI/대시보드 문구에서 “로그인 게이트는 유지, compaction 소유만 바꾼다”를 분명히 해야 혼선이 없습니다.
    경로 기본값 - default-off 제안이 맞습니다. 기존 Design B 사용자 다수에게 ocx1 동작을 갑자기 바꾸면 안 됩니다.

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

    너의 추천
    needs-design으로 받아 두세요. 방향(독립 스위치로 table 폼 선택, default-off, 기존 ocx1 비재작성)은 HEAD inject/compaction 구조와 맞습니다. 구현 PR은 inject 분기 + types/config/zod/management/CLI 문구 + “OFF 후 native replay” 통합 테스트 없이 받지 마세요. #3916 복구와 닫히 순서를 같이 적어 두는 편이 좋습니다.

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

  2. lidge-jun commented on Sep 10, 2026

    @lidge-jun
    Owner

    Implemented on dev.

    #4092 (8213fada0) adds the client-side compaction opt-in, with follow-ups that keep existing threads routed when it is enabled (ed89af590) and scope the guidance and UI documentation (dce2b50a0, ad60bc0e8).

    Closing manually: pull requests here target dev, so GitHub does not auto-close linked issues.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions