fix(desktop): surface Tailscale Serve setup failures with admin link #4552
ClosedGenKerensky(GitHub profile, opens in a new tab)wants to merge 4 commits into
main fromrefs/pull/4552/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/desktop/src/backend/DesktopServerExposure.ts line 568Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -493,2 +523,21 @@493523 ...(input.port === undefined ? {} : { port: input.port }),494524 });525+526+ // Preflight Serve configuration before persisting so Enable can fail loudly527+ // with the same CLI guidance (including the admin setup URL) instead of a528+ // silent restart that leaves the toggle unchecked.529+ if (input.enabled) {530+ const current = yield* Ref.get(stateRef);531+ const servePort = input.port ?? current.tailscaleServePort;532+ const localPort = current.port;533+ if (localPort <= 0) {534+ return yield* new DesktopTailscaleServeConfigureError({535+ enabled: true,536+ port: servePort,537+ localPort,538+ reason: "Local backend is not ready yet. Try again in a moment.",539+ configureUrl: null,540+ });541+ }542+543+ yield* ensureTailscaleServe({
- apps/desktop/src/backend/DesktopServerExposure.ts lines 247 to 282Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -239,3 +243,17 @@239243 }240244 }241245246+export class DesktopTailscaleServeConfigureError extends Schema.TaggedErrorClass<DesktopTailscaleServeConfigureError>()(247+ "DesktopTailscaleServeConfigureError",248+ {249+ enabled: Schema.Boolean,250+ port: Schema.NullOr(Schema.Number),251+ localPort: Schema.Number,252+ reason: Schema.String,253+ configureUrl: Schema.NullOr(Schema.String),254+ },255+) {256+ override get message(): string {257+ return this.reason;258+ }259+}
- apps/desktop/src/backend/DesktopServerExposure.ts lines 247 to 282Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -239,3 +243,17 @@239243 }240244 }241245246+export class DesktopTailscaleServeConfigureError extends Schema.TaggedErrorClass<DesktopTailscaleServeConfigureError>()(247+ "DesktopTailscaleServeConfigureError",248+ {249+ enabled: Schema.Boolean,250+ port: Schema.NullOr(Schema.Number),251+ localPort: Schema.Number,252+ reason: Schema.String,253+ configureUrl: Schema.NullOr(Schema.String),254+ },255+) {256+ override get message(): string {257+ return this.reason;258+ }259+}
- @@ -495 +574,21 @@574+ Effect.mapError((cause) => {575+ // Lift only safe structural diagnostics from the CLI error; keep the576+ // full TailscaleCommandError as cause for the error chain/stack.577+ const exitDetail =578+ cause._tag === "TailscaleCommandExitError" ? cause.detail : undefined;579+ const configureUrl =580+ cause._tag === "TailscaleCommandExitError" ? (cause.configureUrl ?? null) : null;581+ return new DesktopTailscaleServeConfigureError({582+ enabled: true,583+ port: servePort,584+ localPort,585+ ...(exitDetail === undefined ? {} : { detail: exitDetail }),586+ configureUrl,587+ cause,588+ });589+ }),590+ );591+ preflightedServePort = servePort;592+ }593+495594 const result = yield* desktopSettings
GenKerensky(GitHub profile, opens in a new tab) closed this
- @@ -0,0 +3,21 @@3+ readonly args: string[];4+}5+6+/**7+ * Resolve Electron relaunch options for the current packaging mode.8+ *9+ * AppImage mounts the payload under a temporary directory and sets `APPIMAGE`10+ * to the outer `.AppImage` path. `process.execPath` / `process.argv` point at11+ * the mount, which is unmounted when the process exits — so relaunching with12+ * those paths exits and never comes back. Prefer `$APPIMAGE` with empty args.13+ */14+export function resolveDesktopRelaunchOptions(input: {15+ readonly appImagePath?: string | null | undefined;16+ readonly execPath: string;17+ readonly argv: readonly string[];18+}): DesktopRelaunchOptions {19+ const appImagePath = input.appImagePath?.trim();20+ if (appImagePath) {21+ return {22+ execPath: appImagePath,23+ args: [],
Sign in to join this conversation.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
1a257345-0db8-431f-be14-35b9b825b7d1You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
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