Incident Response
Procedures that exist as real endpoints/artifacts — plus manual gaps. Do not blindly retry a refund after a timeout: the PG operation may already have succeeded. Confirm provider state and internal records first.
Recon runbook (integrity drift)
POST /api/v1/admin/reconciliation/run # admin
GET /api/v1/admin/reconciliation/reports # list runs
GET /api/v1/admin/reconciliation/report/:id2
3
For each finding:
- Read the finding type — the engine runs 9 checks (see financial-integrity); the original 7 finding types are enumerated in Reconciliation, and the S2-02 additions (
settlement_membership,post_settlement_refund,settlement_fee_mismatch,settlement_run_mismatch, payments-orphan underreference_integrity) are in reconciliation-runbook. auto_fixeditems — stale inbox/outbox leases only; verify the follow-on effect (re-delivered? still failing?) and move on.needs_reviewitems — money/entitlement drift:paid_no_entitlement→ issue or attach the missing license, or refund.unpaid_but_entitled→ collect payment or revoke the license.refunded_but_valid_entitlement→ revoke the license (PATCH /licenses/:id {"status":"revoked"}).subscription_expired_but_renewed→ inspect the renewal order; restore or unwind.duplicate_issuance_per_payment→ keep one license, revoke the rest.dead_letter/aged outbox → checkOUTBOX_SINK_URLreachability, then let the lease-recovery path or a manual redrive handle it.
- Record the decision — there is no auto-resolution workflow; findings stay
needs_reviewuntil an operator acts (no SLA/owner — limitations §4.14–4.15).
Refund incident path
POST /api/v1/orders/:id/refund # seller-owner
{ "amount_krw": 5000, "reason": "…" } # amount optional → full remaining
GET /api/v1/orders/:id/refund-attempts # audit trail2
3
status:'succeeded'— done; ledger + license compensation applied.status:'failed'— readerror_json(e.g.NO_PAYMENT_KEY,PAYMENT_KEY_INVALID, PG error); investigate the failure, verify with the PG whether a cancel occurred, and only then decide whether a new refund is permitted. Pre-recording alone does not guarantee safe retries.status:'needs_review'— the PG call's outcome was uncertain; the attempt was deliberately not marked refunded. Verify against the PG console, then compensate manually. There is no sweeper — this waits for you.
License compromise path
PATCH /api/v1/licenses/:id {"status":"revoked"}— effective on the next guarded call (live-row re-query).GET /api/v1/security-events?lic_id=— look for replay (jtireuse),jktanomalies,license_blockedbursts.GET /api/v1/licenses/:id/bindings+/usage— enumerate bound devices and executions for the report.- If keys rotated as part of response: it is a hard cutover — in-flight entitlements die at 401 within 120 s; tell affected sellers to re-activate.
Payment rail incident
- Webhook storm / invalid signatures — bodies are never trusted; check
TOSS webhook secretconfig before assuming an attack. 402 NOT_LIVE_PAYMENTsurfacing — config drift:PAYMENT_LIVE_ENABLEDor provider mismatch.503 PAYMENT_PROVIDER_UNAVAILABLE— Portone is unimplemented; a request hit it anyway.
Escalation boundaries
- Real PG disputes/legal items are out of platform scope — external dependencies are tracked in limitations §2.
- Never run destructive ops (D1 reset, seed, rollback) without explicit authorization — charter-gated.
Severity & escalation model (S2-07 contract)
Operational response tiers for reconciliation findings/exceptions. These are PROPOSED response targets, not SLAs — no paging channel, auto-block, or timer enforcement exists yet (see "Alert channel status" below). The tier is derived from fields already exposed by the admin API: an exception's check_name + severity (+ entity_type/entity_id for routing), and a run's status.
The stored reconciliation_exceptions.severity (low|medium|high; critical reserved, unused) is an engine heuristic — auto_fixed findings are low, money-ledger/stale-refund checks are high, the rest medium. The P-tier below is the operational class, not a rename of that column.
| Tier | Meaning | Checks / signals | Stored severity | Responder | State semantics |
|---|---|---|---|---|---|
| P0 | Money duplication/loss; entitlement or authorization-integrity risk | capture_consistency, refund_consistency, net_amount, ledger_uniqueness, entitlement (all codes: paid_no_entitlement, unpaid_but_entitled, refunded_but_valid_entitlement, duplicate_issuance_per_payment, subscription_expired_but_renewed) | high (money checks) / medium (entitlement) | On-call operator + PM escalation | OPEN → TRIAGED immediately. Proposed policy: pause risky downstream work (e.g. settlement mark-paid on the affected scope) until triaged — no automatic block is implemented; rely on existing fail-closed invariants + operator judgment. |
| P1 | Long-unconfirmed refund, stuck settlement run, delivery failure, recon coverage outage | refund_attempt_liveness (stale_refund_attempt), settlement_consistency (sum mismatches), event_processing (dead_letter, unprocessed inbox), reference_integrity; summary.stale_settlement_runs > 0, summary.run_tag_claims > 0; ≥3 consecutive failed/degraded recon runs | high (stale_refund_attempt) / medium (others) | Ops on duty — target first response within 1 ops-hour | TRIAGED within target; drive a recovery op (financial-integrity) |
| P2 | Transient/self-healing — recheck next cycle | auto_fixed findings (stale outbox/inbox lease, orphan settlement claim → severity='low'); a single failed/degraded run (no streak) | low | Next scheduled recon cycle | Watch occurrence_count; escalate to P1 if the fingerprint re-opens or repeats |
| P3 | Observable growth trend | Rising open_exceptions_by_severity, occurrence_count growth, growing dead-letter backlog | any | Daily review of /financial-integrity/summary | Note-only; no state change required |
Implemented in s2-02 (e6a05cf, emitted by settlement_consistency): settlement_membership, settlement_run_mismatch, post_settlement_refund, settlement_fee_mismatch → P1 per the table above (a fee-mismatch that survives to mark-paid should be re-classed P0).
Alert criteria & channel status
- IMPLEMENTED (evidence only):
audit.rs::scheduled_assurancecounts consecutive terminalfailed/degradedrecon runs (arunningrun neither breaks nor extends the streak). At ≥3 consecutive, it emits analert:recon_failuresaudit_evidencerecord — chain-sealed (v2 HMAC), re-emitted only when the streak grows. Payload contract:{consecutive_failures:int≥3, threshold:3, note:"external notification PLANNED — audit record only"}; refs:{run_ids:["rec_…",…]}. - NOT WIRED: There is no external notification channel (no email/Slack/webhook). The "operator notification" today is the evidence record itself, readable via
GET /api/v1/admin/audit/evidence?event_type=alert:recon_failures(admin) — that endpoint is the mock alert-consumer contract. End-to-end channel delivery is S3 verification scope; locally it is verified evidence-only (tests/run-alerts.sh,alerts.test.mjs). alert:evidence_gaps(IMPLEMENTED, s2-101daf526, evidence only):scheduled_assurancealso folds sealed-without-evidence / burned-sequence emit residue into a chain-sealedalert:evidence_gapsrecord — readable on the same admin evidence endpoint. External delivery remainsPLANNED.- P0 immediate notify — PROPOSED, not implemented: nothing pages on a new P0 exception today; the escalation target above is the documented intent pending a channel.
- Contract test coverage:
be-cloudflare/tests/run-alerts.sh(alerts.test.mjs) — Phase A verifies the severity-field contract on seeded drift, Phase B drives 3 realfailedruns via theNOUGAT_FI=audit.prev_hashprobe and asserts the evidence + consumer-read contract.
Runbook links by tier
| Signal | Runbook |
|---|---|
| Any exception state machine / recon run | reconciliation-runbook, financial-integrity |
refund_attempt_liveness, refund drift | refund-recovery |
settlement_consistency, stuck/run:* runs | settlement-recovery |
alert:recon_failures, chain health, checkpoints | audit-evidence |
Financial-integrity incidents
Order of evidence: GET /api/v1/admin/financial-integrity/summary → exception detail (with event log) → recovery op lifecycle → audit_evidence rows → GET /api/v1/admin/audit/v2/verify (chain health).
| Symptom | First moves |
|---|---|
AUDIT_KEY_MISSING errors (500 on checkout/refund/settle/ops in prod) | NOUGAT_AUDIT_HMAC_KEY secret is not bound — audit v2 is failing closed by design. Restore the secret binding; do NOT downgrade the error. Non-prod emits nothing (no degraded rows). |
ok:false on /admin/audit/v2/verify | first_mismatch names the first tampered/rewritten row; link_breaks counts broken explicit links; sequence_gaps counts burned sequences (crashed writer, not necessarily tampering). Preserve the DB — this is evidence, do not repair in place. |
Run stays running / degraded | Check heartbeat_at; a stale run is reaped to failed by the next recon. degraded = some check ERROR/INCOMPLETE — partial coverage, not green. |
| ≥3 consecutive failed/incomplete runs | alert:recon_failures evidence exists in audit_evidence (external paging is PLANNED) — treat as recon-outage incident. |
alert:evidence_gaps evidence appears (s2-10) | Emit residue detected — sealed events without audit_evidence rows or burned v2 sequences. Check whether a writer crashed mid-emit; the residue is also visible via verify's evidence_coverage/sequence_gaps fields. Do not rewrite history — investigate the gap, don't repair in place. |
401 WEBHOOK_STALE on webhooks (s2-10) | tosspayments-webhook-transmission-time outside ±600 s — expected for replays/clock skew; legitimate fresh events still process. Gate applies only when TOSS_WEBHOOK_SECRET is set. |
Op stuck EXECUTING with no receipt (s2-10) | Verify converges it once stale (>10 min): VERIFIED if the effect is observed, FAILED + explicit reason otherwise. Fresh EXECUTING (<10 min) may still be executing — do not force-verify. |
Exception REOPENED after RESOLVED | The fingerprint re-appeared — the fix did not address the root cause; resume from TRIAGED, don't re-close. |
Op FAILED during verify | Read verification_json.verification.note — it states the unmet expectation; fix the target state, then create a new op (FAILED is terminal). |
Full surface: financial-integrity · reconciliation · refund · settlement · audit-evidence.