MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / normalize_stop_raw

Function normalize_stop_raw

atomic-agent/src/hooks/agy.rs:394–413  ·  view source on GitHub ↗

Map Antigravity's `terminationReason` onto the `finish_reason` field used by the record pipeline (mirrors the Codex adapter's stop normalization).

(mut raw: Value)

Source from the content-addressed store, hash-verified

392/// Map Antigravity's `terminationReason` onto the `finish_reason` field used
393/// by the record pipeline (mirrors the Codex adapter's stop normalization).
394fn normalize_stop_raw(mut raw: Value) -> Value {
395 let reason = raw
396 .get("terminationReason")
397 .and_then(Value::as_str)
398 .map(|s| s.to_string());
399
400 if let Some(reason) = reason {
401 let finish_reason = match reason.as_str() {
402 "model_stop" => "stop",
403 "max_steps_exceeded" => "length",
404 other => other,
405 };
406 if let Some(obj) = raw.as_object_mut() {
407 obj.entry("finish_reason".to_string())
408 .or_insert_with(|| Value::String(finish_reason.to_string()));
409 }
410 }
411
412 raw
413}
414
415/// Map Antigravity's `error` field onto the `status` field the provenance
416/// accumulator reads for tool calls.

Callers 1

parse_eventMethod · 0.70

Calls 2

getMethod · 0.65
as_strMethod · 0.45

Tested by

no test coverage detected