Handle resumable gmcli backfill coverage

This commit is contained in:
2026-07-12 13:45:09 -07:00
parent 26b84a28a4
commit c09892f842

View File

@@ -35,21 +35,29 @@
pass=1 pass=1
while ((pass <= 20)); do while ((pass <= 20)); do
echo "Starting gmcli deep-history pass $pass/20" echo "Starting gmcli deep-history pass $pass/20"
if result="$(${gmcliPackage}/bin/gmcli --json history backfill-all --requests 20 --count 100)"; then result="$(${gmcliPackage}/bin/gmcli --json history backfill-all --requests 20 --count 100)"
added="$(${pkgs.jq}/bin/jq -er '.messages_added' <<<"$result")" || { backfill_status=$?
echo "Unable to read messages_added from backfill result" >&2 metrics="$(${pkgs.jq}/bin/jq -er '[.messages_added, .failed, .needs_more] | @tsv' <<<"$result")" || {
echo "Unable to read coverage metrics from backfill result" >&2
status=1 status=1
break break
} }
echo "Deep-history pass $pass added $added message(s)" IFS=$'\t' read -r added failed needs_more <<<"$metrics"
if ((added == 0)); then echo "Deep-history pass $pass added $added message(s); $needs_more conversation(s) need more"
exhausted=1 if ((failed > 0)); then
echo "Deep-history pass failed for $failed conversation(s)" >&2
status=1
break break
fi fi
else if ((backfill_status != 0 && needs_more == 0)); then
echo "Deep-history command failed without resumable work" >&2
status=1 status=1
break break
fi fi
if ((needs_more == 0)); then
exhausted=1
break
fi
((pass++)) ((pass++))
done done
if ((status == 0 && exhausted == 0)); then if ((status == 0 && exhausted == 0)); then