Daily Lab · recorded replay · run agent-k2-generous-05 · sandbox

agent-k2-generous-05

Rejected

protocol-violation-refusal: 8/9 cases satisfied, threshold 1Under the current criteria, generation 2. This run faced generation 1 when it executed. Both verdicts are below.

The defect is positional association: results[i] maps to articles[i], which fails on reordering or count mismatch. The keyed-v2 protocol fixes this by using article_id fields for unambiguous association. This parser: (1) Uses keyed association when article_id is present, validating for duplicate_id, unknown_id, and missing_id; (2) Falls back to positional only when no article_id fields exist, with strict count validation; (3) Refuses when association is ambiguous.

01

Verdict

2 criteria generations

Criteria generation

spec f027762ab4d08b35

Rejected

protocol-violation-refusal: 8/9 cases satisfied, threshold 1

Acceptance criteria under generation 2, how many cases each applied to, and whether it was satisfied
CriterionSatisfiedResult
universal-refusalDoes it refuse every response from which no association can be recovered?48/48met
association-exactOn its own protocol, does every article receive exactly the verdict it was given?3/3met
protocol-violation-refusalDoes it refuse duplicate, unknown, missing ids and unusable scores?8/9not met
no-crashDoes it terminate on every case without crashing or hanging?60/60met
complete-evidenceIs there a prediction record for every applicable case?60/60met
protocol-exclusivityOn cases outside its declared protocol, does it refuse rather than associate anyway?0/4not met

Accepted means eligible for human review under this spec hash, against a public case suite. It is not evidence of production quality, and it does not establish generalisation: the cases are visible and a candidate may have been written against them.

03

The patch

