Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: build the DERP map cache path for the requested platform, not the host (#6457)

[._.]/ Adam Eivyf813339f8811
diff --git a/server/services/tailcatPeer.js b/server/services/tailcatPeer.js
index 7685c94a3f..5ff98f07a6 100644
--- a/server/services/tailcatPeer.js
+++ b/server/services/tailcatPeer.js
@@ -16,7 +16,7 @@ import { randomUUID } from 'node:crypto';
import { createServer } from 'node:net';
import { stat } from 'node:fs/promises';
import { homedir } from 'node:os';
-import { delimiter, join } from 'node:path';
+import { delimiter, join, posix, win32 } from 'node:path';
import { spawn } from '../lib/childProcess.js';
import { commandExists } from '../lib/commandExists.js';
import { bufferedSpawn, spawnFailureDetail } from '../lib/bufferedSpawn.js';
@@ -376,10 +376,13 @@ export function derpMapCachePath({
home = homedir(),
platform = process.platform,
} = {}) {
- const base = platform === 'darwin' ? join(home, 'Library', 'Caches')
- : platform === 'win32' ? (env.LOCALAPPDATA || join(home, 'AppData', 'Local'))
- : (env.XDG_CACHE_HOME || join(home, '.cache'));
- return join(base, 'tailcat', `derpmap-${goQueryEscape(url)}.json`);
+ // Join for the REQUESTED platform, not the host: the caller names the platform,
+ // so a `darwin` path asked for from a Windows runner must still be POSIX.
+ const { join: joinFor } = platform === 'win32' ? win32 : posix;
+ const base = platform === 'darwin' ? joinFor(home, 'Library', 'Caches')
+ : platform === 'win32' ? (env.LOCALAPPDATA || joinFor(home, 'AppData', 'Local'))
+ : (env.XDG_CACHE_HOME || joinFor(home, '.cache'));
+ return joinFor(base, 'tailcat', `derpmap-${goQueryEscape(url)}.json`);
}
/**
diff --git a/server/services/tailcatPeer.test.js b/server/services/tailcatPeer.test.js
index 1f45244ce3..cced40f3e4 100644
--- a/server/services/tailcatPeer.test.js
+++ b/server/services/tailcatPeer.test.js
@@ -685,6 +685,10 @@ describe('tailcat startup diagnostics and DERP map priming', () => {
url: 'https://example.com/derpmap.json', platform: 'linux', home: '/example/home',
env: { XDG_CACHE_HOME: '/example/cache' },
})).toBe('/example/cache/tailcat/derpmap-https%3A%2F%2Fexample.com%2Fderpmap.json.json');
+ expect(derpMapCachePath({
+ url: 'https://example.com/derpmap.json', platform: 'win32', home: 'C:\\example\\home',
+ env: { LOCALAPPDATA: 'C:\\example\\cache' },
+ })).toBe('C:\\example\\cache\\tailcat\\derpmap-https%3A%2F%2Fexample.com%2Fderpmap.json.json');
});
it('primes the DERP map with PortOS own fetch, but never caches a non-map body', async () => {