Files
AiSOC/docs/evaluation
Beenu Arora f840cbe2a6 Eval honesty wave: serving-model attribution, full-cohort closure accounting, conservative correlation fallback (#1581)
* agents: serving-model attribution from gateway header or response body

Every published verdict-eval row placed 72 model calls and shipped
resolved_models: [] — the runs were served by an OpenAI-compatible endpoint
directly, and the LiteLLM header extractor was the only serving-identity
reader in the tree. The serving identity was in the response body's model
field the whole time.

app/core/model_attribution.py reads it with the one guard that matters:
langchain_openai builds response_metadata['model_name'] with the requested
name as the fallback, so the body value is credited only when it differs
from the request or the response carries its own id (set by langchain only
when the body had one). A requested alias is never copied into serving
metadata.

CallRecord/CostTracker/CostSummary carry the attribution source and the
backend's system_fingerprint beside the resolved model; the replay decision
and the worker's cost payload publish per-source call counts so a grader
can compute an honest run-level provenance status (verified /
self_reported / unattributed / serving_mismatch / no_calls).

Also carried per decision: the alert's severity, for the per-severity miss
breakdown the scorer now reports.

* agents: a measurement cannot authorise a closure it cannot be bound to

evaluate_eligibility gains model_attribution — who vouched that the
evaluated model served this call. A clearing measurement with no
attribution now BLOCKS instead of binding: the gateway may have
re-pointed the alias since the measurement was taken, which is exactly
the drift a measurement-gated closure exists to catch. With no matching
row the state stays UNMEASURED whatever the attribution, so the strict
posture keeps meaning something.

run_auto_triage evaluates eligibility against the serving identity when
one was attributed (falling back to the requested name so the UNMEASURED
default is unchanged), records serving_model/attribution on the
confidence basis and in the ledger exchange, and the positive-control
test now proves a clearing measurement closes only through an attributed
response.

run_verdict_eval publishes provenance_status and
advertisable_as_model_performance on every scorecard, threads
requested_total into the score, and refuses to attribute a live run
whose serving identity mismatches the requested model — the scorecard is
preserved as a diagnostic with the limitation recorded.

check_verdict_quality renders an Attribution column: historical rows read
'unverified (recorded before per-decision attribution existed)' rather
than receiving invented attribution, and a serving_mismatch row is
refused outright.

* fusion: a missing identifier narrows the correlation group instead of widening it

Neither detection engine has ever set mitre_tactics — the ruleset carries
technique ids only — so every detection alert's correlation key fell back
to {tenant}:{entity}:unknown and all of an entity's detection alerts,
whatever the rule or kill-chain stage, collapsed into one incident per
window, titled after whichever arrived first. Alerts with no entity merged
tenant-wide under {tenant}:unknown:unknown. Both collapses bury exactly
the alert an analyst needed rendered.

correlation_key() now narrows on missing evidence: entity+tactic is
unchanged; entity with no tactic scopes to the detection rule (the same
rule repeating is the storm correlation exists for; different rules on one
entity are not known to be one incident); no entity never groups across
rules; no identifiers at all groups only exact repeats of one shape via
the dedup fingerprint. The cost is stated where it is paid: one event
firing N tactic-less rules fragments into N incidents rather than burying
N-1 of them — the recoverable direction.

Measured on a fixed detection-shaped cohort (1000 alerts, rule_id set, no
tactics, ~4% entity-less), real correlation_key() both sides: before 574
incidents / 42.6% reduction with 36 incident-groups spanning more than one
rule and every no-entity alert merged tenant-wide; after 755 incidents /
24.5% reduction with zero cross-rule groups. The reduction went DOWN and
that is the honest direction — the difference was unrelated alerts being
counted as grouped. The tactic-carrying headline cohort is untouched at
33.3% and its gate passes unchanged.

The Correlator's creation race is closed with SET NX: the previous plain
SET let two concurrent first-arrivals both win, the last writer owning the
index while the first writer's incident — carrying a real alert — became
an unreachable orphan. The loser now merges into the winner. The narrower
merge/merge read-modify-write window is documented, not closed; closing it
takes an owner-checked script like the windowed engine's.

tests/integration/test_correlator_live.py proves window expiry, tenant
boundaries, restart continuity, per-rule fallback grouping and creator
convergence against a real Redis (negative control: reverting to the plain
SET fails the convergence test). integration.yml gains a fusion-redis-live
job keyed on the existing spine filter, which also gives the previously
unwired windowed-claim live suite a workflow that actually runs it — with
an all-skipped run refused rather than green.

* agents+api: the reflex path reports its stages; retro-hunt gains a rehearsal mode

Reflex observability (services/agents): FusedAlertTriageWorker.triage now
measures named stages — business context, memory suppression, context
fetch, decide, verification, persist, escalate, approvals, writeback —
plus the queue delay read off the envelope's fused_at (None when the
envelope carries none; a replayed historical finding legitimately has no
delay and inventing one would put a plausible number on a measurement
nobody took). Timings land on the summary, the completion log line joined
by run id, and every replay decision, so an eval can split 'slow' into
the queue, the context fetch, the model and the persistence.

