Skip to content

fix(service): carry stable launchd launcher ownership (#3554) - #3616

Merged
lidge-jun merged 2 commits into
devfrom
codex/260905-residual-launchd
Sep 5, 2026
Merged

fix(service): carry stable launchd launcher ownership (#3554)#3616
lidge-jun merged 2 commits into
devfrom
codex/260905-residual-launchd

Conversation

@lidge-jun

Copy link
Copy Markdown
Owner

Summary

Carries the unique #3554 layer: launchd install/state/status agree on one recorded stable launcher, preserving file-backed token handling and proof-bound overrides. This repairs which version starts next, not an already-running old proxy.

Refs #3464; the issue remains open for the running-process mismatch portion. No live launchctl round-trip is claimed.

Stack (merge bottom-up): IPv6 → launchd → Codex toggle → canonical discovery. This layer targets codex/260905-residual-ipv6; retarget after its parent lands. These are child-only carries, not wholesale copies of the old parents.

Verification

  • Astra worker root typecheck passed for each layer; toggle app/node typechecks also passed.
  • Child-only path comparison, linear ancestry and diff whitespace checks passed. Original screenshot blob retained.
  • No local tests executed. Final dev Linux CI is the user-authorized batch gate.

Checklist

  • Layer is scoped to its source change.
  • Existing source documentation and attribution retained.
  • Relevant auth, proxy and token boundaries inspected; no live host mutation.

jun added 2 commits September 5, 2026 12:54
Carry only the final source/docs/test delta of #3551 (fd1dbbe..37622b9) onto corrected parent #3608. Exclude campaign ledgers.
Carry only #3554 final child delta (37622b9..1314498), retaining the IPv6 layer and corrected parent #3608. No campaign ledger changes.
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner September 5, 2026 04:00
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • ^dev$
  • ^preview$

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: 3a3f92c8-a3bc-4201-ad89-df89a273136c

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 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-05T04:05:01.083737Z 59a1108 PR opened
ℹ️ 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.

Base automatically changed from codex/260905-residual-ipv6 to dev September 5, 2026 04:01
@lidge-jun
lidge-jun changed the base branch from codex/260905-residual-ipv6 to dev September 5, 2026 04:01
@lidge-jun
lidge-jun merged commit 4e2246c into dev Sep 5, 2026
9 of 10 checks passed
@lidge-jun
lidge-jun deleted the codex/260905-residual-launchd branch September 5, 2026 04:01
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@lidge-jun

Copy link
Copy Markdown
Owner Author

리뷰 · 우선순위 72 / 80

이 PR은 mise/asdf 같은 버전 관리자로 ocx를 올린 뒤에도 macOS launchd가 예전 패키지 경로의 Bun+CLI를 계속 실행하던 문제를 고칩니다. 이슈 #3464의 “다음에 뜨는 버전” 쪽입니다. 이미 떠 있는 옛 프록시 프로세스까지 자동으로 갈아끼우지는 않고, install/state/status가 같은 안정 런처 경로를 보도록 맞춥니다.

지금 dev HEAD 4734c78f4src/service.ts를 보면 Linux systemd·Windows 쪽에는 이미 launcherPath / stableLauncherEntry 이야기가 있습니다. 그런데 macOS buildPlist()는 여전히 패키지 로컬 Bun+CLI만 굽고, start/status의 stale 판정도 그 페어를 다시 만듭니다. 그래서 런처 모드로 설치한 뒤에도 “OLDER plist”로 잘못 보이거나, 업그레이드 후 다음 기동이 옛 디렉터리를 붙잡는 구멍이 남습니다. 이 PR은 buildPlist에 런처를 넣고, expectedLaunchdCommand기록된 install state를 기준으로 기대 exec를 만들며, installLaunchd에서 런처를 한 번만 고른 뒤 plist와 state에 같은 값을 씁니다.

다만 GitHub base는 dev인데, 브랜치 조상에는 IPv6 층(7800a744b, Mihomo fdfe:dcba:9876::/48 + effectiveProxyFor)이 먼저 붙어 있습니다. 본문이 말한 “IPv6 → launchd” 스택의 launchd 층과, 아직 단독 PR이 없는 IPv6 residual이 같이 dev 대비 diff에 들어옵니다. #3551/#3462 계열과 겹치니, 머지 전에 이 PR이 IPv6까지 같이 싣는 단위인지를 분명히 하는 게 좋습니다. 원 이슈 #3464는 계속 열어 두고, 실행 중 옛 프로세스 불일치는 남긴다고 본문에 적혀 있습니다.

테스트는 tests/service/service.test.ts에 launchd 기대 커맨드·런처 경로 정렬을 보강합니다. auth/토큰 파일 경로는 건드리지 않고, proof-bound override만 런처 모드에서 남깁니다. 로컬 스위트는 안 돌렸고 Linux CI를 게이트로 둔다고 했습니다.

src/service.ts - buildPlist가 런처가 있으면 Bun runtime env를 빼고, override source일 때만 proof-bound env를 남깁니다. 레거시 페어 기본값은 테스트 격리용입니다.

src/service.ts - expectedLaunchdCommand가 PATH를 다시 걷지 않고 state의 launcherPath를 따릅니다. start/status가 같은 기대를 보지 않으면 건강한 런처 잡이 stale로 보입니다.

src/service.ts - installLaunchd에서 stableLauncherEntry()를 한 번만 호출해 plist와 writeServiceInstallState에 동일 값을 넣습니다. 발견과 기록이 어긋나면 #3464가 다시 납니다.

src/lib/destination-policy.ts / src/lib/proxy-env.ts - 같은 PR diff에 Mihomo IPv6 fake-IP 예외와 scheme-matched effectiveProxyFor가 포함됩니다. launchd와 무관한 층이므로 리뷰·머지 단위를 분리할지 결정이 필요합니다.

라인 없음 - base가 dev로 열려 있어 본문의 “ipv6 브랜치 타깃 후 retarget” 안내와 UI가 어긋납니다. IPv6 단독 PR 없이 이 브랜치를 dev에 넣으면 두 층이 한 번에 들어갑니다.

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

  • #3616을 IPv6+launchd 동시 랜딩 단위로 받을지, IPv6 residual을 먼저 쪼갤지
  • #3464를 launchd 기록 정렬만으로 부분 close할지, 실행 중 프로세스 불일치까지 남을 때까지 open 유지할지
  • #3551과의 중복/대체 관계 (같은 Mihomo IPv6 주제)

너의 추천
IPv6 층을 이 PR에 포함해 받을 계획이면, 본문에 그 사실을 한 줄 적고 Linux destination-policy/outbound 테스트와 service 테스트를 확인한 뒤 dev에 머지하세요. IPv6를 따로 두고 싶다면 base를 고치거나 브랜치를 쪼갠 뒤 launchd 커밋만 올리세요. #3464는 실행 중 옛 프록시 이슈가 남으니 바로 닫지 마세요.

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

@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: 59a1108055

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

Comment thread src/service.ts
Comment on lines +606 to +607
const state = deps.state === undefined ? readServiceInstallState() : deps.state;
if (state?.launcherPath) return buildServiceLauncherShellCommand(state.launcherPath, port);

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 Derive the launchd comparison from the current plist

When installation is interrupted or writeServiceInstallState() throws after launchctl load succeeds, installLaunchd() leaves both the live job and on-disk plist using the new launcher while the previous state still names an old launcher or none. expectedLaunchdCommand() then constructs a different command from that stale state, so the common already-loaded path in ocx service start reports an “OLDER plist” and refuses the benign start even though the live job matches the file; detailed status can make the same false claim. Parse the expected command from the current plist, or make the definition/state update atomic with rollback.

Useful? React with 👍 / 👎.

@github-actions github-actions Bot added the bug Something isn't working label Sep 5, 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.

1 participant