# Runbook Commands are for the container (`docker compose exec app ...` in Compose; the Space's terminal or a local run otherwise). `python -m coworker ` is the CLI. ## Daily checks 1. `/api/ready` answers `"ready": true`. 2. Settings > Storage and backups shows "Backups are working" (hosts without a disk). 3. Home: nothing unexpectedly "Waiting for you"; Settings > Schedules: no "The last start failed". ## 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. Runs that were running become "interrupted": open each and press Resume. | | A run failed with "The test browser stopped unexpectedly" | The server ran out of memory. Run fewer business areas at once, or give the server more memory. | | 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 (Supabase).** The app saves `state/latest.bin` every 60 s and keeps `state/previous.bin` from the start of the current process. If a start-up restore fails, saving pauses (a notice in the app and `saved_state.paused` on `/api/ready`) so the good copy is not overwritten. - Status: `python -m coworker state status` - Save now: `python -m coworker state push` - **Restore**: stop the app; in the Supabase bucket copy `state/previous.bin` over `state/latest.bin` if the latest copy is bad; start the app with an empty data folder (a new container), which restores at start. **Compose.** `deploy/backup.sh /secure/backups`. Restore: stop the stack, put the archive's files back in the `fpt-data` volume, start the stack. Keep backup archives encrypted: they contain the secrets vault. ## Upgrade and rollback 1. Take a backup (above). 2. Deploy the new image or upload the new revision. Migrations run at start (forward-only). 3. Smoke test: sign in, Test environments > Test connection, start a quick simulation and approve it. 4. Rollback: deploy the previous image or Space revision; if the release added a migration, restore the backup first. ## Rotating secrets Change the value in the platform's secret store, then restart. Revoke the old key at its provider (NVIDIA, Hugging Face, Supabase). For the Fusion test user, change the password in Fusion first. `FPT_STATE_KEY` is special: the backup is encrypted with it. To change it, take `state push` with the old key, set the new key, restart, and confirm a new save; keep the old key until the new backup is confirmed. ## Retention Screenshots, videos and traces: `EVIDENCE_RETENTION_DAYS` (30). Workflow checkpoints of finished runs: `CHECKPOINT_RETENTION_DAYS` (7). Run folders: `RUN_FILES_RETENTION_DAYS` (90). Run records and the audit log are kept. The clean-up runs daily from the scheduler; `python -m coworker purge` runs it now.