diff --git a/.kaizen/config.yml b/.kaizen/config.yml index 15dddf5..dc56b88 100644 --- a/.kaizen/config.yml +++ b/.kaizen/config.yml @@ -13,6 +13,9 @@ run: maxAttemptsPerIssue: 3 maxOpenPullRequests: 3 latestStartHour: 7 +safety: + # This repository is part of the maintainer-controlled Kaizen Agents dogfood fleet. + operationMode: dogfood scheduler: jobs: maintenance: @@ -86,6 +89,12 @@ report: issueComments: true issues: label: kaizen + selection: + # Public issue forms add only `kaizen`; a maintainer must queue execution. + mode: opt-in + includeLabel: kaizen:ready + excludeLabels: + - kaizen:needs-human priorityOrder: - kaizen:P0 - kaizen:P1 diff --git a/skills/pr-guardian/references/pr-feedback-audit.md b/skills/pr-guardian/references/pr-feedback-audit.md index 800c6ad..875a028 100644 --- a/skills/pr-guardian/references/pr-feedback-audit.md +++ b/skills/pr-guardian/references/pr-feedback-audit.md @@ -57,7 +57,19 @@ query($owner:String!, $name:String!, $number:Int!, $cursor:String) { if [[ -n "${cursor}" ]]; then args+=(-f "cursor=${cursor}") fi - page="$(gh "${args[@]}")" + if ! page="$(gh "${args[@]}")"; then + echo 'failed to fetch review threads' >&2 + exit 1 + fi + if ! jq -e ' + .data.repository.pullRequest.reviewThreads as $threads + | ($threads | type == "object") + and ($threads.nodes | type == "array") + and ($threads.pageInfo.hasNextPage | type == "boolean") + ' >/dev/null <<<"${page}"; then + echo 'reviewThreads returned an invalid or incomplete response' >&2 + exit 1 + fi jq -c '.data.repository.pullRequest.reviewThreads.nodes[]' <<<"${page}" if [[ "$(jq -r '.data.repository.pullRequest.reviewThreads.pageInfo.hasNextPage' <<<"${page}")" != true ]]; then break @@ -94,7 +106,19 @@ query($threadId:ID!, $cursor:String) { if [[ -n "${cursor}" ]]; then args+=(-f "cursor=${cursor}") fi - page="$(gh "${args[@]}")" + if ! page="$(gh "${args[@]}")"; then + echo 'failed to fetch review comments' >&2 + exit 1 + fi + if ! jq -e ' + .data.node.comments as $comments + | ($comments | type == "object") + and ($comments.nodes | type == "array") + and ($comments.pageInfo.hasNextPage | type == "boolean") + ' >/dev/null <<<"${page}"; then + echo 'review comments returned an invalid or incomplete response' >&2 + exit 1 + fi jq -c '.data.node.comments.nodes[]' <<<"${page}" if [[ "$(jq -r '.data.node.comments.pageInfo.hasNextPage' <<<"${page}")" != true ]]; then break