review: native tool-round delivery is its own execution kind on the wire

The public execution wire projected a native inspection episode as a plain
"api" execution, so the owner could not tell a review that retrieved the
subject itself from a packet review on the same model. Project it as kind
"native" (the actor usage's delivery fact, still requiring a real receipt),
keep it distinct in the wire identity, and render it in the Review checkpoint
as the API channel labelled "API · native tool rounds" — never null.
This commit is contained in:
Ouroboros 2026-09-02 03:01:22 +00:00
parent 6ace1a1f5a
commit 4c4d60598f
6 changed files with 41 additions and 5 deletions

View file

@ -89,7 +89,7 @@ def normalize_review_executions(value: Any) -> List[Dict[str, str]]:
if not isinstance(item, dict):
continue
kind = str(item.get("kind") or "").strip().lower()
if kind not in {"api", "harness"}:
if kind not in {"api", "harness", "native"}:
continue
harness_id = str(item.get("harness_id") or "").strip() if kind == "harness" else ""
model = str(item.get("model") or "").strip()
@ -121,7 +121,14 @@ def review_executions_from_actor_usage(actors: Any) -> List[Dict[str, str]]:
**({"model": model} if model else {}),
})
elif _has_api_execution_receipt(usage):
executions.append({"kind": "api", **({"model": model} if model else {})})
# The native tool-round episode is an API execution with a
# different DELIVERY (the reviewer retrieved the subject itself);
# the wire says so, or the owner reads a retrieving review as a
# packet review.
native = str(usage.get("delivery") or "") == "native_tool_rounds"
executions.append({
"kind": "native" if native else "api", **({"model": model} if model else {}),
})
return normalize_review_executions(executions)

View file

@ -44,6 +44,25 @@ def test_execution_wire_uses_returned_usage_only_and_allowlists_fields():
]) == [{"kind": "api", "model": "m"}]
def test_native_tool_round_delivery_is_its_own_execution_kind():
"""A native episode is an API execution with a different DELIVERY; the
public wire says so (kind ``native``), and the identity keeps it distinct
from a packet execution on the same model."""
actors = [
{"usage": {"provider": "openai", "resolved_model": "gpt-5.6-sol", "cost": 0.4,
"delivery": "native_tool_rounds", "native_rounds": 7}},
{"usage": {"provider": "openai", "resolved_model": "gpt-5.6-sol", "cost": 0.2}},
{"usage": {"delivery": "native_tool_rounds"}}, # no receipt: no execution
]
assert review_executions_from_actor_usage(actors) == [
{"kind": "native", "model": "gpt-5.6-sol"},
{"kind": "api", "model": "gpt-5.6-sol"},
]
assert normalize_review_executions([
{"kind": "native", "model": "m", "native_rounds": 7},
]) == [{"kind": "native", "model": "m"}]
def test_empty_receipt_placeholders_do_not_mint_api_execution_badges():
assert review_executions_from_actor_usage([
{"usage": {"ledger_attempt_ids": []}},

View file

@ -39,7 +39,7 @@ export const GENERIC_HARNESS_MARK = Object.freeze({
});
const GENERIC_LABELS = Object.freeze({ agy: 'Antigravity' });
const API_IDS = new Set(['api', 'api_chat', 'api_model']);
const API_IDS = new Set(['api', 'api_chat', 'api_model', 'native']);
/** Return presentation facts only; callers retain status and evidence ownership. */
export function harnessPresentation(harnessId, { label = '', channel = '' } = {}) {

View file

@ -1192,13 +1192,13 @@ export function reviewExecutionEvidence(execution) {
if (!executed || typeof executed !== 'object') return null;
const kind = text(executed.kind || executed.route_kind || executed.channel).toLowerCase();
const harness = text(executed.harness_id || executed.harness);
const api = ['api', 'api_chat', 'api_model'].includes(kind);
const api = ['api', 'api_chat', 'api_model', 'native'].includes(kind);
const harnessReceipt = kind === 'harness' || kind === 'agent_session' || (wrapped && Boolean(harness));
if (!api && (!harnessReceipt || !harness)) return null;
return {
harness: api ? 'api' : harness,
channel: api ? 'api' : '',
label: text(executed.label),
label: kind === 'native' ? 'API · native tool rounds' : text(executed.label),
model: text(executed.model || executed.model_id),
};
}

View file

@ -93,6 +93,10 @@ test('direct API is a neutral channel presentation, never a harness identity', (
const html = harnessIdentityMarkup('api_model');
assert.match(html, /data-presentation-kind="channel"/);
assert.match(html, />API<\/span>/);
const native = harnessPresentation('native', { label: 'API · native tool rounds' });
assert.deepEqual({ kind: native.kind, harnessId: native.harnessId, label: native.label }, {
kind: 'channel', harnessId: null, label: 'API · native tool rounds',
});
});
test('Chat renders the executor evidence chip through the shared identity SSOT', () => {

View file

@ -1026,6 +1026,12 @@ test('attempt marks require explicit executed receipts, render every production
const api = reviewExecutionEvidence({ executed: { kind: 'api_chat', model: 'openai\/gpt' } });
assert.deepEqual(api, { harness: 'api', channel: 'api', label: '', model: 'openai\/gpt' });
// A native tool-round episode renders as the API channel with its delivery named — never null.
const native = reviewExecutionEvidence({ kind: 'native', model: 'openai/gpt' });
assert.deepEqual(native, { harness: 'api', channel: 'api', label: 'API · native tool rounds', model: 'openai/gpt' });
assert.equal(reviewExecutionEvidenceList([
{ kind: 'native', model: 'openai/gpt' }, { kind: 'api', model: 'openai/gpt' },
]).length, 2);
});
test('attempt provenance stays per attempt and is promoted to group only when uniform', () => {