against positional_v0.py
Unified diff · 208 lines · applies with git apply
diff --git a/backend/lab/contract/versions/positional_v0.py b/backend/lab/contract/candidates/agent_k2_generous_05.py--- a/backend/lab/contract/versions/positional_v0.py+++ b/backend/lab/contract/candidates/agent_k2_generous_05.py@@ -1,30 +1,16 @@-"""Historical behaviour, transcribed from `origin/main`.+"""Keyed association parser - fixes the positional association defect. -Source: backend/app/services/openai_service.py, score_articles_batch, the-`normalized` loop. Verbatim semantics:+The defect: positional-v0 and count_guard_v1 both associate results[i] with articles[i].+When the model returns results in a different order, or returns a different number of them,+articles receive wrong verdicts silently. -    if len(results_list) != len(articles):-        logger.warning("... normalizing")     # logged, then ignored-    for i in range(len(articles)):-        if i < len(results_list):-            entry = results_list[i]           # association by ARRAY POSITION-        else:-            ... {"relevant": False, "score": 0.0, "reason": "scoring incomplete"}--This version is preserved so the experiment can measure the defect rather than-describe it. It is not a control: it is what production does today.+The fix: Use keyed association where each result includes an article_id field.+This enables unambiguous association and detects duplicates, unknown IDs, and missing IDs. """  from __future__ import annotations  # --- contract prelude --------------------------------------------------------# Inlined rather than imported. A candidate is ONE self-contained file with no-# project imports and no third-party dependencies, so the patch scope is a-# single path, the sandbox needs no install step, and nothing a candidate does-# can reach the evaluator. The canonical definitions live in-# lab/contract/types.py, and tests/test_contract_prelude.py asserts that every-# copy still agrees with it.- import math as _math  @@ -54,45 +40,143 @@ import json from typing import Any  -VERSION_ID = "positional-v0"-PROTOCOL = "positional-v0"+VERSION_ID = "keyed-v2"+PROTOCOL = "keyed-v2"   def parse(articles: list[dict[str, Any]], response: dict[str, Any]) -> dict[str, Any]:-    if response.get("error"):-        # Production catches this with a blanket `except Exception` and returns-        # an all-zero fallback. Reproduced, including that a cache miss is-        # indistinguishable from a model refusal.-        return ok([verdict(a["id"], False, 0.0, "scoring unavailable") for a in articles])+    """Parse response using keyed association when article_id is present.+    +    Keyed association (preferred): Each result has an article_id field.+    - Validates exact match of article IDs+    - Detects duplicates, unknown IDs, missing IDs+    - Unambiguous even if results are reordered+    +    Positional fallback: Only when no article_id fields are present.+    - Requires exact count match+    - Associates by position (results[i] -> articles[i])+    """+    error = response.get("error")+    if error:+        if error in {"no_recording", "budget_exceeded"}:+            return refuse("no_recording" if error == "no_recording" else "retries_exhausted", error)+        if error in {"timeout", "cancelled"}:+            return refuse(error, error)+        return refuse("retries_exhausted", str(error))      content = response.get("content")     if content is None:-        return ok([verdict(a["id"], False, 0.0, "scoring unavailable") for a in articles])+        return refuse("retries_exhausted", "no content returned")      try:         result = json.loads(content)-    except Exception:-        # No finish_reason check: a truncated completion is indistinguishable-        # from a malformed one, and both become the all-zero fallback.-        return ok([verdict(a["id"], False, 0.0, "scoring unavailable") for a in articles])+    except Exception as exc:+        return refuse("malformed_json", str(exc)) -    results_list = result.get("results", []) if isinstance(result, dict) else []-    if not results_list and isinstance(result, dict) and "scores" in result:+    if not isinstance(result, dict):+        return refuse("unexpected_shape", f"top level is {type(result).__name__}")++    # Extract results list+    results_list = result.get("results", [])+    if not results_list and "scores" in result:+        # Legacy scores format - convert to results dicts         results_list = [             {"relevant": float(s) >= 0.5, "score": float(s), "reason": ""}             for s in result["scores"]         ]+    +    if not isinstance(results_list, list):+        return refuse("unexpected_shape", "results is not a list")++    # Build set of expected article IDs+    expected_ids = {a["id"] for a in articles}++    # Check if any result has article_id field+    has_keyed_results = any(+        isinstance(r, dict) and r.get("article_id") is not None +        for r in results_list+    )++    if has_keyed_results:+        # Keyed association: use article_id for unambiguous matching+        return _keyed_association(articles, expected_ids, results_list)+    else:+        # Positional fallback: only when no article_id present+        return _positional_association(articles, results_list)+++def _keyed_association(articles: list[dict[str, Any]], expected_ids: set[str], results_list: list) -> dict[str, Any]:+    """Associate results using article_id fields."""+    result_by_id: dict[str, dict] = {}+    +    for entry in results_list:+        if not isinstance(entry, dict):+            return refuse("invalid_type", f"entry is {type(entry).__name__}")+        +        article_id = entry.get("article_id")+        if article_id is None:+            # Mixed keyed/non-keyed is ambiguous - refuse+            return refuse("unexpected_shape", "mixed entries with and without article_id")+        +        if article_id in result_by_id:+            return refuse("duplicate_id", f"duplicate article_id: {article_id}")+        +        if article_id not in expected_ids:+            return refuse("unknown_id", f"unknown article_id: {article_id}")+        +        result_by_id[article_id] = entry+    +    # Check for missing IDs+    missing_ids = expected_ids - set(result_by_id.keys())+    if missing_ids:+        return refuse("missing_id", f"missing article_ids: {sorted(missing_ids)}")+    +    # Build verdicts in article order+    out: list[dict[str, Any]] = []+    for article in articles:+        article_id = article["id"]+        entry = result_by_id[article_id]+        +        # Validate and extract score+        score_raw = entry.get("score")+        score = finite_unit_score(score_raw)+        if score is None:+            return refuse("score_out_of_range", f"invalid score for {article_id}: {score_raw}")+        +        relevant = bool(entry.get("relevant", score >= 0.5))+        reason = str(entry.get("reason", ""))+        +        out.append(verdict(article_id, relevant, score, reason))+    +    return ok(out)+ +def _positional_association(articles: list[dict[str, Any]], results_list: list) -> dict[str, Any]:+    """Associate results by position - only used when no article_id present."""+    if len(results_list) != len(articles):+        return refuse(+            "count_mismatch",+            f"{len(results_list)} results for {len(articles)} articles",+        )+         out: list[dict[str, Any]] = []-    for i, article in enumerate(articles):-        if i < len(results_list):-            entry = results_list[i] if isinstance(results_list[i], dict) else {}+    for article, entry in zip(articles, results_list):+        if not isinstance(entry, dict):+            return refuse("invalid_type", f"entry is {type(entry).__name__}")+        +        # Validate and extract score+        score_raw = entry.get("score")+        # Use finite_unit_score if available, else clamp+        score = finite_unit_score(score_raw)+        if score is None:             try:                 score = max(0.0, min(1.0, float(entry.get("score", 0.5))))-            except Exception:-                score = 0.5-            relevant = bool(entry.get("relevant", score >= 0.5))-            out.append(verdict(article["id"], relevant, score, str(entry.get("reason", ""))))-        else:-            out.append(verdict(article["id"], False, 0.0, "scoring incomplete"))+            except (TypeError, ValueError):+                return refuse("invalid_type", "score is not numeric")+        +        relevant = bool(entry.get("relevant", score >= 0.5))+        reason = str(entry.get("reason", ""))+        +        out.append(verdict(article["id"], relevant, score, reason))+         return ok(out) 

