Skip to content

Commit 21ef4b4

Browse files
committed
Harden the ADK reference harness
Change-Id: Ifdbad7dda040308074054305a4f18aa4d176d3e9
1 parent 48e0024 commit 21ef4b4

20 files changed

Lines changed: 13407 additions & 51 deletions

‎reference/README.md‎

Lines changed: 363 additions & 0 deletions
Large diffs are not rendered by default.

‎reference/core/budget.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ def __init__(
170170
self.config = config or BudgetConfig()
171171
self.run_id = run_id
172172
self.accumulated_tokens = initial_tokens
173+
# Usage-bearing LLM responses seen. Counted where tokens are counted, at
174+
# the same granularity, so the spend ledger's llm_calls column describes
175+
# the same events as its tokens column. Not a ceiling: max_llm_calls is
176+
# enforced by the ADK RunConfig, this merely observes.
177+
self.llm_calls = 0
173178
self.cached_tokens = 0
174179
self.fresh_tokens = initial_tokens
175180
self.graph_steps = initial_steps
@@ -193,6 +198,7 @@ def elapsed_formatted(self) -> str:
193198
return f"{minutes}m {secs:02d}s"
194199

195200
def record_tokens(self, count: int, cached_count: int = 0, cache_discount: float = 0.1) -> None:
201+
self.llm_calls += 1
196202
"""Records token consumption from an LLM call or stage with cache discounting (0.1x / 90% discount)."""
197203
if count <= 0:
198204
return

‎reference/core/config.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,8 +1320,14 @@ def _sanitize_structured_response(response: Any, schema_cls: Any) -> Any:
13201320
"reason": f"Fallback: {clean_snippet}",
13211321
}
13221322
elif schema_name == "ReviewVerdict":
1323+
# Fail CLOSED like the other two verdicts. The old value
1324+
# ("confirmed") promoted a safety-blocked or garbage response
1325+
# into a confirmed vulnerability and sent it down the
1326+
# critic/repro chain. The "Fallback:" reason prefix is a
1327+
# contract with the classifier: synthesized dismissals are
1328+
# routed but never persisted as finding status.
13231329
fallback_payload = {
1324-
"route": "confirmed",
1330+
"route": "false_positive",
13251331
"reason": f"Fallback: {clean_snippet}",
13261332
}
13271333
elif schema_name == "CriticVerdict":

0 commit comments

Comments
 (0)