The summary also carries a structured decision contract assembled from
signals that already ran — verdict, operational disposition, supporting
and contradictory decisive claims (the claim-support review now travels
on the state as structure, not only as basis strings), groundedness,
missing prerequisites, the blocking or demoting gates, and the escalation
reason. A signal that never ran reports None, never an empty list
pretending the check happened.

Retro-hunt rehearsal (services/api): sweep_tenant gains dry_run, withheld
at the mutation boundary that owns the writes — the warehouse sweep runs
exactly as live (and still consumes the sweep budget, because the scan
the budget bounds was performed), but matches come back as recorded
proposals: no alert opens, no sighting row lands, and the dedup branch
leaves even its counters untouched, so an evaluation re-running history
cannot advance production records. RETRO_HUNT_DRY_RUN selects the mode;
the guard is not the flag. The negative control proves the same sweep
without dry_run still adds the alert and the sighting row.

run_verdict_eval scorecards now carry the model-knowledge disclosure:
evidence cutoffs constrain supplied context only, and the weights'
training cutoff is recorded when the operator states it and 'unknown'
otherwise — never an implied 'before the events'.

* scripts: the model matrix grades the verdict task and records its runtime

run_model_matrix gains --task verdict, wrapping run_verdict_eval per model
exactly as the wet task wraps run_evals — a thin collator defining no
scoring of its own. A verdict row carries its configuration (pins, endpoint,
prompt provenance, corpus digest, the provenance_status the scorecard
earned and the serving models behind it) so two rows can be compared
knowing they were configured alike, and a run the eval refused — a serving
mismatch — comes back as that row's error with the scorecard kept as
evidence, never as numbers under the requested model's name.

The payload records the runtime in comparable-but-unidentifying terms (OS
family, arch, interpreter, core count — no hostname, no paths) and the
constant-answer baselines a verdict table is read against. An endpoint
with no hosted key is a first-class subject for the verdict task, because
a locally served model is exactly what the corpus was built to grade.

* docs+tests: the benchmark page carries the attribution mechanism and the third reduction figure

The 'attribution is unverified' paragraph now says what changed: the five
historical rows keep their honest unverified rather than receiving
invented attribution, and every run after them carries a provenance_status
the Attribution column renders. The alert-reduction section names all
three figures with their cohorts — the tactic-carrying 33.3%, the
detection-shaped 24.5% with its before/after and zero cross-rule groups,
and the retained legacy 75.3% — and says why the honest direction for the
second was down.

Replay reproducibility comparators exclude the new wall-clock fields
(stage_timings_ms, queue_delay_ms) exactly as they exclude latency_ms:
all three measure the host, not the input, and two identical runs on one
machine legitimately differ on them.

* agents+docs: deterministic baseline published; annotated claim-support measurement; changelog

The committed verdict scorecard gains the deterministic-fallback row — the
rules baseline every measured model is read against, and it lands exactly
on the 0.250 constant-answer floor with zero of 36 malicious cases caught.
Published through the same gate and rendered with 'no calls' attribution.

tests/test_claim_support_measured.py is the first unsupported-claim-rate
measurement in the tree: sixteen hand-annotated cases, the confusion
matrix pinned exactly in both directions (TP 7, FP 0, FN 1, TN 8), a
recorded known miss (verbal authority that avoids the approval
vocabulary) that must stay missed until the pins move with it, and the
annotation-independence limit stated beside the number — the annotator
authored the cases and had read the detector, so this is regression-grade,
not an audit.

The measurement immediately found a production defect and the fix is the
smaller half of this commit: the MAINTENANCE claim pattern recognises
'scheduled (scan|job|task|reboot)' while the support keys covered only two
of the four nouns, so an alert whose evidence recorded scheduled_scan
could state the claim the pattern knows and still be refused support —
flagging exactly the analyst language the detector cannot afford to flag.
Negative control: reverting the two keys fails the pinned matrix.

CHANGELOG carries the whole wave under [Unreleased].

* chore: close out the feedback-eval progress tracker

* scripts: verdict scorecards record the sampling the production call pins

The full audit legs confirmed sampling settings were recorded nowhere on
the verdict path while the reliability harness already carries the
production-pinned constants. Scorecards now carry a sampling block
(temperature, max_tokens, json_mode) imported from that harness, so the
call site, the harness and the scorecard share one declaration and drift
together loudly; the verdict matrix threads it into each row's
configuration. Two scorecards sampled differently are not comparable, and
until now nothing a reader could open said how a row was sampled.

The progress tracker gains the residual-gap addendum from the completed
audit legs: ModelRouter/cost_aware_cascade and sources_from_ledger exist
unwired, evidence_completeness has no corpus referent, retro-hunt records
no intelligence-version identifier, replay proxies occurrence time via
closed_at, and policy rows carry no revision id — recorded, not fixed.

* matrix+ci: five GATED rows for the feedback-hardening gates; one migration_paths assignment

The claim matrix gains rows for serving-model attribution provenance, the
replay scorer's full-cohort and closure accounting, the conservative
correlation fallback with its live-Redis proof, the retro-hunt rehearsal
mode, and the annotated unsupported-claim measurement — each naming the
exact tests and jobs that fail when the claim stops being true, with the
tallies recomputed where they are published (Summary stanza, ROADMAP,
evidence pack): 334 rows — 329 GATED / 5 PARTIAL / 0 NO GATE.

integration.yml's area filter had grown three parallel migration_paths
assignments — three lanes each appended theirs as a fresh line, and in
shell the last silently wins — so the asset-context live leg and the
business-context rail legs were inert in the filter: their live tests ran
only when something else in the surviving list changed. One union
assignment now, with the comment telling the next lane to extend rather
than re-assign.

* ci: fix the four first-cycle check failures

The vendored benchmark copy under services/api/app/_vendor is re-synced
byte-identically after the scorer gained its cohort metrics — the package
was edited and its mirror was not, which is exactly what the drift gate
exists to catch. ADVERTISABLE_STATUSES joins model_attribution's __all__
(it is the module's public contract and run_verdict_eval imports it;
CodeQL correctly read its absence as an unused global). The fusion-redis-
live job pins cryptography to the contract range the dependency-pin gate
holds every install path to, and the progress tracker stops naming a
machine-local absolute path — a worktree path exists on one computer and
the machine-path gate is right to refuse it.

* matrix: re-sync with main's Agentmetry row; drop the stale duplicate injection row

Main gained the Agentmetry ingest-template row while this branch added
five, so the shared base of 329 became 330 and the combined table is 334
after one correction: 'Prompt-injection resistance' appeared twice, a
duplication already present on main, and the two variants had drifted
into contradiction — one says no payload is xfail at present, the stale
one still said two payloads are currently xfail. The richer, current
variant is kept; the stale one is dropped rather than left to tell a
reader something false. Tallies recomputed in the Summary stanza, ROADMAP
and the evidence pack: 334 rows — 329 GATED / 5 PARTIAL / 0 NO GATE.

* ci: the fusion live job installs the service's committed lock into its own venv

The install-parity gate is right on both counts it raised. A job that runs
the whole services/fusion suite must install fusion's poetry.lock rather
than a hand-picked closure — the tiny closure re-resolved inside the
declared ranges, so the versions CI graded need not be the versions the
image installs, and its missing clickhouse-driver silently graded the
lake writer's except-ImportError fallback where production grades the
real path. And the lock belongs in the interpreter the tests actually
run under, so the job now mirrors ci.yml's convention exactly: the lock
into $RUNNER_TEMP/.venv-fusion, the suite from its bin/python.
2026-10-31 19:29:34 -07:00
..