Download docs/OPERATIONS.md from EnergyVenom/patchwise-agent-studio: direct link, hf CLI and curl.
- Browser
- Download file 10.4 kB
-
https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/docs/OPERATIONS.md
- Command line
-
hf download hf://spaces/EnergyVenom/patchwise-agent-studio/docs/OPERATIONS.md
-
curl -L -o OPERATIONS.md https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/docs/OPERATIONS.md
Operations
What an operator does to keep Astra healthy: the health check, what each failing line means, running a canary, deploying, rolling back, and the usual trouble. Incident tables and backups are in RUNBOOK.md; the runner is in REMOTE_RUNNER.md.
The health check
Settings > Health check (administrators) lists what a run needs. Press Check again after any fix. It is
read-only: it never signs in to the pod, sends nothing to it and changes nothing. The same list is
GET /api/admin/readiness (administrator token), which returns {ok, items: [{key, label, ok, detail, fix}]}: use it
from a monitor if you want an alert.
Run it:
- every morning, and before the first run of the day;
- before and after every deploy (below);
- when a run stops with "Pre-flight check failed".
What each check means
| Check | Not OK means | Fix |
|---|---|---|
| Browser runner reachable and free | The runner does not answer /healthz within 8 seconds, is not ready (no token or no test code, no scenario files), or is busy with another job. |
Unreachable or not ready: check the runner service (sudo systemctl status astra-runner on the runner), its token, then deploy/runner/sync.sh. Busy: wait for the job to end; a new run waits for it up to FPT_REMOTE_RUNNER_BUSY_WAIT_MINUTES. |
| App and runner on the same version | The runner runs another commit than the app, or does not say which. Scenarios and step code may differ. | deploy/runner/sync.sh on the commit the app runs (below). The check also shows OK, with a note, when the app did not record its commit (FPT_COMMIT): then nothing can be compared; set it. |
| Fusion pod registered and enabled | No Fusion pod, the pod is disabled, or it has no test user (or sign-in mode) yet. | Test environments: add or enable the pod and set its test user. |
| Pod sign-in checked | The last connection test failed, was never run, or is more than 24 hours old. | Test environments > Test connection. A failure at "Sign-in" (HTTP 401) is a changed or locked test user: see "Pod sign-in fails". |
| Pod test data for each area | An area of the pod has no test data: scenarios that need a value will fail. | Test environments > Discover business areas, or set the values on the pod. |
| Usage profile read | The usage was never read, or last read more than 30 days ago. | Test environments > Read usage (read-only). |
| Latest canary per area | No run has a canary result, the newest is older than 3 days, or a business action failed in it. | Run a canary (below). If an action failed, open that run's timeline: it names the action. |
| No stuck runs | A run has been running or waiting (approval, sign-in, review) for more than 6 hours without a change. | See "Stuck runs". |
| AI model configured | No model is connected: Astra works with built-in rules only. | Settings > AI models. |
| Kill switch off | The emergency stop is engaged: it refuses new runs and blocks all pod and runner traffic. | Settings > Emergency stop > Release (after you know why it was engaged: the reason is shown). |
| Disk space | Less than 1 GB free where Astra keeps its data. | See "Disk space". |
If the page itself fails for a group of checks, the line says "The check could not run": read the server log.
Running a canary
A canary is one cheap scenario per business area that runs each business action once (create invoice, validate, post journal, and so on). It runs first in every live Fusion run, and says which action broke before the rest of the run spends its time. To check a pod without a full run:
- Start a small live run on the Fusion pod with one scenario of each area you rely on.
- When it finishes, open the run's timeline and read the Canary line. A broken action blocks the scenarios that use it, and they are reported as "blocked by the canary: a script/UI change to maintain", not as product defects.
- Press Check again: Latest canary per area now shows the result and its age.
Do this after a runner update, a pod refresh or patch, and at least every few days. FPT_FUSION_CANARY=false turns the
canary off; then this check cannot turn green.
Deploying
Astra on OCI is two parts that must run the same commit: the app (a Docker container) and the browser runner.
- Check nothing is active. Run the health check: no stuck runs, runner free. Also check Home and
GET /api/runs?status=runningand?status=queued. A deploy or restart stops a running run and loses anything not saved.deploy/oci/update-app.shrefuses (exit 2) while the runner is busy, but a run that is only waiting for a person is not caught: look yourself. - Save the state:
POST /api/storage/saveas an administrator (orpython -m coworker state push) and wait for the answer. - Deploy the app from a clean, committed checkout:
deploy/oci/update-app.sh ubuntu@<server> <ssh key> https://<app address>. It builds the imageastra:<commit>, prints the previous image tag, swaps the container, records the commit inFPT_COMMITand checks/api/health. - Update the runner on the same commit:
deploy/runner/sync.sh ubuntu@<runner> <ssh key> https://<runner>. It refuses while the runner is busy (exit 2): run it again when the job ends. It checks that/healthzreports the new commit and"cases": true. - Check: open Settings > Health check. "App and runner on the same version" and "Browser runner reachable and free" must be OK. Then run a small live run and read its canary.
Hugging Face Space and Docker Compose installs follow "Before every deploy or restart" and "Upgrade and rollback" in RUNBOOK.md.
Rolling back
Use it when the new release fails its checks or a run breaks that worked before.
Find the previous image:
sudo docker images astraon the server (update-app.sh printed it as "previous image" at deploy time). Check first that no run is active (as in Deploying, step 1).Stop the new container and start the old image with the same settings and data:
sudo docker rm -f astra sudo sed -i "s/^FPT_COMMIT=.*/FPT_COMMIT=<previous commit>/" /etc/astra/app.env sudo docker run -d --name astra --restart unless-stopped -p 127.0.0.1:8800:8800 \ --env-file /etc/astra/app.env -v /home/ubuntu/astra-data:/data astra:<previous commit>Put the runner back on that commit too: check out the previous commit and run
deploy/runner/sync.shas above. (Running it again on a commit is safe; the old copy stays in~/astra.prevon the runner.)If the release added a database migration, the older app may not start on the migrated data: restore the backup taken before the upgrade (RUNBOOK.md, "Restore"). Migrations only add tables and columns, so an older app usually still starts.
Run the health check and a small run.
Stuck runs
The health check lists runs that have been running or waiting for more than 6 hours. Open each one:
- Waiting for approval, review or sign-in: it is waiting for a person. Give the answer, or cancel the run. An assisted sign-in expires; open the run and sign in again.
- Running, but the runner is idle: the app or the runner restarted under it. Press Resume: it follows the runner's job if it still exists, otherwise it fails that pass in seconds and says why.
- Running, and the runner is busy for hours: a pass has a time budget (REMOTE_RUNNER.md); wait for it, or cancel the run. Cancelling stops the job and keeps the list of test records it created for clean-up.
- After a cancel, check Fusion for test records left behind if the run says so (RUNBOOK.md).
A stuck run holds the runner: nothing else starts until it ends.
Pod sign-in fails
- Test environments > Test connection: the failing step and the HTTP status are shown.
- HTTP 401 at "Sign-in": the test user's password changed or the account is locked. Fix it in Fusion, then update the pod's sign-in details. Do not retry in a loop: repeated failures lock Fusion users.
- HTTP 403: the test user has no access to the area. Give it the roles.
- The address does not answer: the pod is down or in maintenance (Oracle patches test pods on a schedule). Wait, and check the pod's address and that it is a test pod (production addresses are refused).
- A pod behind SSO or multi-factor uses assisted sign-in: a person signs in on the run page at the start of each run. A run waits at "waiting for sign-in" until someone does (the health check counts that wait as a stuck run after 6 hours).
- Press Test connection again, then Check again on the health check.
Disk space
Astra keeps its data (database, run folders, evidence) under its data folder (FPT_HOME, /home/ubuntu/astra-data on
OCI). The health check turns red below 1 GB free.
- Look at Settings > Storage and backups for what takes the room (database, checkpoints, runs, evidence).
python -m coworker purgeruns the retention clean-up now: evidence afterEVIDENCE_RETENTION_DAYS(30), checkpoints of finished runs after 7 days, run folders after 90 days. Lower them for a small disk.- On OCI,
sudo docker image prune -fremoves unused images (keep the previous release's tag for rollback), andsudo journalctl --vacuum-size=200Mtrims system logs. - On the runner, job folders are deleted about 24 hours after they start (
RUNNER_KEEP_HOURS);df -hthere too. - Do not delete files by hand under the data folder while a run is active.
Where the logs are
| What | Where |
|---|---|
| App, OCI | sudo docker logs -f astra (JSON lines; every line has a request_id, also shown to the user on an error) |
| App, Docker Compose | docker compose logs -f app |
| App, any install | $FPT_HOME/logs/api.jsonl (rotated, 10 MB x 5) |
| Audit log (who did what) | Audit log page, or python -m coworker verify-audit to check it was not altered |
| A run | the run's timeline (every step and the canary), and its folder under the runs directory |
| Runner | sudo journalctl -u astra-runner -f on the runner; https://<runner>/healthz for its state and version |
| Health and metrics | /api/ready (503 when not ready), /api/metrics (Prometheus text, needs the metrics token) |
Errors can also go to Sentry (SENTRY_DSN); see DEPLOYMENT.md, "Monitoring".