Runbook: Appeals Reconciliation (receipts vs links, parked elections, un-receipted rep overturns)

The nightly scanner (services/canopy-appeals/src/reconcile.rs, advisory lock canopy-appeals.reconciliation) is the durable backstop the DLQ cannot be: it compares appeals' PERSISTED stay receipts against enrollment’s per-appeal links (GET /v1/adverse-actions/{id}/stays/{appeal_id}), flags CB elections parked in pending_stay past the operational SLA ([appeals].pending_stay_alert_hours, default 24), and (#1679) flags reversed rep_disqualification appeals whose hearing_overturned cancel never receipted, confirmed against canopy-applications (GET /v1/rep-disqualifications/{id}). It is report-only — structured ERROR logs plus the typed report from POST /v1/internal/appeals/reconcile. Remediation is yours — except the rep-overturn backlog, which the retry worker below works for you.

Running it on demand

# service-class token (any canopy service principal with appeals access)
curl -s -X POST -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' -d '{}' \
  "$APPEALS_URL/v1/internal/appeals/reconcile" | jq .

The report: receipts_checked, lingering_checked, findings[] (appeal_id, adverse_action_id, kind, detail), and skipped_unreachable (rows the sweep could not compare because enrollment — or, for the rep-overturn sweep, canopy-applications — was down — a non-zero value means re-run later, not all-clear).

Alert: lingering_stay

A withdrawn/decided appeal still holds a LIVE stay in enrollment — the #1099 fence-first paths commit the appeals-side transition first and command enrollment after (household-safe ordering), so a release/veto failing post-commit leaves exactly this state. Both sides agree the link is stayed, which is why this is its own lifecycle-vs-link sweep rather than a receipts-vs-links disagreement. The failing request was timeline-noted at the time (action_command_failed). The stay only DELAYS the action (household-safe), but it blocks enactment until cleared.

