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

Function normalize_stop_raw

atomic-agent/src/hooks/agy.rs:391–410  ·  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

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