Skip to content

feat(claude-desktop): first-party mode as default, gateway profile as explicit opt-in - #5302

Closed
devin-ai-integration[bot] wants to merge 5 commits into
devin/1789891373-claude-intercept-corefrom
devin/1789891632-claude-desktop-first-party
Closed

devin-ai-integration[bot] wants to merge 5 commits into
devin/1789891373-claude-intercept-corefrom
devin/1789891632-claude-desktop-first-party

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Stack 2/3. ocx claude desktop apply, the native Claude Desktop toggle, and /api/claude-desktop/apply now default to first-party mode: Claude Desktop itself stays on claude.ai (Chat tab, connectors, cloud sessions, Remote Control untouched) and only the Code tab's Claude Code processes — plus subagents and the standalone CLI — are routed through the intercept proxy from PR 1. The existing whole-app gateway profile is kept as an explicit opt-in (--gateway, mode: "gateway").

  • New claudeCode.desktopMode: "first-party" | "gateway". Resolution in src/claude/desktop-first-party.ts:
    explicit desktopMode            -> that mode
    else appliedFingerprint present -> "gateway"    (existing installs keep working across the update)
    else                            -> "first-party"
    
    An implicit first-party apply falls back to gateway when the proxy cannot run on this role/config (e.g. connected client whose proxy lives on the hub); an explicit --first-party fails with a reason instead.
  • First-party apply writes HTTPS_PROXY=http://127.0.0.1:<port+100> and NODE_EXTRA_CA_CERTS=<configDir>/claude-intercept/ca.pem into ~/.claude/settings.json.env via the ownership-aware writer; disable / switching to gateway removes only OpenCodex-owned values. The two modes are mutually exclusive: gateway apply removes first-party env first, first-party apply refuses while a managed gateway profile is active.
  • CLI: --first-party | --gateway [--static|--hybrid|--discovery-only]; legacy shape flags imply gateway; conflicting flags rejected. Mode is persisted with a narrow mutatePersistedConfig (no stale whole-config snapshot).
  • Management API: apply accepts mode; status adds mode and a firstParty block (applied/stale, intercept enabled/running, proxyPort, caCertPath). Gateway policy-conflict reporting is suppressed in first-party mode since Desktop's own config is not touched.
  • ocx ensure reconciles first-party env (refresh stale, remove when disabled) alongside existing gateway cleanup.
  • Existing gateway tests now select gateway explicitly where they previously relied on it being the default.

Verification

  • bun run typecheck
  • bun test tests/claude-integration/claude-desktop-first-party.test.ts tests/claude-integration/claude-management-api.test.ts tests/codex-integration/native-claude-desktop-toggle.test.ts tests/cli
  • bun run privacy:scan, bun run structure:check
  • Full bun run test running on the stack tip; will follow up if anything fails.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed (structure docs here; user-facing docs in PR 3).
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults — settings writer never clobbers foreign proxy/CA values; connected clients cannot be pointed at an unreachable loopback proxy.

Link to Devin session: https://app.devin.ai/sessions/4ec9c3528d424ced9e4a4da906168ad1
Open in Devin Desktop: https://app.devin.ai/desktop/session/4ec9c3528d424ced9e4a4da906168ad1?variant=devin
Requested by: @lidge-jun

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 4b55d70c-a27f-4dce-abd6-4cd565440286

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@devin-ai-integration
devin-ai-integration Bot added this pull request to stack #5304 September 20, 2026 08:31
@github-actions github-actions Bot added the enhancement New feature or request label Sep 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

E2E-tested the mode switch against a real local backend + dashboard (isolated OpenCodex / Claude settings / Desktop library / Codex dirs, on-disk verification).

Found & fixed in a59cecc: Gateway → First-party via "Switch mode & apply" was refused (gateway_profile_active) and required turning the integration off first, contradicting the documented direct switch. First-party apply now pivots the owned gateway profile back to standard before writing the env.

Retest (PR3 GUI + this fix): First-party → Gateway → First-party round trip works directly in the GUI and via ocx claude desktop apply --first-party; old gateway profile deleted, proxy/CA env restored, unrelated settings preserved, no stale status; subsequent Gateway apply still works.

Direct GUI reverse switch After CLI --first-party
GUI first-party restored CLI first-party restored
Also verified (first run)

