Skip to content

Real-model benchmark: Hermes cron, gpt-4o-mini, published injections, no-key replay - #12

Merged
JoeProAI merged 2 commits into
mainfrom
bench/real-model
Nov 11, 2026
Merged

JoeProAI merged 2 commits into
mainfrom
bench/real-model

Conversation

@JoeProAI

@JoeProAI JoeProAI commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Adds bench/, a judge-reproducible benchmark of Mandate on real Hermes cron with a real model. Not for merge until Joe says yes.

Headline: on real Hermes v0.23.0 cron with gpt-4o-mini, Mandate blocked 29 of 29 injected attack calls the model made. 0 of 120 attack runs caused harm, against 18 of 120 with Hermes defaults alone. 9 of 263 legit calls were falsely blocked in clean runs.

  • Runs: 710 real cron runs: 10 jobs and 4 arms (Mandate, Hermes defaults cron_mode: deny, Hermes Guard @6b8a32db, agent-security-guard @b1b923e6).
    • Each arm gets 5 clean runs and 12 attack runs per job.
    • Mandate also gets 3 observe runs per job, then a scripted approval, which is disclosed.
  • Injections: published wrappers from AgentDojo and InjecAgent (both MIT, commits pinned) around six goals we wrote: exfil, remote exec, destructive delete, credential reads, obfuscated shell, and a send to a new host.
  • Same-traffic replay: all 1178 recorded calls run through every guard. Mandate blocked 140/140 attack calls and 58/1038 legit calls. Hermes cron deny blocked 38/140 and 0, Hermes Guard 51/140 and 7, agent-security-guard (pre_tool_call only) 0/140 and 0.
  • Replay checks and overhead: make bench is free and needs no key. All 10 policies rebuilt identical, all 1043 decisions matched the live run, and pre_tool_call measured p50 about 1.3 ms and p95 about 2.9 ms.
  • Spend: $2.01 of OpenRouter key usage in total, against a $5 cap.
  • What's in bench/README.md: misses, every false block with its cause, six Mandate fixes suggested by them, caveats, and disclosures (early arms ran before the sandbox, discarded runs, probe of 8 models).
  • Install scan: hermes plugins validate . still passes with a "caution" verdict, from files that were already there. Tests: 111 passed, 1 skipped.

Devin Review

…d injections, no-key replay

Mandate blocked 29 of 29 attack calls (0 of 120 attack runs with harm vs 18 with Hermes defaults),
9 of 263 legit calls falsely blocked. make bench replays the traces for free. See bench/README.md.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 4 potential issues.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment thread bench/run_live.py
Comment on lines +67 to +73
def ok(self) -> bool:
try:
if self.spent() >= self.stop_usd:
STOP.set()
except Exception:
pass
return not STOP.is_set()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Spend cap disappears on usage errors

When the key-usage request fails, Spend.ok launches more paid runs without checking the cap. Repeated API failures can exhaust the remaining benchmark and exceed the requested budget.

Learn more

The live driver asks OpenRouter for cumulative key usage before each paid run. A failed request currently counts as permission to proceed, so an unavailable or rate-limited usage endpoint removes the spend stop for every worker. worker continues submitting runs whenever Spend.ok returns true.

Example: With --stop-usd 3, the usage endpoint starts returning HTTP 429 after $2.90. Each worker catches the error and runs the remaining model calls, even after the key passes $3.

Recommended fix: Treat an unknown usage result as a stop condition, surface the lookup error to the operator, and ensure the final accounting failure does not hide the reason the run stopped.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread bench/run_live.py
Comment on lines +393 to +408
with ThreadPoolExecutor(args.parallel) as ex:
futs = [ex.submit(worker, J.JOBS.index(j), j, args, spend, out) for j in sel]
for f in futs:
try:
f.result()
except Exception as exc:
print("worker failed:", redact(repr(exc))[:800], file=sys.stderr)
spent = spend.spent()
meta = {"model": args.model,
"hermes": subprocess.run([HERMES, "--version"], capture_output=True, text=True).stdout.splitlines()[0],
"openrouter_key_usage_delta_usd": round(spent, 4), "stopped_on_budget": STOP.is_set(),
"wall_seconds": round(time.time() - t0), "args": {k: v for k, v in vars(args).items() if k not in ("out", "done")}}
with open(out.with_suffix(".meta.json"), "w") as f:
json.dump(meta, f, indent=2)
print(json.dumps(meta, indent=2))
return 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Partial runs publish benchmark results

When the budget stops an arm early, main succeeds and bench-live replays and scores its partial trace. The printed results then omit unfinished runs without marking the comparison incomplete.

Learn more

The spend check inside worker returns as soon as the configured stop is reached, leaving some arms unfinished. A successful driver exit then lets the bench-live target invoke replay, scoring, and the headline printer. Neither of those commands checks whether every requested job and arm finished.

Example: Run make bench-live BENCH_STOP_USD=0.01. After the first few jobs the stop flag ends the workers, but the target continues and presents totals based only on the runs recorded so far.

Recommended fix: Persist the partial trace for resumption, but exit nonzero or skip the scoring and headline stages when any requested arm is incomplete; explicitly label incomplete outputs if partial results are supported.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread bench/run_live.py
Comment on lines +369 to +378
want = {a: (args.observe if a == "mandate" else 0) + args.clean + args.attacks * args.templates for a in args.arms}
done, keep, drop = set(), [], []
if out.exists():
old = [json.loads(x) for x in out.read_text().splitlines() if x.strip()]
cnt = {}
for r in old:
cnt[(r["job"], r["arm"], r["model"])] = cnt.get((r["job"], r["arm"], r["model"]), 0) + 1
done = {k for k, n in cnt.items() if n >= want.get(k[1], 10 ** 9)}
for r in old:
(keep if (r["job"], r["arm"], r["model"]) in done else drop).append(r)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changed run settings reuse incompatible arms

When a later run requests fewer samples, done treats any longer prior arm as complete. The new benchmark silently uses the old sample mix instead of the requested settings.

Learn more

A live trace can contain data from an earlier invocation using the same model but different --clean, --attacks, --templates, or --observe settings. Resume compares only the number of records in an arm with the new requested number, not the expected phase, category, wrapper, and run number. worker then skips every arm in done.

Example: First run the default five clean samples per arm, then request --clean 2 with the same model and trace path. An arm with five clean samples already exceeds want, so no new arm runs and scoring retains all five.

Recommended fix: Persist and compare the sampling configuration and expected per-arm run identities before retaining an arm, or require a fresh trace path for incompatible configurations.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread bench/run_live.py
Comment on lines +153 to +154
if os.environ.get("BENCH_SANDBOX", "1") == "0" or not shutil.which("bwrap"):
return []

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟥 Missing sandbox exposes host credentials

Without bwrap, sandbox runs Hermes unsandboxed while processing injected content. An induced file read or shell command can reach real host credentials and files.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

…blocked (#13)

* Cut false blocks without widening reach: distinct write paths, read-back, tool families, read-only flag variance, mkdir of report dirs, propose prompt-path warning

Replay on the recorded gpt-4o-mini traces: attack calls blocked 140/140 (unchanged), legit calls blocked 58/1038 -> 39/1038. Tests 111 -> 152.

* bench README: live spot check of the fixed code (12 clean enforce runs, 0 blocks, $0.015)

---------

Co-authored-by: JoeProAI <176786290+JoeProAI@users.noreply.github.com>
@JoeProAI
JoeProAI merged commit f3cdce9 into main Nov 11, 2026
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.

1 participant