Skip to content

Fix macOS daemon DNS resolver reuse - #2835

Merged
nwparker merged 2 commits into
stablyai:mainfrom
nwparker:nwparker/https-github.com-stablyai-orca-issues-2797
May 26, 2026
Merged

nwparker merged 2 commits into
stablyai:mainfrom
nwparker:nwparker/https-github.com-stablyai-orca-issues-2797

Conversation

@nwparker

@nwparker nwparker commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #2797.

Detects when an existing macOS terminal daemon has lost access to the system resolver namespace and replaces it instead of reusing it. The health check runs inside the daemon process so Orca checks the same resolver context that daemon-spawned PTYs inherit.

The follow-up review also covered the live-session case: fresh daemon-backed PTY spawns now perform the resolver-health gate before creating the new session, so a daemon that degrades while Orca remains open is replaced before it can spawn another broken terminal. Attach-style spawns are not health-gated, so existing session reattach/restore paths do not replace the daemon out from under a still-live PTY.

Screenshots

No visual change.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

Ran:

  • pnpm vitest run --config config/vitest.config.ts src/main/daemon/daemon-pty-adapter.test.ts src/main/ipc/pty.test.ts src/main/network/macos-system-resolver-health.test.ts src/main/daemon/daemon-health.test.ts src/main/daemon/daemon-init.test.ts src/main/daemon/daemon-server.test.ts
  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • git diff --check
  • Manual macOS E2E: launched a daemon under the bad bootstrap namespace, confirmed it reported systemResolverHealth: unhealthy, launched the fixed app, confirmed it replaced the bad daemon, then confirmed the replacement daemon reported healthy and a daemon-spawned PTY resolved/pinged google.com successfully.
  • GitHub verify check passed on this PR branch.

AI Review Report

Ran a review-until-clean pass. The review found one correctness issue: the first version only replaced bad daemons at app startup, so a daemon that lost resolver access while Orca stayed open could still create broken new PTYs. Fixed by marking fresh daemon-backed session spawns and having DaemonPtyAdapter check daemon-reported resolver health before creating those new sessions. The review rechecked daemon startup/reuse, live spawn behavior, attach/restore behavior, router behavior, concurrency, macOS/Linux/Windows compatibility, and SSH/remote boundaries.

Security Audit

The new IPC request remains behind the existing daemon socket token handshake. The macOS resolver probe executes a fixed system binary (/usr/sbin/scutil) with fixed args, no user-controlled command string, ignored stdin, and a timeout. Failed, missing, or inconclusive health checks fail open as unknown instead of killing a daemon unexpectedly. The live-spawn gate only runs for local daemon-backed fresh sessions; SSH providers and attach-style session restores are not routed through it.

Notes

Bumps the daemon protocol from v8 to v9 so new app launches do not reuse daemons that cannot report their own macOS resolver health. v8 remains listed as a previous daemon protocol for legacy session compatibility.

@nwparker
nwparker merged commit 016b574 into stablyai:main May 26, 2026
1 check passed
nwparker added a commit that referenced this pull request May 31, 2026
* fix: address pr-bug-scan validated finding from #2835

* test: cover async macOS resolver health check

---------

Co-authored-by: orca-bug-scan-bot <[email protected]>
Co-authored-by: Neil <[email protected]>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix: address pr-bug-scan validated finding from stablyai#2835

* test: cover async macOS resolver health check

---------

Co-authored-by: orca-bug-scan-bot <[email protected]>
Co-authored-by: Neil <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PTY terminals spawn outside gui/$UID launchd domain — system DNS resolution fails

1 participant