Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

Evals static_analysis grader: Bun `$` interpolates the whole command as one argv token, so no command ever runs and every check scores 1.0 / passed

Open Bowlerjim opened this issue 2 months ago • 2 comments

Observed on 7.54.0.

What

StaticAnalysis.ts runs each configured analysis command through Bun's shell:

// skills/Evals/Graders/CodeBased/StaticAnalysis.ts:29
const result = await $`cd ${workingDir} && ${command}`.quiet().nothrow();

Bun's $ escapes each interpolation into a single argv token, so a command string like bun --version is executed as one program literally named bun --version. The shell answers command not found. That string contains neither error nor failed, so countIssues() returns 0 errors, and result.exitCode is never consulted:

const passed = errors === 0 && (!params.fail_on_warning || warnings === 0);

Every static_analysis grader therefore scores 1.0 and reports passed: true, whatever the command was.

Repro

import { $ } from "bun";
const command = "bun --version";
const r = await $`cd ${process.cwd()} && ${command}`.quiet().nothrow();
console.log(JSON.stringify({ exit: r.exitCode, err: r.stderr.toString() }));
{"exit":1,"out":"","err":"bun: command not found: bun --version\n"}

Driving the grader itself with commands: ['echo hello && exit 1', 'bun --version']:

"score": 1, "passed": true, "reasoning": "2/2 checks passed (0 errors, 0 warnings)",
"results": [{"command":"echo hello && exit 1","passed":true,"output":"bun: command not found: echo hello && exit 1\n","errors":0}]

Expected

The command runs, and a non-zero exit (or real lint errors) fails the grader.

Why it matters

This fails in the worst possible direction for an eval framework: a lint or typecheck suite that cannot go red. A regression suite built on static_analysis reports green forever.

Fix sketch

Run through a shell and gate on the exit code:

const proc = Bun.spawn(["/bin/sh", "-c", command], { cwd: workingDir, stdout: "pipe", stderr: "pipe" });
// ...
const passed = (await proc.exited) === 0 && errors === 0 && (!params.fail_on_warning || warnings === 0);

i.e. stop inferring failure from keyword-counting stdout when the exit code is right there.

Bowlerjim avatar Sep 21 '26 03:09 Bowlerjim

This is Shiva, Eugene's AI Assistant, reporting on Eugene's behalf.

Confirmed and fixed. Bun's $ was interpolating multi-word commands as one argv token, and the exit code was never checked, so the grader scored 1.0/passed unconditionally. Switched to Bun.spawn with real argv arrays and exit-code gating.

Environment: ThinkPad, Ubuntu 24.04.4 LTS, Ryzen AI 9 HX PRO 370, Bun 1.3.11.

waveman2020-sudo avatar Sep 23 '26 19:09 waveman2020-sudo

Thanks @Bowlerjim, and you're right that this grader could never go red. The whole v1 grader layer, StaticAnalysis.ts included, was removed when the eval skill was rebuilt on 2026-08-25, and the skill is now called Assay. That grader no longer exists, so there's nothing left to patch. The next release takes it out of the public tree.

danielmiessler avatar Oct 03 '26 04:10 danielmiessler