Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/code/src/main/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import dns from "node:dns";
import { mkdirSync } from "node:fs";
import net from "node:net";
import os from "node:os";
import path from "node:path";
import { app, crashReporter, protocol } from "electron";
Expand Down Expand Up @@ -63,6 +64,11 @@ crashReporter.start({ uploadToServer: false });
// instead of ::1. This matches how the renderer already reaches the PostHog API.
dns.setDefaultResultOrder("ipv4first");

// Disable "Happy Eyeballs": PostHog's many-address ELB times out the connect
// when IPv6 is unreachable (e.g. Tailscale), as family racing abandons each
// IPv4 attempt before it completes. ipv4first alone isn't enough.
net.setDefaultAutoSelectFamily(false);

// Call fixPath early to ensure PATH is correct for any child processes
fixPath();

Expand Down
8 changes: 8 additions & 0 deletions packages/workspace-server/src/serve.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import "reflect-metadata";
import dns from "node:dns";
import net from "node:net";
import { serve } from "@hono/node-server";
import { createApp } from "./app";

// Prefer IPv4 and disable "Happy Eyeballs" (mirrors apps/code main bootstrap).
// This child makes all outbound HTTPS to PostHog/the gateway; its many-address
// ELB times out when IPv6 is unreachable (e.g. Tailscale).
dns.setDefaultResultOrder("ipv4first");
net.setDefaultAutoSelectFamily(false);

const SHUTDOWN_GRACE_MS = 3_000;
const WATCHDOG_INTERVAL_MS = 2_000;

Expand Down
Loading