Skip to content

fix(Evals): run static_analysis commands through a shell and gate on exit code (#2184) - #2194

Open
Bowlerjim wants to merge 1 commit into
danielmiessler:mainfrom
Bowlerjim:fix/2184-static-analysis-runs-commands
Open

Bowlerjim wants to merge 1 commit into
danielmiessler:mainfrom
Bowlerjim:fix/2184-static-analysis-runs-commands

Conversation

@Bowlerjim

Copy link
Copy Markdown

Fixes #2184.

await $\cd ${workingDir} && ${command}`escapes the interpolation into a single argv token, sobun --versionran as one program of that literal name. The shell answeredcommand not found, which contains no error/failedkeyword, socountIssues()returned 0 andpassed = errors === 0was true.result.exitCodewas never consulted, so everystatic_analysis` grader scored 1.0 regardless of what it was asked to run.

This spawns /bin/sh -c <command> (cmd /c on win32) and fails on a non-zero exit as well as on counted errors, so a tool that reports only through its exit status (tsc, most test runners) is graded correctly.

Verified by driving the grader directly:

commands before after
bun --version 1/1 passed (never ran) 1/1 passed (ran)
echo hello && exit 1 1/1 passed 0/1 passed
echo all good 1/1 passed 1/1 passed

🤖 Generated with Claude Code

https://claude.ai/code/session_01PuS77R8a6Lhp7jK6dnwdTh

…exit code (danielmiessler#2184)

`await $`cd ${workingDir} && ${command}`` escapes the interpolation into a
single argv token, so a command like `bun --version` was executed as one
program of that literal name. The shell answered `command not found`, which
contains no `error`/`failed` keyword, so countIssues() returned 0 and
`passed = errors === 0` was true. Every static_analysis grader scored 1.0
regardless of what it was asked to run — a lint or typecheck suite that
could not go red.

Spawn `/bin/sh -c <command>` (`cmd /c` on win32) and fail on a non-zero
exit as well as on counted errors, so a tool that reports only through its
exit status is graded correctly.

Verified: commands `bun --version` -> 1/1 passed, `echo hello && exit 1` ->
0/1 passed, `echo all good` -> 1/1 passed. Before the change all three
scored 1.0.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PuS77R8a6Lhp7jK6dnwdTh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant