Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/sweep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1672,12 +1672,16 @@ jobs:
NODE
)"
signature="$(PAYLOAD="$payload" node -e 'const crypto=require("node:crypto"); process.stdout.write(`sha256=${crypto.createHmac("sha256", process.env.CLAWSWEEPER_WEBHOOK_SECRET).update(process.env.PAYLOAD).digest("hex")}`)')"
curl --fail --silent --show-error --connect-timeout 5 --max-time 20 \
response="$(curl --fail --silent --show-error --connect-timeout 5 --max-time 20 \
--request POST \
--header "content-type: application/json" \
--header "x-clawsweeper-exact-review-signature: $signature" \
--data "$payload" \
"$queue_url/internal/exact-review/enqueue" | jq -e '.ok == true and (.queued == true or .deduped == true)'
"$queue_url/internal/exact-review/enqueue")"
jq -e '.ok == true and (.queued == true or .deduped == true or .shed == true)' <<< "$response" >/dev/null
if jq -e '.shed == true' <<< "$response" >/dev/null; then
echo "Source-drift recovery shed by exact-review queue backpressure."
fi

- name: Release terminal review leases
id: release-terminal-review-leases
Expand Down Expand Up @@ -3437,9 +3441,11 @@ jobs:
--header "x-clawsweeper-exact-review-signature: $signature" \
--data "$payload" \
"$queue_url/internal/exact-review/enqueue")" || response=""
if jq -e '.ok == true and (.queued == true or .deduped == true or .accepted == false)' <<<"$response" >/dev/null; then
if jq -e '.ok == true and (.queued == true or .deduped == true or .shed == true or .accepted == false)' <<<"$response" >/dev/null; then
if jq -e '.accepted == false' <<<"$response" >/dev/null; then
echo "Recovery skipped because the target is disabled."
elif jq -e '.shed == true' <<<"$response" >/dev/null; then
echo "Recovery shed by exact-review queue backpressure."
fi
queued=true
break
Expand Down
7 changes: 7 additions & 0 deletions dashboard/exact-review-health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export type ExactReviewHandoffHealth = {
capacity: number;
active: number;
available_slots: number;
pending_depth: number;
shed_since_reset: number;
phases: Record<ExactReviewPhase, ExactReviewPhaseSummary>;
};

Expand All @@ -47,16 +49,19 @@ export function summarizeExactReviewHandoff({
capacity,
dispatchLeaseMs,
executionLeaseMs,
shedSinceReset = 0,
}: {
items: ExactReviewHealthItem[];
dispatcher?: ExactReviewHealthDispatcher;
now?: number;
capacity: number;
dispatchLeaseMs: number;
executionLeaseMs: number;
shedSinceReset?: number;
}): ExactReviewHandoffHealth {
const safeNow = finiteTimestamp(now, Date.now());
const safeCapacity = Math.max(0, Math.floor(finiteNumber(capacity, 0)));
const safeShedSinceReset = Math.max(0, Math.floor(finiteNumber(shedSinceReset, 0)));
const safeLeaseMs = Math.max(1_000, finiteNumber(dispatchLeaseMs, 10 * 60_000));
const safeExecutionLeaseMs = Math.max(1_000, finiteNumber(executionLeaseMs, 130 * 60_000));
const warningMs = Math.min(2 * 60_000, Math.max(30_000, Math.floor(safeLeaseMs / 3)));
Expand Down Expand Up @@ -101,6 +106,8 @@ export function summarizeExactReviewHandoff({
capacity: safeCapacity,
active,
available_slots: Math.max(0, safeCapacity - active),
pending_depth: phases.pending.count,
shed_since_reset: safeShedSinceReset,
phases,
};
if (items.length === 0) {
Expand Down
Loading