Skip to content

fix(cli): do not report a clean mutiny run when nothing was tested (#169) - #171

Open
RupeshMaster wants to merge 1 commit into
CodewithJha:mainfrom
RupeshMaster:fix/run-nothing-tested
Open

RupeshMaster wants to merge 1 commit into
CodewithJha:mainfrom
RupeshMaster:fix/run-nothing-tested

Conversation

@RupeshMaster

Copy link
Copy Markdown

Summary

Fixes #169. mutiny run ended with "No violation this run" and exit 0 when every candidate timed out, or when the policy had no rules. In both cases the agent was never checked against the policy.

  • A policy without rules (rules: [] or no rules key) exits 2 before the adapter runs, with a hint to add a rule.
  • A candidate whose agent step timed out is marked on its line: seed-0-…: fitness=0.000 · DID NOT FINISH (adapter_step_timeout: exceeded 60s). A warning on stderr counts them.
  • When no candidate finished, the run prints an error with likely causes and exits 1. The "try different rng_seed" advice is not printed in that case.

A run where only some candidates timed out still exits 0, with the warning.

Behavior to be aware of

  • Exit codes change for the two cases above (0 → 2 for an empty policy, 0 → 1 when nothing finished). If you would rather keep exit 0 and only print the warnings, that is a two-line change and I'm happy to make it.
  • This is CLI-only. The engine still returns status="completed" for timed-out candidates, as the test from PR [RELIABILITY] Bound adapter steps and campaign wall clock (MUT-022, MUT-045) #96 expects, and Hosted is not touched.

Not in this PR

The step timeout (60 s) cannot be set from mutiny.yaml, and the minimizer and mutiny test always use the default. Making it configurable needs one change across run, minimize and replay, so I left it out; I can open an issue for it if you want it.

Type of change

Checklist

  • I read CONTRIBUTING.md (where to ask, how reviews work, how to run tests)
  • Linked related issue (Fixes #N) or Discussion when applicable
  • Core stays free of framework SDK imports (adapters own glue)
  • Tests added or updated when behavior changes (uv run pytest tests/unit -q)
  • Docs / README claims match reality (no PyPI / multi-adapter claims unless shipped)
  • One concern per PR when possible
  • Authorized testing only — no open-internet attack-proxy behavior

Test plan

  • Python lint: uv run --locked ruff check → all checks passed
  • Backend tests: uv run pytest tests/unit tests/integration tests/reliability -q → 853 passed. Run locally on Python 3.12 only (macOS, OPENAI_API_KEY unset); 3.11 is left for CI.
  • CLI smoke: from a copy of examples/openai_support_agent, mutiny --help, mutiny init, mutiny run with MUTINY_SAMPLE_OFFLINE=1 and empty OPENAI_API_KEY / FEATHERLESS_API_KEY → violation found, regression saved.
  • Web typecheck + build: not run; apps/web is not touched.
  • Package build + isolated artifact gate: tests/unit/test_package_release.py passed as part of the unit run; ./scripts/verify_release_artifacts.sh not run.

Extra:

  • New tests in tests/unit/test_mutiny_cli_run_untested.py: all candidates timed out (exit 1, three marked lines, error), some timed out (exit 0, warning), none timed out (no warning), and a policy with rules: [] or no rules key (exit 2). Four of the five fail on main (ee7e898).
  • The timeout tests call _run_local with a 0.05 s step timeout, because the CLI cannot set it. I did not wait out a real 60 s timeout through mutiny run.
  • mutiny run on the sample project with rules: [] now prints error: policy.yaml has no rules, so a campaign has nothing to check and exits 2.

Notes

  • Independent of my other open PRs; it merges cleanly with each of them.
  • AI assistance: this change was written with an AI coding agent. The checks above were run locally before opening the PR.

Two cases ended with "No violation this run" and exit 0 although the
agent was never checked against the policy:

- Every candidate timed out. A candidate whose agent step exceeds the
  step timeout is scored as non-violating, with nothing in the output to
  tell it apart from a candidate that behaved. An agent that hangs on
  every request (bad credentials with retries, an unreachable backend, a
  tool that blocks) therefore produced a clean run.
- The policy had no rules (`rules: []` or no `rules` key), so there was
  nothing to violate.

Now:

- a policy without rules exits 2 before the adapter runs;
- a timed-out candidate is marked `DID NOT FINISH` with the reason, and a
  warning counts them;
- when no candidate finished, the run says so and exits 1.

A run where only some candidates timed out still exits 0.
@vercel

vercel Bot commented Nov 27, 2026

Copy link
Copy Markdown

@RupeshMaster is attempting to deploy a commit to the priyanshu's projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

[bug] mutiny run reports "No violation" and exits 0 when every candidate timed out or the policy has no rules

1 participant