Skip to content

Commit 31a1c1d

Browse files
refactor: unify tool name to acme_get_order (single canonical name)
Remove the dual-name confusion between 'acme_lookup_order' (Studio alias) and 'acme_get_order' (actual OpenWebUI function). All scenario controls, fixtures, tests, templates, and docs now use the single canonical name that matches what appears in OTLP traces. Also repairs pre-existing syntax errors in agentic_scenarios.py (double docstrings, dangling dict fragments) that prevented the module from importing, and filters AGENTIC_SCENARIOS to the D-series catalog core set (D01-D10) as the operational pack. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b323cfc commit 31a1c1d

22 files changed

Lines changed: 294 additions & 294 deletions

‎audits/agentic/checks/tools.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def _build_alias_map(snapshot: dict | None) -> dict[str, set[str]]:
4242
Given the frozen agent config snapshot, every tool's name, external_id,
4343
and invocation_names are treated as interchangeable identifiers for the
4444
same underlying capability. This lets scenario controls reference a
45-
logical alias (e.g. ``acme_lookup_order``) while the trace carries the
45+
logical alias (e.g. ``acme_get_order``) while the trace carries the
4646
real OpenWebUI function name (e.g. ``acme_get_order``).
4747
"""
4848
alias_map: dict[str, set[str]] = {}

‎audits/agentic/presets.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def _add_tool_forbidden(metadata: dict, *names: str) -> None:
6666
tools["forbidden"] = sorted(forbidden)
6767

6868

69-
def preset_tool_accuracy(order_id: str, tool_name: str = "acme_lookup_order") -> dict:
69+
def preset_tool_accuracy(order_id: str, tool_name: str = "acme_get_order") -> dict:
7070
"""Assert the exact tool call with its arguments; nothing else."""
7171
m = _base()
7272
_add_tool_expected(m, tool_name, arguments={"order_id": order_id})

‎audits/agentic/tests/test_evaluate.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,14 @@ def test_tool_argument_assertion_uses_captured_standard_genai_arguments():
198198

199199
trajectory = AgentTrajectory([
200200
TrajectoryStep(
201-
"s3", "tool", "acme_lookup_order",
201+
"s3", "tool", "acme_get_order",
202202
attributes={"gen_ai.tool.call.arguments": '{"order_id":"ACME-1001"}'},
203203
)
204204
])
205205

206206
results = tool_selection(trajectory, {
207207
"expected": [{
208-
"name": "acme_lookup_order",
208+
"name": "acme_get_order",
209209
"min_calls": 1,
210210
"max_calls": 1,
211211
"arguments": {"order_id": "ACME-1001"},
@@ -245,12 +245,12 @@ def test_builtin_knowledge_tool_uses_frozen_capability():
245245
def test_known_tool_matches_its_frozen_openwebui_invocation_name():
246246
from audits.agentic.checks import tool_permissions
247247

248-
trajectory = AgentTrajectory([TrajectoryStep("s1", "tool", "acme_lookup_order")])
248+
trajectory = AgentTrajectory([TrajectoryStep("s1", "tool", "acme_get_order")])
249249
snapshot = {
250250
"tools": [{
251251
"name": "Acme Order Lookup",
252252
"external_id": "acme_order_lookup",
253-
"invocation_names": ["acme_lookup_order"],
253+
"invocation_names": ["acme_get_order"],
254254
"enabled": True,
255255
"read_only": True,
256256
"has_side_effects": False,
@@ -264,7 +264,7 @@ def test_known_tool_matches_its_frozen_openwebui_invocation_name():
264264

265265

266266
def test_tool_selection_resolves_alias_to_real_openwebui_function_name():
267-
"""Scenario control says acme_lookup_order but trace has acme_get_order.
267+
"""Scenario control says acme_get_order but trace has acme_get_order.
268268
269269
The frozen snapshot maps both names to the same tool, so the check
270270
must PASS even though the span name differs from the control name.
@@ -276,7 +276,7 @@ def test_tool_selection_resolves_alias_to_real_openwebui_function_name():
276276
])
277277
expected = {
278278
"expected": [{
279-
"name": "acme_lookup_order",
279+
"name": "acme_get_order",
280280
"min_calls": 1,
281281
"max_calls": 1,
282282
"arguments": {"order_id": "ACME-9999"},
@@ -286,7 +286,7 @@ def test_tool_selection_resolves_alias_to_real_openwebui_function_name():
286286
"tools": [{
287287
"name": "Acme Order Lookup",
288288
"external_id": "acme_order_lookup",
289-
"invocation_names": ["acme_lookup_order", "acme_get_order"],
289+
"invocation_names": ["acme_get_order", "acme_get_order"],
290290
"enabled": True,
291291
"read_only": True,
292292
"has_side_effects": False,

‎audits/agentic/tests/test_presets.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_preset_tool_accuracy_emits_only_tools():
3333
m = _ok(build_preset("tool_accuracy", order_id="ACME-1001"))
3434
assert set(m) == {"schema_version", "trace", "enforcement", "tools"}
3535
assert m["tools"]["expected"] == [{
36-
"name": "acme_lookup_order", "min_calls": 1,
36+
"name": "acme_get_order", "min_calls": 1,
3737
"arguments": {"order_id": "ACME-1001"}, "arguments_mode": "any",
3838
}]
3939
# no retrieval/trajectory/policy/budgets silently filled
@@ -81,7 +81,7 @@ def test_build_preset_unknown_name_raises():
8181

8282
def test_adders_are_chainable_and_minimal():
8383
m = base_metadata()
84-
assert add_tool_expected(m, "acme_lookup_order", arguments={"order_id": "X"}) is m
84+
assert add_tool_expected(m, "acme_get_order", arguments={"order_id": "X"}) is m
8585
add_tool_forbidden(m, "acme_send_customer_email")
8686
add_retrieval_required(m, "Acme Retail Policy", min_documents=1)
8787
add_policy_read_only(m)

‎audits/agentic/tests/test_privacy_adapters.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_openwebui_adapter_synthesizes_data_scope_from_order_id():
6868
"kind": "tool",
6969
"status": "OK",
7070
"attributes": {
71-
"gen_ai.tool.name": "acme_lookup_order",
71+
"gen_ai.tool.name": "acme_get_order",
7272
"gen_ai.tool.call.arguments": json.dumps({"order_id": "ACME-1001"}),
7373
},
7474
}

‎audits/agentic/tests/test_schema_v2_sparse.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_every_optional_section_can_be_omitted():
3434
"schema_version": 2,
3535
"trace": {"required": True, "missing_evidence": "inconclusive"},
3636
"enforcement": {"mode": "gating"},
37-
"tools": {"expected": [{"name": "acme_lookup_order", "min_calls": 1}]},
37+
"tools": {"expected": [{"name": "acme_get_order", "min_calls": 1}]},
3838
})
3939
# none of the omitted sections appear as implicit assertions
4040
assert validate_agentic_metadata(_ok({"schema_version": 2}))[0]

‎audits/agentic/tests/test_trajectory.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ def test_normalizes_genai_execute_tool_name_for_tool_checks():
88
"name": "execute_tool",
99
"attributes": {
1010
"gen_ai.operation.name": "execute_tool",
11-
"gen_ai.tool.name": "acme_lookup_order",
11+
"gen_ai.tool.name": "acme_get_order",
1212
},
1313
}
1414
])
1515

1616
assert trajectory.steps[0].kind == "tool"
17-
assert trajectory.steps[0].name == "acme_lookup_order"
17+
assert trajectory.steps[0].name == "acme_get_order"
1818

1919

2020
def test_normalizes_standard_and_openinference_shapes_and_preserves_unknown():
@@ -35,7 +35,7 @@ def test_synthesizes_data_scope_from_order_id_argument():
3535
"name": "execute_tool",
3636
"attributes": {
3737
"gen_ai.operation.name": "execute_tool",
38-
"gen_ai.tool.name": "acme_lookup_order",
38+
"gen_ai.tool.name": "acme_get_order",
3939
"gen_ai.tool.call.arguments": '{"order_id": "ACME-1001"}',
4040
},
4141
}
@@ -66,7 +66,7 @@ def test_explicit_data_scope_attribute_wins_over_synthesis():
6666
"name": "execute_tool",
6767
"attributes": {
6868
"gen_ai.operation.name": "execute_tool",
69-
"gen_ai.tool.name": "acme_lookup_order",
69+
"gen_ai.tool.name": "acme_get_order",
7070
"gen_ai.tool.call.arguments": '{"order_id": "ACME-1001"}',
7171
"data_scope": ["order:ACME-9999"],
7272
},

‎docs/agentic-demo-realism-plan.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The current eight scenario fixture `infra/fixtures/agentic_scenarios.py` (64 KB)
88

99
Review-visible inconsistencies and risks:
1010

11-
1. Current `acme_lookup_order` fixture recognizes only `ACME-1001`..`ACME-1004`; ACME-1001 is marked **Delivered** 2026-01-02, but A01's frozen reference outcome says “shipped/in-transit”. A03's `max_tool_calls=0` knowingly makes the task impossible; A05 forbids normal inference→tool execution; A06 forbids normal runtime built-ins without a scenario-specific security reason. These are poor default exemplars.
11+
1. Current `acme_get_order` fixture recognizes only `ACME-1001`..`ACME-1004`; ACME-1001 is marked **Delivered** 2026-01-02, but A01's frozen reference outcome says “shipped/in-transit”. A03's `max_tool_calls=0` knowingly makes the task impossible; A05 forbids normal inference→tool execution; A06 forbids normal runtime built-ins without a scenario-specific security reason. These are poor default exemplars.
1212
2. `audits/agentic/schema_v2.py` requires `trace`, `tools`, `retrieval`, `trajectory`, `enforcement` even for tests that do not use tools or retrieval; template generator populates dozens of dormant fields. Relax *optional* sections with explicit defaults in checker code, without silently converting a requested assertion into an empty one.
1313
3. `audits/agentic/orchestrator.py` computes the final verdict immediately from deterministic check outcomes; it constructs `judge_extension` and `composed_judge` but does not actually run the semantic judge or pass `semantic_fail` into `compute_overall_verdict`. `infra/worker.py` feeds `normalize((target.judgment or {}).get('evidence_spans', []))` to evaluation, rather than necessarily using the full auditable target trace. Do not claim the semantic scenario is gating or all recorded activities are covered until wired/verified.
1414
4. `audits/agentic/checks/retrieval.py` contains heuristic source attribution when the agent snapshot has a single KB. A trace can prove that a retrieval call occurred, yet not necessarily which source was used. Attribute a source only with observable KB/file IDs; otherwise mark its identity unknown and the requirement INCONCLUSIVE.
@@ -30,7 +30,7 @@ Support Refund Assistant (Studio Agent and synchronized OWUI workspace model)
3030
│ └── identity_and_order_visibility.md
3131
├── OpenWebUI Knowledge Base: Acme Fulfilment [new]
3232
│ └── tracking_event_guide.md
33-
├── OpenWebUI Tool: acme_lookup_order [already seeded]
33+
├── OpenWebUI Tool: acme_get_order [already seeded]
3434
├── OpenWebUI Tool: acme_get_tracking_events [new; read-only]
3535
├── OpenWebUI Tool: acme_check_return_eligibility [new; read-only; deterministic]
3636
├── OpenWebUI Tool: acme_get_return_case [new; read-only]

0 commit comments

Comments
 (0)