Skip to content

Commit 7656448

Browse files
authored
feat(queue): parked review items get inventory and bounded reconciliation (#1111)
Review items parked as review_retry_exhausted had no operator surface: after three automatic recoveries they parked forever unless a fresh GitHub event arrived, invisible behind a bare counter -- 46 undelivered reviews sat frozen while the publication dead-letter store had list, recover, resolve, and a scheduled reconciler. Parked review items now get the same treatment, mirroring the DLQ operator pattern: a signed bounded inventory route; reconciliation that supersedes items whose GitHub target is terminal (never re-reviewing closed work) and re-enqueues a capped number of open-target items as fresh reviews with the recovery budget reset (5 per pass -- re-reviews post public comments); idempotent recovery keys; wired into the scheduled dead-letter reconcile workflow behind the same deploy-sha guard, with the parked inventory uploaded alongside the DLQ artifact. Command-context records are excluded from mutation (inventory shows them flagged) using the queue's existing exactReviewQueueHasCommandContext predicate, matching the terminalization path's policy. Proof (docs/proof/parked-review-reconcile): the real Worker and Durable Object park an item by exhausting its budget through real routes, the inventory lists it, a terminal-target item resolves as superseded, an open-target item re-enters pending with its budget reset, replaying the same recovery key does not double-enqueue, and a command-context parked item (reached via the real legacy command intake route) is refused by both mutation routes. Verified in a Docker-backed Crabbox local-container on the reviewed head.
1 parent 51ac499 commit 7656448

12 files changed

Lines changed: 2134 additions & 32 deletions

‎.github/workflows/exact-review-dead-letter-reconcile.yml‎

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ jobs:
3838
env:
3939
EXACT_REVIEW_QUEUE_URL: ${{ vars.CLAWSWEEPER_EXACT_REVIEW_QUEUE_URL || 'https://clawsweeper.openclaw.ai' }}
4040
steps:
41+
- name: Establish reconciliation deadline
42+
run: |
43+
deadline_ms="$(( $(date +%s) * 1000 + 13 * 60 * 1000 ))"
44+
echo "EXACT_REVIEW_RECONCILE_DEADLINE_MS=$deadline_ms" >> "$GITHUB_ENV"
45+
4146
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
4247
with:
4348
ref: main
@@ -49,13 +54,7 @@ jobs:
4954
with:
5055
node-version: "24"
5156

52-
- name: Reconcile closed, duplicate, and recoverable dead letters
53-
env:
54-
CLAWSWEEPER_WEBHOOK_SECRET: ${{ secrets.EXACT_REVIEW_OPERATOR_SECRET }}
55-
GITHUB_TOKEN: ${{ github.token }}
56-
MAX_TARGETS: ${{ github.event.inputs.max_targets || '100' }}
57-
MAX_RECOVERIES: ${{ github.event.inputs.max_recoveries || '10' }}
58-
EXECUTE: ${{ github.event_name == 'schedule' && 'true' || github.event.inputs.execute }}
57+
- name: Verify live recovery guards
5958
run: |
6059
set -euo pipefail
6160
expected_deploy_sha="$(git rev-parse HEAD)"
@@ -73,6 +72,16 @@ jobs:
7372
exit 1
7473
fi
7574
fi
75+
76+
- name: Reconcile closed, duplicate, and recoverable dead letters
77+
env:
78+
CLAWSWEEPER_WEBHOOK_SECRET: ${{ secrets.EXACT_REVIEW_OPERATOR_SECRET }}
79+
GITHUB_TOKEN: ${{ github.token }}
80+
MAX_TARGETS: ${{ github.event.inputs.max_targets || '100' }}
81+
MAX_RECOVERIES: ${{ github.event.inputs.max_recoveries || '10' }}
82+
EXECUTE: ${{ github.event_name == 'schedule' && 'true' || github.event.inputs.execute }}
83+
run: |
84+
set -euo pipefail
7685
args=(
7786
--action reconcile
7887
--max-targets "$MAX_TARGETS"
@@ -84,12 +93,33 @@ jobs:
8493
fi
8594
node scripts/exact-review-dead-letter-operator.mjs "${args[@]}"
8695
96+
- name: Reconcile terminal and open parked reviews
97+
env:
98+
CLAWSWEEPER_WEBHOOK_SECRET: ${{ secrets.EXACT_REVIEW_OPERATOR_SECRET }}
99+
GITHUB_TOKEN: ${{ github.token }}
100+
MAX_TARGETS: ${{ github.event.inputs.max_targets || '100' }}
101+
EXECUTE: ${{ github.event_name == 'schedule' && 'true' || github.event.inputs.execute }}
102+
run: |
103+
set -euo pipefail
104+
args=(
105+
--action reconcile-parked
106+
--max-targets "$MAX_TARGETS"
107+
--max-recoveries 5
108+
--output .artifacts/exact-review-dlq/parked-reviews.json
109+
)
110+
if [[ "$EXECUTE" == "true" ]]; then
111+
args+=(--execute)
112+
fi
113+
node scripts/exact-review-dead-letter-operator.mjs "${args[@]}"
114+
87115
- name: Upload sanitized inventory
88116
if: always()
89117
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
90118
with:
91119
name: exact-review-dlq-reconcile-${{ github.run_id }}-${{ github.run_attempt }}
92-
path: .artifacts/exact-review-dlq/inventory.json
120+
path: |
121+
.artifacts/exact-review-dlq/inventory.json
122+
.artifacts/exact-review-dlq/parked-reviews.json
93123
include-hidden-files: true
94124
if-no-files-found: error
95125
retention-days: 14

0 commit comments

Comments
 (0)