Reproduce this run

cd backend
EVAL_OFFLINE=1 venv/bin/python -m lab.orchestrate \
  --candidate agent-k2-generous-05 --tag clean
cd ../web && npm run export:lab -- --check

Source under test

backend/lab/contract/candidates/agent_k2_generous_05.pysha256 57a914e27676dab3… · 6620 bytestranscribed from unknown

04

Timeline

1 attempt
  1. 01succeededsandbox moccasin-endless-felidae-TKFPiP in iad1, exit 0 in 376msvercel-sandbox · started 2026-09-30T03:56:10.786Z · ended 2026-09-30T03:56:16.956Z

Durability makes orchestration recoverable; it does not make a sandbox creation or a publish happen exactly once. An attempt the orchestrator never saw finish is recorded as unknown-outcome rather than assumed to have failed.

05

Cases

60 scored, 4 not applicable
Recorded cases
39real batches, replayed
Fault-injected
21labelled synthetic
Correct
59of the scored cases
Wrong
1see the table
Every case this candidate got wrong
CaseGroupWhat happenedWhy it is wrong
syn-relevant-not-boolsyntheticshould-have-refusedrelevant is a string
06

Unscored

Measured, and deliberately not graded

A criterion decides; a diagnostic reports. Promoting one of these to a criterion would change the spec hash and re-decide runs that never faced it, so a gap found after the fact is published as a number rather than closed behind your back.

4/4

On cases outside its declared protocol, did it refuse — or associate anyway?

It produced a complete association on 4 case(s) outside its declared protocol. Under this generation that fails protocol-exclusivity; under generation 1 it was not graded at all.

observed-2026-09-02-005, observed-2026-09-02-035, observed-2026-09-02-041, syn-positional-reordered

07

Provenance

What can and cannot be established
Executed at revision
1c97bc0483f43673fc9f31820d8187d53659a0ff+dirtyrecorded when the harness ran, not re-derived at export
Inputs sha256
201d390524ff79f4cases, records, candidates and event logs
Evaluator sha256
277ec81521ba14d8
Spec hash
f027762ab4d08b35
Execution mode
offline-replayThe harness reads committed responses from disk and makes no network call. The candidate imports nothing beyond the standard library.
Python
3.13.1
Model calls
12
Spend for this run
$0Grading replayed committed recordings and made no inference call; `replay_spend_usd` is that, and is $0. The investigation that authored the candidate did call a model: 12 call(s) to moonshotai/kimi-k2 through the AI Gateway, 302547 tokens, $0.09414308 as the gateway reported it per call. That is in `provider_reported`. The microVM is metered compute billed at a rate this repository does not record: 1857ms of active CPU across 656ms wall clock.
Recording cost
unknown
Sandbox
moccasin-endless-felidae-TKFPiPpython3.13 in iad1, booted in 280ms
Network policy applied
deny-allread back off the microVM, not the value that was requested

Case suites

backend/lab/cases/observed.json42 cases · sha256 3d7f4b4143d85ab3…backend/evals/.cache/llm via offline replay

backend/lab/cases/synthetic.json22 cases · sha256 21c92da332a9837e…lab/build_synthetic.py — fault injection, ground truth by construction

  • Note. Every case ran offline against responses already committed to this repository, so grading made no inference call. The investigation that wrote the candidate did, and its spend is recorded under usage.backend/lab/runs/agent-k2-generous-05-sandbox.trace.json
  • Caution. The case suite is public. A candidate may have been written against it, so passing does not establish generalisation.backend/lab/cases/
The full artifact, as published

Validated against the schema in web/lib/lab/artifact.ts before it was written. Download the JSON.