nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Bug] agent-eval: --help starts real model runs, unknown flags are ignored, fixture order is not sorted, and interrupted runs leave temp folders

Open addyCooks opened this issue 1 month ago • 1 comments

Description

benchmarks/agent/run.ts reads its flags with argv.indexOf(...) (run.ts:43-62) and has no --help and no check for unknown flags. So --help starts the full suite of model runs (6 fixtures x 5 runs), and a typo such as --fixtrue single-file-edit quietly runs everything. loadFixtures sorts directory entries without a comparator (harness.ts:228), so the order depends on the file system. If a run is interrupted, its temp workspace (harness.ts:355) is not removed.

Environment

  • OS: Windows 11 (10.0.26300)
  • Node version: 22.22.3
  • Nanocoder version: 1.31.0 (main at 9d88dda7)
  • Provider: Ollama
  • Model: qwen2.5:1.5b

Steps to Reproduce

  1. Run npx tsx benchmarks/agent/run.ts --help and stop it after 30 seconds.
  2. Run it with --fixtrue single-file-edit --runs 1 and stop it after 30 seconds.
  3. Run it with --bogusflag and stop it after 30 seconds.
  4. List the temp folder for agent-eval-*.

Expected Behavior

--help prints usage and exits. Unknown flags are an error. Fixtures run in a fixed order. Stopping a run removes its workspace.

Actual Behavior

--help                                  -> "failing-test 1/5", "failing-test 2/5" ... (still running when stopped)
--fixtrue single-file-edit --runs 1     -> "failing-test 1/1", "guard-json-parse 1/1" ... (all fixtures run)
--bogusflag                             -> runs the full suite
after stopping, temp folder:  agent-eval-failing-test-udwoVY, agent-eval-failing-test-yYawV3, agent-eval-guard-json-parse-bKnaiB

Sorting (shown on its own, because Windows already returns sorted names):

input order    : guard-json-parse, failing-test, multi-file-rename
current .sort(): guard-json-parse, failing-test, multi-file-rename    <- unchanged: every entry becomes "[object Object]"
with comparator: failing-test, guard-json-parse, multi-file-rename

Suggested Fix

  • Replace the indexOf parsing in run.ts with node:util parseArgs({strict: true}), and add a --help text.
  • harness.ts:228: use .sort((a, b) => a.name.localeCompare(b.name)).
  • Remove the workspace on SIGINT and SIGTERM (the normal path already does it in the finally at harness.ts:448).
  • Add tests for --help and for an unknown flag.

Additional Context

  • Harness: #1544. A paid provider makes --help costly, because it starts 30 real runs.
  • [x] I have searched existing issues to ensure this is not a duplicate
  • [x] I can reproduce this issue consistently
  • [x] This issue occurs with the latest version of nanocoder

addyCooks avatar Oct 13 '26 12:10 addyCooks

I can take #1745. I will verify the CLI argument and fixture-order behavior with offline tests, then add strict parsing, deterministic ordering, and signal-safe workspace cleanup if reproduced. I will not run the benchmark against a live model/provider.

ducanhnguyen223 avatar Oct 13 '26 22:10 ducanhnguyen223