> For the complete documentation index, see [llms.txt](https://docs.flxbl.io/flxbl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flxbl.io/flxbl/codev/pools/monitoring.md).

# Pool Monitoring and Health

<figure><img src="/files/pwVaSPGssRsysiWtVaOY" alt="Pool workflow runs"><figcaption><p>Workflow runs showing scheduled pool monitoring and provisioning tasks</p></figcaption></figure>

codev automatically monitors every pool on a recurring schedule. You do not need to set up cron jobs or run CLI commands — monitoring is built into the workflow engine and starts as soon as a pool is created.

## What monitoring does

Each monitoring cycle performs three operations:

### Reconciliation

codev checks every instance in the pool against Salesforce to make sure the local state matches reality. If an environment was deleted in Salesforce but still tracked in the pool, it is marked as orphaned. If an environment exists in Salesforce but is not tracked, it is discovered and added.

This prevents "ghost" environments from consuming your org limits and keeps the pool state accurate.

### Lifecycle management

codev processes lifecycle transitions for every instance:

* Environments past their expiration are marked expired
* Expired environments are handled according to the pool's expiration strategy (delete, refresh, flag, or notify)
* Environments that were refreshed are returned to the available pool

### Quota maintenance

If the number of available instances drops below the configured minimum, codev automatically provisions new environments to bring the pool back to capacity. For scratch org pools, this means cloning the repository and installing all packages. For sandbox pools, this means requesting new sandboxes from Salesforce.

## Viewing monitoring jobs

The **Monitoring** page (linked from the Pools page sidebar under RELATED) shows all active monitoring jobs. Each job runs on a recurring schedule — typically every 30 minutes — and can be paused or resumed.

## Inspecting a monitoring run

<figure><img src="/files/8bfRJYFkEnvsUqZY5W0i" alt="Pool monitoring job detail"><figcaption><p>Monitoring run detail showing pool inventory reconciliation and lifecycle actions</p></figcaption></figure>

Click into any monitoring run from the **Workflows > Runs** page to see exactly what happened. The execution log shows:

* **Pool inventory** — total instances, how many are available, assigned, provisioning, or in error state
* **Reconciliation results** — how many instances were checked against Salesforce, any orphaned or expired ones detected
* **Lifecycle actions** — what was expired, returned to pool, or cleaned up
* **Deficit** — whether the pool is below minimum capacity and needs provisioning

## Troubleshooting

If a pool is not replenishing or environments are stuck in a bad state, check the monitoring runs for errors. Common issues:

* **DevHub connection failed** — the DevHub credentials may have expired. Re-authenticate the DevHub in **Settings > Orgs**.
* **Instances marked orphaned** — the environment exists in the pool but not in Salesforce (or vice versa). The next monitoring cycle will attempt cleanup.
* **Provisioning stuck** — scratch org creation can take time depending on Salesforce infrastructure load. Check the provisioning workflow run for timeout errors.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.flxbl.io/flxbl/codev/pools/monitoring.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
