From 8a3c96dc7c645f7303da2436513484a629a454ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Guti=C3=A9rrez?= <35082514+alezmad@users.noreply.github.com> Date: Wed, 8 Apr 2026 15:28:50 +0100 Subject: [PATCH] fix(runner): prefer package-matching binary over utility bins Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/runner/supervisor.mjs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/runner/supervisor.mjs b/apps/runner/supervisor.mjs index beb89eb..6586355 100644 --- a/apps/runner/supervisor.mjs +++ b/apps/runner/supervisor.mjs @@ -264,9 +264,13 @@ const server = createServer(async (req, res) => { if (npxPackage) { const binDir = join(svcSourcePath, "node_modules", ".bin"); if (existsSync(binDir)) { - const bins = readdirSync(binDir); - if (bins.length > 0) { - svc._npxBin = join(binDir, bins[0]); + const bins = readdirSync(binDir).filter(b => !["node-which", "which", "semver", "resolve"].includes(b)); + // Prefer binary matching the package name + const pkgShort = npxPackage.split("/").pop().replace(/^@/, ""); + const match = bins.find(b => b === pkgShort || b.includes(pkgShort)) || bins[0]; + if (match) { + svc._npxBin = join(binDir, match); + console.log(`[runner] npx binary resolved: ${match}`); } } }