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

Function normalize_stop_raw

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

1074/// Map Antigravity's `terminationReason` onto the `finish_reason` field used
1075/// by the record pipeline (mirrors the Codex adapter's stop normalization).
1076fn normalize_stop_raw(mut raw: Value) -> Value {
1077 let reason = raw
1078 .get("terminationReason")
1079 .and_then(Value::as_str)
1080 .map(|s| s.to_string());
1081
1082 if let Some(reason) = reason {
1083 let finish_reason = match reason.as_str() {
1084 "model_stop" => "stop",
1085 "max_steps_exceeded" => "length",
1086 other => other,
1087 };
1088 if let Some(obj) = raw.as_object_mut() {
1089 obj.entry("finish_reason".to_string())
1090 .or_insert_with(|| Value::String(finish_reason.to_string()));
1091 }
1092 }
1093
1094 raw
1095}
1096
1097/// Map Antigravity's `error` field onto the `status` field the provenance
1098/// 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