CONNECT proxy on 10200 tunnels https://example.com, plain GET → 405; first-party apply writes exact HTTPS_PROXY/NODE_EXTRA_CA_CERTS and creates the CA; foreign corporate proxy in settings.json refused with settings byte-identical; arrow-key/Tab operation of the mode radio group; Korean locale strings; ocx claude desktop status fields.

Not tested: real Claude Desktop Code-tab/subagent inference (no Desktop installed), forced gateway-cleanup failure branch, disabled/stopped-proxy UI variants.

@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1789891632-claude-desktop-first-party branch from a59cecc to d354361 Compare September 20, 2026 09:01
@devin-ai-integration
devin-ai-integration Bot removed this pull request from stack #5304 September 20, 2026 09:01
@devin-ai-integration
devin-ai-integration Bot added this pull request to stack #5308 September 20, 2026 09:01
@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 56 / 80

이 PR은 Claude Desktop을 opencodex에 붙이는 방식을 둘로 나눕니다. 기본은 first-party입니다. Desktop 앱 자체(로그인, Chat, connectors, Remote Control)는 claude.ai에 그대로 두고, Code 탭이 띄우는 Claude Code(그리고 서브에이전트·단독 claude CLI)만 로컬 intercept 프록시로 보냅니다. 방법은 ~/.claude/settings.json의 env에 HTTPS_PROXY와 NODE_EXTRA_CA_CERTS만 쓰는 것입니다. 예전처럼 Desktop 전체를 게이트웨이 프로필로 바꾸는 방식은 --gateway / mode: "gateway"로만 켜집니다. 모드 선택은 claudeCode.desktopMode에 저장되고, 이미 gateway를 켠 설치는 fingerprint가 있으면 업데이트해도 갑자기 first-party로 바뀌지 않습니다. CLI·Management API·네이티브 토글·ocx ensure가 같은 계약을 따르도록 맞춰 두었고, 두 모드는 디스크에서 서로 지우고 켜게 되어 있습니다. 테스트도 mode 해석, 플래그 충돌, env 쓰기/거부, API 왕복, ensure 갱신까지 새로 잡았습니다. base는 dev가 아니라 스택 1번(PR #5301 intercept core)이고, GUI/문서는 다음 PR #5303입니다.

라인 - src/server/management/native-integration-routes.ts 네이티브 토글 enable의 first-party 분기: CLI/POST /api/claude-desktop/apply는 gateway 프로필을 replaceWhileEnabled로 먼저 걷어낸 뒤 env를 쓰는데, 토글 경로는 applyDesktopFirstParty만 호출합니다. desktopMode: "first-party"가 명시돼 있는데 gateway 잔여가 남아 있으면 둘 다 살아 남을 수 있습니다.
라인 - 같은 토글 first-party enable: persistDesktopModeField / saveDesktopMode를 호출하지 않아, apply API와 달리 모드 마커가 안 남을 수 있습니다. 기본값 해석으로는 동작하지만 saved-vs-applied 표시가 어긋날 여지가 있습니다.
라인 - src/server/management/agent-settings-routes.ts gateway apply 성공 후 persistDesktopModeField(config, "gateway") 반환값을 보지 않습니다. first-party 경로는 saved/warning을 주는데 gateway는 마커 저장 실패를 조용히 넘깁니다.
라인 - src/cli/ensure-desired-integrations.ts first-party ON인데 디스크에 gateway_ours/gateway_drifted가 있으면 early return으로 stale env 갱신도 안 합니다. status는 디스크 gateway를 우선시하니, 모드 마커와 실제 상태가 어긋난 채 ensure가 고치지 않을 수 있습니다.
라인 - base가 dev가 아니라 devin/1789891373-claude-intercept-core(PR #5301). 스택 2/3로는 맞지만 tip/dev 기준 단독 머지 대상은 아닙니다.

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

네이티브 토글을 “ON/OFF만”으로 둘지, apply와 같이 gateway→first-party 교체까지 맡길지. 토글이 모드 전환 UI가 아니라면 문서/가드만으로도 충분할 수 있고, GUI(#5303)가 모드를 바꾸면 토글 패리티 구멍이 실제 사고로 이어질 수 있습니다. 또한 #5301 없이 이 브랜치만 dev에 올리면 intercept 런타임이 없어 first-party 기본값이 바로 깨집니다.

너의 추천

#5301이 먼저 안정된 뒤 이 PR을 머지하는 스택 순서를 유지하세요. 머지 전에 네이티브 토글 first-party enable에 gateway pivot(+ 가능하면 mode 마커 저장)을 apply와 맞추거나, 토글은 모드 전환을 하지 않는다고 명시하고 잔여 gateway가 있으면 거부하는 쪽 중 하나를 고르세요. gateway apply의 mode 마커 실패도 first-party처럼 warning으로 노출하는 편이 낫습니다. #5303과 함께 E2E로 모드 왕복(gateway↔first-party)과 토글 OFF 잔여 정리를 한 번 더 보면 좋습니다.

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

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • review readiness checklist open (0/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 0/4).

Review readiness checklist

  • ⬜ All CI tests are green on my local testing.
  • ⬜ I pushed my PR to the latest dev commit.
  • ⬜ I resolved all correct Codex and CodeRabbit findings.
  • ⬜ My PR is ready for review.

0/4 boxes ticked.

This PR stays in draft until every box above is ticked.

@github-actions
github-actions Bot marked this pull request as draft September 20, 2026 09:21
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Addressed in the latest commit on this branch:

  • Native toggle first-party enable — now follows the same contract as POST /api/claude-desktop/apply: an owned/drifted gateway profile is pivoted to standard (replaceWhileEnabled: true) before the first-party env is written, and cleanup failure refuses the enable without writing env. It also persists the desktopMode: "first-party" marker (failure surfaces in the response message). Regression test: "native toggle: enabling into explicit first-party pivots an applied gateway profile and saves the mode marker".
  • Gateway apply marker — persistDesktopModeField(config, "gateway") result is now checked; a miss returns saved: false plus a warning, mirroring the first-party path.
  • ensure with first-party marker + gateway on disk — kept as non-mutating (an update hook should not replace a live Desktop profile), but it now logs a warning pointing at ocx claude desktop apply --first-party|--gateway instead of returning silently. Test added.

Stack order unchanged: #5301 must land first.

@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1789891632-claude-desktop-first-party branch from d354361 to f89ce7e Compare September 20, 2026 09:33
lidge-jun and others added 3 commits September 20, 2026 02:39
… explicit opt-in

Add claudeCode.desktopMode (first-party | gateway). First-party keeps Claude
Desktop on claude.ai and writes only HTTPS_PROXY/NODE_EXTRA_CA_CERTS into
Claude Code's settings.json so the Code tab, subagents and the claude CLI go
through the local intercept pair. Gateway keeps the existing 3P profile writer.

- resolveClaudeDesktopMode: explicit > applied gateway fingerprint > first-party,
  so existing gateway installs do not flip on update while new installs get 1P
- resolveClaudeDesktopApplyMode: implied 1P falls back to gateway where the
  intercept pair cannot run (client role / intercept disabled)
- CLI: ocx claude desktop apply [--first-party|--gateway]; legacy shape flags
  imply --gateway; connected clients default to gateway
- API: /api/claude-desktop/apply accepts first-party|gateway (+ legacy shapes),
  status reports mode + firstParty block; native toggle applies resolved mode
  and disable removes both gateway profile and 1P env
- ocx ensure: refresh stale 1P env when ON, remove it when OFF
- modes are mutually exclusive; foreign proxy/CA env is never overwritten

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…file

Switching gateway -> first-party from the GUI/CLI/API previously refused with
gateway_profile_active and required turning the integration off first, while the
docs and the GUI switch note promise a direct replacement in both directions.
The first-party branch now pivots the owned gateway profile back to standard
(removeDesktop3pStandardPivot with replaceWhileEnabled, since the durable switch
stays ON) before writing the env, and fails without writing when the pivot cannot
complete.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…for first-party

- The native ON toggle pivots an owned gateway profile to standard (replaceWhileEnabled)
  before writing the first-party env, and persists the desktopMode marker, matching
  POST /api/claude-desktop/apply.
- Gateway apply now reports a failed mode-marker save as saved:false plus a warning
  instead of dropping the result.
- ensure/update warns when an explicit first-party marker contradicts a gateway profile
  still on disk rather than returning silently.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1789891632-claude-desktop-first-party branch from f89ce7e to c9ed363 Compare September 20, 2026 09:40
@lidge-jun

Copy link
Copy Markdown
Owner

추가 리뷰 · 우선순위 42 / 80

이 추가 리뷰는 직전 리뷰 이후 tip c9ed363까지의 변경을 봅니다. 직전에서 지적한 큰 구멍 세 개는 대체로 막혔습니다. (1) 네이티브 토글 first-party enable이 이제 apply와 같이 소유 gateway 프로필을 replaceWhileEnabled로 먼저 걷어낸 뒤 env를 쓰고, desktopMode: "first-party" 마커도 남깁니다. (2) gateway apply도 모드 마커 저장 실패를 saved: false + warning으로 드러냅니다. (3) ocx ensure는 first-party 마커와 디스크 gateway가 어긋날 때 조용히 넘어가지 않고 경고를 남깁니다. API·토글·ensure 회귀 테스트도 같이 들어왔습니다. 동작 계약은 “gateway ↔ first-party는 한 번에 교체, 둘 다 동시에 켜두지 않음”으로 문서와 코드가 맞춰졌습니다.

라인 - gateway → first-party 전환 후에도 claudeCode.desktopProfile.appliedFingerprint를 지우지 않습니다. 지금은 명시 desktopMode: "first-party"가 우선이라 평소엔 괜찮지만, 모드 마커 저장만 실패하면 resolveClaudeDesktopMode가 fingerprint 때문에 다시 gateway로 읽고, 디스크에는 first-party env가 남은 채 status/해석이 어긋날 수 있습니다.
라인 - src/server/management/native-integration-routes.ts 토글의 gateway enable 분기(first-party가 아닐 때): first-party 쪽은 마커를 저장하는데 gateway 쪽은 여전히 persistDesktopModeMarker("gateway")를 안 합니다. apply API와 패리티가 한쪽으로만 맞춰진 상태입니다.
라인 - pivot이 cleanup_incomplete로 실패하면 메시대로 Desktop은 이미 standard를 가리킬 수 있는데 first-party env는 안 쓰이고, 내구성 스위치는 ON인 채로 남습니다. 자동 복구 경로가 없어서 운영자가 apply를 다시 눌러야 합니다.
라인 - base는 여전히 dev가 아니라 PR #5301 스택 브랜치입니다. draft 체크리스트 0/4, tip CI도 아직 진행 중입니다.

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

first-party로 바꾼 뒤 gateway appliedFingerprint를 같이 지울지. 지우면 마커 저장 실패 시 잘못된 gateway 해석을 줄이고, 남기면 “예전에 gateway였다”는 흔적은 남습니다. ensure가 모순을 경고만 하고 고치지 않는 설계도 그대로 둘지, 안전한 자동 교체까지 허용할지는 업데이트 훅의 공격성 문제입니다. 스택은 #5301 → 이 PR → #5303 순을 유지할지 확인이 필요합니다.

너의 추천

직전 블로커는 해소된 편이라, 머지 전 남은 건 fingerprint 정리(또는 마커 실패 시 롤백/거부)와 토글 gateway 경로의 모드 마커 패리티 정도입니다. #5301 머지·CI 그린·체크리스트 기입을 기다린 뒤 이 PR을 올리고, #5303에서 GUI 모드 왕복 E2E로 한 번 더 확인하는 흐름이 안전합니다.

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

… record gateway mode from the native toggle

All three mode-marker writers (CLI apply, /api/claude-desktop/apply, native toggle) now share
recordClaudeDesktopMode. Switching to first-party clears desktopProfile.appliedFingerprint/appliedAt
so a lost explicit marker can no longer resolve back to gateway while first-party env is on disk;
the profile assignments stay for a later gateway apply. The native toggle's gateway enable branch
saves desktopMode="gateway" like the apply route does.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

f777c7f addresses the two code points:

  • fingerprint: all three marker writers (CLI saveDesktopMode, /api/claude-desktop/apply, native toggle) now go through one recordClaudeDesktopMode. Recording first-party also drops desktopProfile.appliedFingerprint/appliedAt, so a lost explicit marker can no longer resolve back to gateway while first-party env is on disk. Profile assignments stay for a later gateway apply. Test asserts the saved config resolves to first-party even with desktopMode stripped.
  • toggle gateway parity: the native toggle's gateway enable branch now saves desktopMode: "gateway" (with the same "marker could not be saved" warning shape). Test added.

Not changed: cleanup_incomplete on the pivot stays a post-commit refusal (Desktop already standard, env not written, switch ON) — same shape as the existing disable path; the operator re-applies. Keeping ensure warn-only. Stack order stays #5301 → this → #5303.

@lidge-jun

Copy link
Copy Markdown
Owner

추가 리뷰 · 우선순위 30 / 80

이 추가 리뷰는 직전 tip c9ed363 이후 f777c7f 한 커밋만 봅니다. 직전에서 남긴 코드 쪽 두 구멍은 실제로 막혔습니다. CLI apply·/api/claude-desktop/apply·네이티브 토글이 모두 recordClaudeDesktopMode 한곳으로 모드 마커를 쓰고, first-party로 기록할 때 desktopProfile.appliedFingerprint/appliedAt을 같이 지웁니다. 그래서 명시 마커가 사라져도 resolve가 다시 gateway로 되돌아가는 경로가 닫혔습니다. assignments는 남겨 두어 나중에 gateway apply가 재사용할 수 있습니다. 네이티브 토글의 gateway enable 분기도 이제 desktopMode: "gateway"를 저장하고, 실패 시 apply와 비슷한 경고 문구를 붙입니다. first-party 왕복 쪽 테스트는 fingerprint가 비었는지·마커를 지워도 resolve가 first-party인지까지 확인합니다.

라인 - native toggle: enabling into gateway saves the gateway mode marker 테스트는 시작 config에 이미 desktopMode: "gateway"를 넣고 켭니다. 토글이 마커를 안 써도 통과할 수 있어, “토글이 저장한다”는 주장을 증명하지 못합니다. desktopMode 없거나 first-party인 상태에서 켠 뒤 gateway로 바뀌었는지 보는 편이 맞습니다.
라인 - pivot이 cleanup_incomplete로 끊기면 Desktop은 이미 standard인데 first-party env는 안 쓰이고 내구성 스위치는 ON인 채입니다. 이번 커밋에서도 자동 복구는 없고, 운영자가 다시 apply하는 계약으로 남겼습니다.
라인 - base는 여전히 dev가 아니라 #5301 스택 브랜치입니다. draft 체크리스트는 0/4이고, tip CI는 리눅스 쪽은 대체로 통과했지만 macos/keyring 등 일부가 아직 pending입니다.

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

cleanup_incomplete와 ensure의 “경고만” 정책을 이번 스택에서 끝까지 유지할지, 아니면 #5303 GUI/E2E에서만 운영 절차로 커버할지. 스택 순서(#5301 → 이 PR → #5303)와 tip을 dev에 올리기 전에 base rebase를 언제 할지도 확인이 필요합니다.

너의 추천

직전 코드 블로커는 해소된 상태입니다. 머지 전에 gateway 토글 마커 테스트를 시작 상태를 비운 채로 고치고, #5301 머지·CI 전부 그린·체크리스트 기입 후 이 PR을 올리는 흐름이면 됩니다. 제품 동작은 이 tip 기준으로 first-party 기본 + gateway 교체 계약이 문서·코드·테스트(약한 gateway 토글 테스트 제외)와 맞춰졌습니다.

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

…er from an unmarked config

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Good catch — c21865c fixes the weak test. The toggle test now starts from a config with no desktopMode (gateway is implied only by intercept.enabled: false), enables, and asserts the saved config carries desktopMode: "gateway" and resolves to gateway. cleanup_incomplete / ensure warn-only stay as the documented operator contract for this stack.

@lidge-jun

Copy link
Copy Markdown
Owner

추가 리뷰 · 우선순위 18 / 80

이 추가 리뷰는 직전 tip f777c7f 이후 c21865c 한 커밋만 봅니다. 제품 코드는 그대로이고, 직전에서 지적한 약한 테스트만 고쳤습니다. native toggle: enabling into gateway saves the gateway mode marker는 이제 시작 config에 desktopMode를 두지 않고, intercept.enabled: false로만 gateway가 암시되게 한 뒤 토글을 켭니다. 저장 결과에 desktopMode: "gateway"가 있고 resolveClaudeDesktopMode도 gateway인지까지 확인합니다. 그래서 “토글이 마커를 실제로 쓴다”는 주장을 테스트가 증명합니다. Devin도 cleanup_incomplete와 ensure의 경고만 정책은 이번 스택에서 유지한다고 명시했습니다.

라인 - tip CI는 리눅스·keyring·gates 등은 통과했지만 macos 1/2·2/2가 아직 pending입니다. 머지 전 전부 그린인지 한 번 더 보면 됩니다.
라인 - base는 여전히 dev가 아니라 #5301 스택 브랜치(devin/1789891373-claude-intercept-core)입니다. draft 체크리스트도 0/4입니다.
라인 - cleanup_incomplete 시 Desktop은 standard인데 env는 안 쓰이고 스위치는 ON인 채, ensure는 모순을 경고만 하는 계약은 그대로입니다. 이번 커밋에서도 바꾸지 않았고, 의도된 운영자 재적용으로 남습니다.

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

코드 쪽 리뷰 지적은 이번 tip에서 닫힌 상태입니다. 남은 결정은 스택 순서(#5301 → 이 PR → #5303)와 tip을 dev에 올리기 전 rebase 시점, 그리고 draft 체크리스트/CI 완료를 언제 “머지 가능”으로 볼지입니다.

너의 추천

제품 동작·계약·테스트(게이트웨이 토글 마커 포함)는 이 tip 기준으로 맞춰졌습니다. #5301 머지 후 base를 dev에 맞추고, tip CI 전부 그린·체크리스트 기입 뒤 이 PR을 올리면 됩니다. cleanup_incomplete/ensure 경고만 정책은 #5303 GUI·운영 문서에서 한 번 더 짚으면 충분합니다.

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

@lidge-jun
lidge-jun marked this pull request as ready for review September 20, 2026 11:06
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 20, 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-09-20T11:10:24.260238Z c21865c 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.

@github-actions
github-actions Bot marked this pull request as draft September 20, 2026 11:07

@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: c21865ced0

ℹ️ 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".

config: Pick<OcxConfig, "claudeCode" | "port">,
opencodexConfigDir = getConfigDir(),
): DesktopFirstPartyTarget {
const proxyPort = claudeInterceptProxyPort(config, config.port ?? 10100);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Use the live intercept port for the settings target

When the server binds a different port from the persisted config.port—notably an ephemeral port: 0 or an automatic fallback because the configured port is occupied—the intercept runtime derives its listener from the actual bound public port, while this target writes HTTPS_PROXY from the stale persisted value (100 for port: 0). Apply and subsequent ensure/status inspection can therefore report first-party mode as current while every Claude Code request is sent to a dead port. Pass the live/bound proxy port into the first-party apply and inspection paths rather than deriving it solely from persisted configuration.

Useful? React with 👍 / 👎.

Comment thread src/cli/claude-desktop.ts
const appliedFingerprint = config.claudeCode?.desktopProfile?.appliedFingerprint ?? null;
const library = inspectDesktop3pConfigLibrary({ appliedFingerprint });
if (library.kind === "gateway_ours" || library.kind === "gateway_drifted") {
const removed = removeDesktop3pStandardPivot({ appliedFingerprint, replaceWhileEnabled: true });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the active mode until its replacement succeeds

When switching an existing gateway install to first-party mode, this removes the working gateway profile before applyDesktopFirstParty can reject a foreign/unreadable settings file or fail to write it, leaving the user with neither mode despite the command returning failure. The inverse path at applyDesktop similarly removes the first-party env before catalog discovery and gateway writing can fail, and the management routes repeat both orderings. Preflight the destination and retain or roll back the old mode until the replacement has committed.

AGENTS.md reference: src/AGENTS.md:L15-L17

Useful? React with 👍 / 👎.

} catch {
return { ok: false, reason: "ca_unavailable", path: target.caCertPath };
}
const written = applyClaudeInterceptSettings(target.env, options.claudeConfigDir);

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 Convert settings write exceptions into apply failures

If the settings directory becomes unwritable, the disk is full, or the atomic rename fails, applyClaudeInterceptSettings throws from its mkdir/write/rename operations rather than returning its declared failure union. This wrapper catches only CA creation, so native-toggle and ensure callers can reject the request/startup reconciliation instead of returning the established refusal result; removeDesktopFirstParty has the same problem. Catch filesystem exceptions around both settings mutations and map them to a bounded failure reason such as write_failed.

AGENTS.md reference: src/AGENTS.md:L15-L17

Useful? React with 👍 / 👎.

@lidge-jun

Copy link
Copy Markdown
Owner

Superseded by #5319, merged to dev as e3ac5bea0427cb759b08c7bf691ded6a2392c002, with attribution in the branch commit.

The chain was carried as a GitHub native stack, which stops accepting ordinary merges once its bottom lands by squash. Its tip already contained both ancestors and branched cleanly from dev, so the three parts were consolidated onto the current dev as one branch instead. Only the two test-layout registries conflicted, resolved as the union of both entry sets.

Closing as superseded rather than stale.

@lidge-jun lidge-jun closed this Sep 20, 2026
@lidge-jun
lidge-jun deleted the devin/1789891632-claude-desktop-first-party branch September 20, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant