Skip to content

fix(codex): exclude macOS Electron helpers from client diagnostics - #6296

Closed
hulkbig wants to merge 2 commits into
lidge-jun:devfrom
hulkbig:fix/macos-codex-client-classification-6291
Closed

hulkbig wants to merge 2 commits into
lidge-jun:devfrom
hulkbig:fix/macos-codex-client-classification-6291

Conversation

@hulkbig

@hulkbig hulkbig commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #6291.

  • Prefer the full executable path over an argv0 inferred from unquoted process text, so paths under Codex Framework.framework do not manufacture a Codex CLI match. Remove the snapshot fallback that could repeat that misclassification.
  • Read macOS native-profile probe comm and args separately and join them by PID; its previous combined columns also truncated executable paths containing spaces. Keep the Linux probe and the separate app-server termination selector unchanged.
  • Cover the exact reported crashpad command, renderer/utility-shaped helpers, routing-adoption enumeration, direct clients, quoted interpreter entrypoints, literal apostrophes, and failed macOS reads. Update the runtime contract and CLI diagnostic reference.

This is an AI-assisted change. Validation below is fixture-based on Linux; no native macOS end-to-end run is claimed.

Verification

Base: current dev at 6538001e2fdf54ef657f5057e8c3cbd3249d8e59.

  • Red/green reproduction: on unchanged source, the exact issue crashpad predicate returned true and both crashpad PIDs appeared in client enumeration. Four newly added classifier/enumeration checks failed before the fix; the separate macOS busy-probe fixture also failed before the column-parsing fix.
  • Repository-pinned Bun 1.4.0: bun test tests/codex-integration/native-profile-processes.test.ts tests/service/autostart-health.test.ts — 57 passed, 0 failed, 199 assertions.
  • bun test tests/codex-integration/codex-app-server-processes.test.ts — 59 passed, 1 Windows-only real-PowerShell test skipped, 0 failed; 250 assertions.
  • bun run typecheck — passed.
  • bun run privacy:scan — passed.
  • bun run structure:check — passed.
  • cd docs-site && bun install --frozen-lockfile && ASTRO_TELEMETRY_DISABLED=1 XDG_CONFIG_HOME=/tmp/opencodex-config bun run build — passed; 545 pages and 74,725 internal links checked. The initial build needed a writable Astro config directory in this container.
  • git diff --check — passed. Independent review found a literal-apostrophe parsing regression in the first patch; it was corrected and regression-tested, then the final diff received a separate static review with no blocking findings.
  • bun run test:changed — incomplete: the execution environment blocked a test-selected outbound SOCKS5 connection to api.commandcode.ai. It was not retried. The repository-wide suite was not run; this draft records the focused-test exception and leaves broader cross-platform CI outstanding.

Review follow-up at 0a5dc2d5d1e562b1ba96a1fbca73504c80f78b2c

  • Reproduced the review's basename-only browser_crashpad_handler case: its new fixture failed before this follow-up.
  • Reject only the initial split Codex.app/Contents/Frameworks/Codex + Framework.framework/ token pair. Preserve arbitrary command aliases, direct and interpreter-wrapped clients, and ordinary clients with later framework-path arguments. No process-termination selector changes.
  • bun test tests/codex-integration/native-profile-processes.test.ts tests/service/autostart-health.test.ts tests/codex-integration/codex-app-server-processes.test.ts — 118 passed, 1 Windows-only PowerShell test skipped, 0 failed; 457 assertions on Bun 1.4.0.
  • bun run typecheck, bun run privacy:scan, bun run structure:check, and git diff --check passed. Independent static review found no blocking issue in this follow-up. The docs-site content/build is unchanged from the verification above.
  • The two macOS process reads remain a best-effort, non-atomic observation. Native macOS validation and the broader-suite limitations above remain outstanding; this PR stays draft.

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 checklist

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

  • Required local validation passed; commands, results, and any full-suite exception are documented.

  • I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

@coderabbitai

coderabbitai Bot commented Sep 30, 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

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

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

github-actions Bot commented Sep 30, 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

  • ⬜ Required local validation passed; commands, results, and any full-suite exception are documented.
  • ⬜ I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
  • ⬜ 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.

@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 34 / 80

macOS에서 Codex.app의 Electron 도우미(crashpad, renderer, utility)가 ocx status / ocx doctor의 클라이언트 목록에 가짜로 잡히던 버그를 고치는 PR이에요. 원인부터 말할게요. Codex Framework 경로 안에 공백이 있어요. 예전에 args를 공백으로 잘라 argv0을 만들면, 앞부분이 .../Codex로 끊기고 basename이 codex가 돼요. 그래서 진짜 CLI가 아닌 도우미도 “재시작 대기 클라이언트”로 잡혀요. 이슈 #6291에서 한 앱 인스턴스가 가짜 클라이언트 15개까지 불었고, 오래된 crashpad가 경고를 오래 붙잡아 둔다고 했어요. 재시작으로 프로세스를 죽이는 경로는 원래 더 좁은 검사라 이번 범위가 아니에요.

이 PR은 세 가지를 바꿉니다. isCodexClientProcess가 실행 파일 전체 경로를 argv0 추측보다 우선해요. 경로가 있고 인터프리터가 아니면 바로 거절해서, Framework 도우미가 Codex로 둔갑하지 않게 해요. 스냅샷에서 argv0만 다시 넣어 재시도하던 우회도 빼요. macOS busy probe는 comm과 args를 따로 읽고 PID로 이어 붙여요. 예전에 한 줄에 같이 읽으면 공백 있는 실행 경로가 잘렸거든요. Linux probe와 app-server 종료 선택은 그대로예요. 이슈에 나온 crashpad 줄, 도우미, 인용된 인터프리터 진입점, 아포스트로피, macOS 읽기 실패까지 테스트로 막아 두었어요. docs와 structure/runtime.md도 맞춰 두었고, base는 dev예요. 같은 #6291 수정으로 열린 다른 open PR은 안 보여요.

아직 draft예요. Review readiness checklist도 0/4예요. 작성자도 macOS 실기기 E2E는 안 돌렸고, Linux fixture와 포커스 테스트만 적었어요. test:changed는 SOCKS5 때문에 중간에 멈췄다고 적혀 있어요.

src/codex/native-profile-processes.ts isCodexClientProcess - command에 /가 없을 때는 예전처럼 args를 공백으로 자를 수 있어요. 그때 Framework 전체 경로가 args에만 있으면 또 Codex argv0이 만들어질 수 있어요. 지금 macOS comm=이 전체 경로를 주면 막히지만, basename만 들어오는 경로가 있으면 구멍이 남아요.

src/codex/native-profile-processes.ts unixProcessCount (darwin) - ps를 두 번 불러 PID로 이어 붙여요. 두 호출 사이에 프로세스가 생기고 사라지면, 한쪽 목록에만 있는 PID는 빠지거나 어긋날 수 있어요. 실패 한 번은 unknown으로 떨어지는 테스트는 있어요.

tests/codex-integration/native-profile-processes.test.ts - 보고된 crashpad·인용·아포스트로피·probe 실패는 잘 덮어요. 다만 command가 basename만인 Framework 도우미 줄은 없어요.

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

draft 체크리스트와 macOS 실기기 확인 없이 CI만으로 합칠지 정해 주세요. 작성자가 밝힌 대로 파괴적 재시작 선택기는 안 바뀌어요. 진단 목록만 고치는 범위로 둘지, basename-only command까지 같은 PR에서 막을지도 선택이에요. types/config 분할이나 미리보기 배포 이슈는 이번 diff와 무관해요.

너의 추천

수정 방향은 맞고, #6291 원인과도 잘 맞아요. draft와 체크리스트를 닫고, 가능하면 macOS에서 crashpad가 목록에서 빠지는지만 한 번 확인한 뒤 합치세요. basename-only command + 공백 경로 args 케이스를 테스트에 하나 더 넣거나, 같은 조건에서도 Framework 도우미를 거절하게 다듬으면 더 안전해요. 지금 상태로는 Ready로 올리지 말고 draft로 두세요.

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

@lidge-jun

Copy link
Copy Markdown
Owner

Thanks @hulkbig. The classifier change and the separate comm/args probe fix #6291 cleanly. This branch doesn't allow maintainer edits, so I carried both commits unchanged onto current dev as #6393, with you as author and a Co-authored-by trailer on the squash. Once #6393 lands, a maintainer will close this one in its favor.

lidge-jun added a commit that referenced this pull request Oct 1, 2026
…arry #6296) (#6393)

fix(codex): exclude macOS Electron helpers from client diagnostics (carry #6296) (#6393)

On macOS the client classifier split unquoted ps args at the first space, so
Codex.app's "Codex Framework.framework" helpers (crashpad, renderer, utility)
produced an argv0 named Codex and were listed as pending-restart Codex clients.
A full executable path now beats an argv0 guessed from args, the basename-only
split framework pair is rejected, and the macOS busy probe reads comm and args
separately and joins them by PID. Closes #6291.

Carried from #6296.

Co-authored-by: Hulk <[email protected]>
@lidge-jun

Copy link
Copy Markdown
Owner

Landed on dev through the maintainer carry #6393 (0202cc6), which keeps your authorship with a Co-authored-by trailer. Thank you!

@lidge-jun lidge-jun closed this Oct 1, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants