Skip to content

fix(cli): explain SIGABRT serve exits instead of naming the signal - #10464

Merged
brennanb2025 merged 3 commits into
mainfrom
brennanb2025/serve-sigabrt-diagnostics
Jul 25, 2026
Merged

brennanb2025 merged 3 commits into
mainfrom
brennanb2025/serve-sigabrt-diagnostics

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #10461.

Problem

When orca serve died from a signal, the CLI reported only:

Orca serve exited via SIGABRT

No cause, no next step, no pointer to where a crash report lives.

This is not cosmetic. In #9282 it was the only signal a user had, and it sent a P0 investigation down the wrong path — a suspected code-signature / ASAR corruption defect, including a PR that was written and then closed — for what turned out to be an environmental failure. The information needed to diagnose it correctly was on the machine the whole time: macOS had written ~/Library/Logs/DiagnosticReports/Orca-*.ips naming the crashing frame, and Electron had printed task_name_for_pid: (os/kern) failure (5) to stderr. Neither surfaced through our CLI.

The actual crash was an abort during macOS application registration, before any of our JS runs:

abort → ___RegisterApplication_block_invoke → _RegisterApplication → GetCurrentProcess
→ _NSInitializeAppContext → -[NSApplication init] → +[NSApplication sharedApplication] → ElectronMain

Because there's no JS on the stack, this can't be caught in-process — the parent CLI is the only place it can be explained.

Fix

Extracts a pure serveSignalExitError(signal, platform) builder and swaps the bare throw in superviseForegroundServe for it:

  • darwin + SIGABRT — offers the window-server registration failure as the likely cause along with the environments it shows up in (restricted/sandboxed, SSH without a GUI login, CI), and routes a remedy plus the ~/Library/Logs/DiagnosticReports/Orca-*.ips pointer through RuntimeClientError's existing data.nextSteps channel, which format.ts already renders in both human and --json output. The parent only ever observes the signal, never the phase, so the cause is offered as likely rather than asserted.
  • Other platforms/signals — a plain exited via <SIGNAL>. with no invented cause.
  • Neither code nor signal — its own clear line instead of rendering exited via null.

Verbatim human output on darwin + SIGABRT:

Orca serve aborted with SIGABRT on macOS. This most often happens at application startup, when the process cannot register with the macOS window server, which is common in restricted or sandboxed environments, SSH sessions without a GUI login, and CI.
Next step: Re-run `orca serve` outside a sandboxed or restricted environment, with a macOS desktop login active.
Next step: Look for a crash report at ~/Library/Logs/DiagnosticReports/Orca-*.ips.

The remedy deliberately does not tell users to stop serving over SSH — SSH serve is supported; what it needs is an active macOS desktop login for the window-server connection.

Scope

Tier 1 from the issue only. Deliberately excluded:

  • Tier 2 stderr ring-buffer parsing — launch.ts spawns with stdio: 'inherit', so the parent can't observe child stderr without rewiring the pass-through path. Deferred until this recurs.
  • crashReporter.start() — Orca collects no crash data of its own today. That's the systemic version of this problem and needs its own issue (consent, privacy, an endpoint).

Test plan

  • New test file covering the pure builder (darwin SIGABRT explains; off-darwin — linux and win32 — doesn't claim the macOS cause; other darwin signals don't either; null signal stays clear) and superviseForegroundServe end-to-end (darwin SIGABRT throws the diagnostic, linux SIGABRT doesn't, numeric exits 0/7 return unchanged).
  • vitest src/cli/runtime → 63 passed across 9 files.
  • vitest src/cli → 511 passed across 39 files.
  • typecheck:cli + typecheck:node clean; oxlint clean on touched files; max-lines ratchet OK.

…10461)

`orca serve` reported only "Orca serve exited via SIGABRT", which sent a P0
investigation down a code-signature path while a diagnostic crash report sat
unread on disk. On darwin + SIGABRT the signal-exit path now names the macOS
application-startup abort, its usual sandbox/SSH/CI causes, and points at
~/Library/Logs/DiagnosticReports/Orca-*.ips via the existing nextSteps channel.
Other platforms and signals get a clear message with no invented cause.
@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds serveSignalExitError with generic and macOS SIGABRT diagnostics, including crash-report guidance. Foreground serve supervision now uses this helper for signal exits. New tests cover direct diagnostics, platform and signal variations, missing exit information, supervised exits, and unchanged numeric exit codes.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description explains the fix but does not follow the required template or include the screenshots, testing checklist, AI review, security audit, and notes sections. Rewrite it using the repository template: Summary, Screenshots, Testing checklist, AI Review Report, Security Audit, and Notes.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes implement the #10461 macOS SIGABRT diagnostic, preserve non-macOS and numeric-exit behavior, and add regression tests.
Out of Scope Changes check ✅ Passed The PR stays focused on signal-exit diagnostics and associated tests with no unrelated code changes.
Title check ✅ Passed The title is concise and accurately summarizes the main change: improving SIGABRT serve-exit diagnostics.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Implemented via Orca orchestration (task task_9f6a5960a900, dispatch ctx_204605815a12). Independently verified before opening: format.ts:85-87 confirmed to render data.nextSteps generically for any RuntimeClientError in both human and --json output, and the 51 tests were re-run outside the implementing session.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 28fcdec7-2825-4ff2-8195-c361f101c4e6

📥 Commits

Reviewing files that changed from the base of the PR and between d5340fd and 85ec26b.

📒 Files selected for processing (3)
  • src/cli/runtime/serve-signal-exit-diagnostic.test.ts
  • src/cli/runtime/serve-signal-exit-diagnostic.ts
  • src/cli/runtime/serve-update-supervisor.ts

Comment on lines +18 to +20
// Why: the startup abort happens inside +[NSApplication sharedApplication], before any of our JS
// runs, so the parent CLI is the only place it can be explained. We only see the signal, never the
// phase, so the cause is offered as the likely one rather than asserted.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Keep this rationale to one concise sentence.

The three-line implementation narrative exceeds the comment guideline; retain only the non-obvious limitation, such as that SIGABRT alone cannot establish the failure phase. As per coding guidelines, comments must be concise, limited to non-obvious information, and preferably one line.

Source: Coding guidelines

@brennanb2025
brennanb2025 merged commit 9ae8f34 into main Jul 25, 2026
6 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#10464)

* fix(cli): explain SIGABRT serve exits instead of naming the signal (stablyai#10461)

`orca serve` reported only "Orca serve exited via SIGABRT", which sent a P0
investigation down a code-signature path while a diagnostic crash report sat
unread on disk. On darwin + SIGABRT the signal-exit path now names the macOS
application-startup abort, its usual sandbox/SSH/CI causes, and points at
~/Library/Logs/DiagnosticReports/Orca-*.ips via the existing nextSteps channel.
Other platforms and signals get a clear message with no invented cause.

* fix(cli): stop asserting the SIGABRT exit happened at startup

* fix(cli): stop steering macOS SIGABRT users away from SSH serve
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.

orca serve reports a bare "exited via SIGABRT" with no cause or crash-report pointer

1 participant