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