# Runbook Commands are for the container (the Space's terminal, `docker compose exec app ...` in Compose, or a local run). `python -m coworker ` is the CLI. ## Daily checks 1. `/api/ready` answers `"ready": true`. 2. Settings > Storage and backups shows "Backups are working" and a recent save (hosts without a disk). 3. The runner's `https:///healthz` answers `"ok": true`, `"automation": true`, `"cases": true`, and the `version` is the commit the Space runs. 4. Home: nothing unexpectedly "Waiting for you"; Settings > Schedules: no "The last start failed". ## Before every deploy or restart A deploy or restart of the Space interrupts a running test run and loses anything not saved yet. Check right before, not an hour before. 1. **No active work.** No run is running or queued (`GET /api/runs?status=running`, `?status=queued`), no pod is reading its screens, and the runner's `/healthz` shows `"busy": false`. Wait for it to end, or cancel it. 2. **Save.** `POST /api/storage/save` as an administrator, and wait for the answer (`saved`, `last_saved_at`). 502 means the save failed: do not restart until it works. From the Space's terminal: `python -m coworker state push`. 3. **Deploy or restart.** 4. **Update the runner** on the commit just deployed: `deploy/runner/sync.sh https://`. It refuses while the runner is busy (exit 2); run it again when the run ends. 5. **Smoke test**: sign in, Test environments > Test connection, then a quick run on the Fusion pod. ## Incidents | Symptom | What to do | |---|---| | The app does not start; log says `error parsing value for field "X"` | Fix setting X (the message names it); restart. | | `/api/ready` is 503, `worker: false` | Restart the app (save first, above). Runs that were running become "interrupted": open each and press Resume. | | A pod card says "interrupted by a server restart: read the screens again" | The restart cut off a screen read. Press Read screens on the pod's card, or let the next run read them. | | A run stopped with "Pre-flight check failed, no browser was started" | Read the reason: the runner does not answer or has no scenario files (run `sync.sh`), or the test user cannot sign in. | | A run or screen read failed with "the remote browser runner refused ... (HTTP 409 ...)" | The runner was busy with another job (one at a time). Resume the run, or read the screens again, when `/healthz` shows `"busy": false`. | | A run failed with "The test browser stopped unexpectedly" | The browser host ran out of memory. Lower `FPT_FUSION_WORKERS`, run fewer areas at once, or give the runner more memory (REMOTE_RUNNER.md "Sizing"). | | A run says "N test invoices were left on the Oracle Fusion pod" | The automatic clean-up could not reach Fusion. Cancel those invoice numbers in Fusion (Payables > Manage Invoices). | | Test connection fails at "Sign-in" (HTTP 401) | The Fusion test user's password changed or the account is locked: fix it in Fusion, then Test environments > Sign-in details. Too many failed sign-ins lock Fusion users: do not retry in a loop. | | A schedule switched itself off | It failed 3 times in a row; the reason is on the schedule. Fix the cause and switch it on again. | | Someone must be stopped now | Settings > Emergency stop, or `python -m coworker kill --reason "..."`. Release with `unkill`. | | A person is locked out of sign-in | Wait 5 minutes, or an admin resets their password in Settings > Users. | | Suspected account compromise | Settings > Users: switch the account off (ends its sessions); rotate any secret it could see (SECURITY.md). | | The audit log may have been altered | `python -m coworker verify-audit` (or `/api/audit/verify`): reports the first broken link. | ## Backups **Host without a disk.** The app saves `state/latest.bin` to the bucket (OCI Object Storage when `OCI_STATE_PAR_URL` is set, else Supabase Storage): when the data changed, at most every `FPT_STATE_SYNC_INTERVAL` seconds (at least 300 on OCI); at once when a screen read finishes or a run waits for a person, ends or is cancelled; and on shutdown. The first save of each process keeps the archive it found as `state/previous.bin`, and every save also keeps a copy as `state/history/