Skip to content

Report client exceptions PostHog can process; never report an already-running daemon as a crash - #307

Merged
Chrrxs merged 1 commit into
mainfrom
fix/client-error-reporting-2026-10-07
Oct 7, 2026
Merged

Chrrxs merged 1 commit into
mainfrom
fix/client-error-reporting-2026-10-07

Conversation

@Chrrxs

@Chrrxs Chrrxs commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Two client error-reporting defects found while reviewing PostHog errors (2026-10-03..07):

  1. Exceptions with a nameless stack frame never reached Error Tracking. parseStackFrames left function undefined for frames like at file:line:col; PostHog's error-tracking processor rejects such an event ($cymbal_errors: "missing field \function`") and it gets no issue. 31 client exceptions in 30 days were invisible this way, including today's HTTP 409: dead-lettering batchobservation-upload errors. Such frames are now named?`, as PostHog's own stack parser names them.
  2. Starting a daemon that already runs was reported as a fatal crash, twice. The detached child threw a plain Error on already_running, and both it and its parent reported a fatal daemon_startup crash (42 events in 15 minutes when several MCP shims started a daemon at once). It is now DaemonAlreadyRunningError: the child tells its parent over the startup handshake (already-running), says so plainly and exits non-zero without a report; the background launcher prints the running PID and exits 0. Any other startup failure is still reported as a fatal crash.

Verification

  • New tests fail on main and pass here: apps/observer/tests/error-reporting/sanitize.test.ts, apps/observer/tests/recovery-healing.test.ts ("starting a daemon that already runs").
  • pnpm lint, pnpm typecheck, check:boundaries, check:secrets pass locally (Node 22).
  • pnpm test: all pass except tests that need a local Deno (read-only-broker, local-executor-native-workflow) and user-service-manager "enables an active matching service that was left disabled at login", which fails the same way on clean main in this environment.

Migrations & Breaking Changes

  • Protocol: the daemon's private parent/child startup handshake gains an already-running message; both ends ship in the same entry file.
  • No schema, cloud contract or public API change. Rollback is a plain revert.

Privacy

Frames carry the same sanitized fields as before; only the placeholder name ? is added. Nothing new is reported; one fatal report is removed.

…-running daemon as a crash

- Error reporting named no function for a frame without one (`at file:line:col`),
  and PostHog's error tracking drops an exception any of whose frames lacks
  `function` ("missing field `function`"): 31 client exceptions in 30 days never
  reached Error Tracking, among them observation-batch dead-letter errors. Such
  a frame is now named `?`, as PostHog's own stack parser names it.
- Starting a daemon while one already holds the lock threw a plain Error that
  both the detached child and its parent reported as a fatal daemon_startup
  crash (42 events in 15 minutes when several MCP shims started a daemon at
  once). It is now DaemonAlreadyRunningError: the child tells the parent over the
  startup handshake (`already-running`), says so plainly and exits non-zero
  without a report; the background launcher prints the running PID and exits 0,
  since a daemon serving the home is what was asked for. Any other startup
  failure is still reported as a fatal crash.
@Chrrxs
Chrrxs merged commit fb700b5 into main Oct 7, 2026
12 checks passed
@Chrrxs
Chrrxs deleted the fix/client-error-reporting-2026-10-07 branch October 7, 2026 17:05
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.

1 participant