Skip to main content

KB Pause / Reactivate Runbook

Pause an orgโ€‹

UPDATE organizations
SET metadata = metadata || jsonb_build_object(
'kb_paused', true,
'kb_paused_at', now()::text,
'kb_paused_by', '<actor>'
)
WHERE id = '<orgId>';

<actor> is the operator identifier, such as paul@humanity.org or ops-runbook. These audit fields mirror the application-code path at api/src/integrations/credentials/credentials.service.ts, so runbook pauses look identical to code pauses in observability.

Reactivate an orgโ€‹

UPDATE organizations
SET metadata = metadata || '{"kb_paused": false}'::jsonb
WHERE id = '<orgId>';

Endpoint behaviourโ€‹

KB upload returns HTTP 423 Locked with { "code": "HAYSTACK_PAUSED" }.

Retrieval returns:

{ "paused": true, "results": [], "total": 0 }

Automatic hooksโ€‹

Org deactivation sets kb_paused: true, kb_paused_at, and kb_paused_by. SuperAdmin org restore flips kb_paused to false while keeping the audit fields.

Verification SQLโ€‹

SELECT id, name,
metadata->>'kb_paused' AS paused,
metadata->>'kb_paused_at' AS paused_at,
metadata->>'kb_paused_by' AS paused_by
FROM organizations
WHERE metadata ? 'kb_paused';