Repository navigation
test(benchmark): scope host rules per host and cover host-subagent-swarm-burst - #472
Merged
blitzcrieg1 merged 1 commit intoNov 25, 2026
Conversation
…arm-burst The benchmark passed each recorded case to the session rules only, as a single session, so a host-scoped rule could never fire in it and a case spanning several sessions was read as one. It now scopes as detection.live does: session rules per correlation_id, host rules per host_id. That gives host-subagent-swarm-burst its corpus case: nine subagent starts over three sessions of three, each under the per-session threshold. Refs blitzcrieg1#36
This was referenced Nov 25, 2026
blitzcrieg1
added a commit
that referenced
this pull request
Nov 25, 2026
#474) (#475) Generated by Mistral Vibe. Co-authored-by: Mistral Vibe <[email protected]>
This was referenced Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Refs #36. One of the two uncovered rules,
host-subagent-swarm-burst, could not be covered by adding a case alone.run_benchmarkpassed each recorded file torun_detections, which runs the session rules only, and read the whole file as one session. A host-scoped rule can never fire there, and a case that spans several sessions is read as one.So this change has two parts:
benchmark.pynow scopes the waydetection.livedoes: session rules percorrelation_id, host rules perhost_id. Every existing case holds one session and one host, so their results do not move.attack_host_subagent_swarm.jsonl: nine subagent starts over three sessions of three, in twenty minutes on one host. Each session is under the per-session threshold of five, sosubagent-swarm-burststays silent and only the host rule sees the campaign. That is the evasion the rule exists for.The benchmark reports 15 rules covered, 104 cases, 0 missed and 0 false positives. Two tests pin the new scoping. README numbers and the CHANGELOG are updated.
The other rule: off-hours-activity (a finding, not a case)
I did not add a case for
off-hours-activity. The rule is opt-in (AGENTMETRY_DETECT_OFF_HOURS) and returns nothing unlesssettings.detect_off_hoursis true, and the benchmark runs on default settings. So a corpus case cannot fire it as the harness stands, however realistic the session. The unit tests enable it withmonkeypatch.The issue says to report this kind of thing rather than force a case. If you want it covered, one option is an optional per-case
settings:mapping incorpus.yaml(for exampledetect_off_hours: true,business_tz,business_hours), applied only while that case runs, which also pins the timezone so the case does not depend on the machine. I held back because it changes what a corpus case can express. Happy to do it here or in a follow-up, whichever you prefer.Checks
python -m pytest -q: 2958 passed, 19 skippedpython -m ruff check agentmetry testspassesagentmetry benchmark: 0 missed, 0 false positivesbenchmark.pyis not on the list), so the fingerprint does not move