Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix(uploader): run toolchain probes at the lowest CPU priority

ogsamratf311a1f5ace5
diff --git a/apps/server/src/toolchain.ts b/apps/server/src/toolchain.ts
index cbc223b8..6cd0eafb 100644
--- a/apps/server/src/toolchain.ts
+++ b/apps/server/src/toolchain.ts
@@ -14,6 +14,7 @@
import { spawn } from "node:child_process";
import { existsSync, readdirSync, statSync } from "node:fs";
import { readdir, stat } from "node:fs/promises";
+import { constants as osConstants, setPriority } from "node:os";
import nodePath from "node:path";
import { cltSkipReason, resolveCommand } from "./command-guard.js";
@@ -196,6 +197,14 @@ export const runCommand: RunCommand = (file, args, { cwd, timeoutMs, maxBytes })
resolvePromise(null);
return;
}
+ // Probes run in the background: never at the expense of the agent's own work.
+ if (child.pid) {
+ try {
+ setPriority(child.pid, osConstants.priority.PRIORITY_LOW);
+ } catch {
+ // Not permitted here; it runs at normal priority.
+ }
+ }
const out: Buffer[] = [];
const err: Buffer[] = [];
let outBytes = 0;