Remediation: re-issue the command the failed call would have made (idempotent, #1096) — release for a finalized withdrawal or an agency-favorable decision, veto for a reversal — using the curl below, then re-run the sweep.

The appeal’s cb_stay_link_status contradicts enrollment’s link (or no link exists). Known producers, most-likely first:

  1. The command landed but the receipt write-back failed — enrollment’s link moved (released/vetoed) and the appeals row never heard. A withdrawal finalization whose receipt write fails still answers 200 with the committed, withdrawn appeal and leaves exactly this residue (#2668).

  2. An out-of-band actor drove the link directly on enrollment (another appeal’s veto moots ALL links; operator surgery).

Remediation:

  • Read the appeal’s timeline (GET /v1/appeals/{id}) and the action (GET /v1/adverse-actions/{id}) — the pair tells you which side moved.

  • When the appeals row is stale (link legitimately moved on — producer 1) and the divergence is TERMINAL (the appeal is withdrawn or decided, enrollment’s link released or vetoed): the enrollment link is the ground truth for enactment gating, so nothing downstream is affected, but the scanner never mutates and nothing rewrites a terminal appeal’s receipt in the ordinary course, so the finding recurs every night until the receipt is re-recorded. Re-record enrollment’s link status as the receipt, as the failed write-back would have (the guards refuse a live appeal or a receipt that already moved):

    UPDATE appeal_requests
       SET cb_stay_link_status = '<enrollment link status>',
           cb_stay_receipt_at = now(), updated_at = now()
     WHERE id = '<appeal id>' AND active = true
       AND status IN ('withdrawn', 'decided')
       AND cb_stay_link_status IN ('stayed', 'restayed');

    Record what happened on the appeal’s timeline if the case narrative needs it.

  • link_missing with a recorded receipt means the link row is GONE on enrollment — that should be impossible outside operator surgery; treat as an incident and reconstruct from the two services' timelines/signals.

  • Re-run the sweep and confirm the finding clears.

The re-issue curl (used by the lingering_stay remediation above):

curl -s -X PUT -H "Authorization: Bearer $APPEALS_SVC_TOKEN" -H 'Content-Type: application/json' \
  -d '{"command":"release","actor":"runbook:appeals-reconciliation"}' \
  "$ENROLLMENT_URL/v1/adverse-actions/$ACTION_ID/stays/$APPEAL_ID"

Alert: pending_stay_past_sla

A household ELECTED continuation and the grant is still pending because the stay never landed — the retry worker (60s cadence) has been failing for at least the SLA window. The household’s legal position is elected-but-ungranted: fix this before the action’s enact_not_before arrives.

  1. Check enrollment health (/livez) and the appeals logs for the retry worker’s per-row error (pending-stay retry failed / enrollment unavailable for stay).

  2. If enrollment recovered, the next worker tick completes the grant — re-run the sweep to confirm.

  3. If the row references a dead action (cancelled/vetoed underneath the filing), the worker re-resolves it on its next successful contact; a row that STAYS parked after enrollment is healthy means the stay is being refused against a still-scheduled action — that is outside enrollment’s #1096 contract and warrants a bug report with both rows attached.

Alert: rep_overturn_unreceipted

A rep_disqualification appeal was decided for the household (reversed_household, or a Superior-Court reversed final decision) but the post-commit hearing_overturned cancel to canopy-applications never receipted — the appeal’s latest rep_overturn_* timeline event is rep_overturn_failed (applications was unreachable, or this instance had no ADR-019 service identity), or there is no overturn trail at all (the process died between the commit and the cancel). The sweep confirmed the bar is STILL standing upstream (GET /v1/rep-disqualifications/{id} is not overturned/cancelled) before flagging — a cancel that landed with a failed write-back reads overturned and is never a finding. The household won the hearing while its representative stays suspended: this is a rights defect, not a bookkeeping one.

What the retry worker does. rep_overturn_retry (services/canopy-appeals/src/rep_overturn_retry.rs, advisory lock canopy-appeals.rep-overturn-retry, 60 s cadence, 100 rows per tick) re-issues POST /v1/rep-disqualifications/{id}/cancel (reason = hearing_overturned + the appeal id) for every queued row and appends the outcome: rep_overturn_receipt on 2xx (suspensions restored, rescission letters staged upstream) or rep_overturn_refused on the idempotent 409 (the bar was already terminal — a supervisor beat it, or the write-back lagged; nothing is re-lettered). Either retires the row. A transport failure logs (applications unreachable for the overturn retry) and appends nothing, so an outage never floods the timeline; the standing rep_overturn_failed event keeps the row queued.

When to act by hand.

  1. Applications is healthy and the finding persists past two worker ticks (~2 min): the worker appends nothing when a retry gets no definitive answer, so the evidence is the finding’s detail plus the appeals logs — applications refused the overturn retry (WARN, carrying the HTTP status and body: the upstream is refusing the cancel; a 422 names the problem) versus applications unreachable for the overturn retry (INFO: transport — the next tick retries). A detail saying the record is NOT FOUND upstream (404) means the bar row is gone and the worker can never land it — treat as an incident and reconstruct from both services' timelines.

  2. This instance has no applications identity (rep_overturn_failed notes citing "no applications service identity configured"): neither the worker nor the sweep can act. Cancel the bar yourself — POST $APPLICATIONS_URL/v1/rep-disqualifications/$RECORD_ID/cancel with {"reason":"hearing_overturned","appeal_id":"$APPEAL_ID"} — and fix the identity. The call is idempotent (409 once terminal), so a duplicate is harmless; the row stays queued (never flagged, because the bar reads overturned) until the worker’s next 409 retires it once the identity is back.

  3. Never re-record the decision to "re-drive" the cancel — both decision writes are fenced one-shot and will refuse.

Alerts: wic_hold_command_overdue and wic_hold_on_terminal_appeal

Both concern the hearing hold on a WIC termination (#3387; canopy-appeals API) and are read from canopy-appeals's own rows.

wic_hold_command_overdue: a decided or withdrawn wic_termination appeal has owed canopy-wic a release or cancel for longer than [appeals].pending_stay_alert_hours. The hold retry re-sends every minute, so canopy-wic has been unreachable or refusing the whole time. An owed cancel means a household won its hearing and the termination still stands; nothing enacts a held termination, but one filed late has no hold, so treat an overdue cancel as urgent.

  1. Check canopy-wic's health and the appeals logs for WIC hold command not delivered (the cause is in the line).

  2. Once canopy-wic answers, the next retry pass clears the command; re-run the sweep to confirm.

  3. Never edit wic_hold_command by hand to clear the alert: the command is the only record that the call is still owed.

wic_hold_on_terminal_appeal: a decided or withdrawn appeal still reads held and owes nothing. No path leaves that state; it means a row was changed outside the handlers. Send the release through canopy-wic's hold route as canopy-appeals and correct the row, and report it.

Boundaries

  • The scanner bounds each sweep at 500 rows per pass (newest receipts first, newest terminal-stayed first, oldest parked first, least-recently-updated un-receipted overturn first) — a backlog larger than that surfaces over consecutive nights; a checked-count of 500 is the tell.

  • The scanner never mutates and publishes no events — the rep-overturn retry worker and the WIC hold retry are separate loops, each writing only its own timeline trail and (the hold retry) the owed-command columns; the appeal-side pipeline events (appeal.decision_recorded, appeal.withdrawal_finalized; #1102) are published by the decision and withdrawal-finalization paths, never by the scanner.

  • Without an applications identity the rep-overturn sweep reports nothing (it cannot confirm the bar’s state) and the worker is not spawned — the rep_overturn_failed note carries the manual remedy.

Edit this page · default