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: fail closed instead of throwing when the probe scratch dir can't be created

[._.]/ Adam Eivy54b07a68154f
diff --git a/server/lib/commandExists.js b/server/lib/commandExists.js
index 7b4fe83caf..671d04f6aa 100644
--- a/server/lib/commandExists.js
+++ b/server/lib/commandExists.js
@@ -45,7 +45,16 @@ const execFileAsync = promisify(execFile);
* the three temp-dir keys are overridden on top.
*/
function probe(cmd, args, { timeoutMs, env, cwd, maxBuffer }) {
- const scratchDir = mkdtempSync(join(tmpdir(), 'portos-cli-probe-'));
+ let scratchDir;
+ try {
+ scratchDir = mkdtempSync(join(tmpdir(), 'portos-cli-probe-'));
+ } catch {
+ // Could not even allocate the scratch dir (a full disk, an unwritable
+ // tmpdir) — fail closed the same as every other probe failure, rather
+ // than throwing synchronously out of what every caller treats as a
+ // promise that always resolves (never rejects).
+ return Promise.resolve(null);
+ }
const probeEnv = { ...(env || process.env), TMPDIR: scratchDir, TMP: scratchDir, TEMP: scratchDir };
const options = {
timeout: timeoutMs,