> 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/sfops/environments/review-environments/creation-and-allocation-of-review-sandboxes.md).

# Creation and Allocation of Review Sandboxes

The following high level view on how the review sandboxes are created and allocated to the sandbox pools

<figure><img src="/files/VConIQRnQR1ajOMQce2K" alt=""><figcaption><p>Asynchronous creation and allocation</p></figcaption></figure>

This section outlines the processes involved in the creation, allocation, and management of the lifecycle of Salesforce sandboxes, including conditions for expiry and deletion.

### Process Descriptions

### 1. Sandbox Creation (Review Sandbox - Creator)

The creation process can be initiated either by a scheduled cron job or by a manual trigger.

A predefined number of sandboxes are requested to be created, based on the count specified in the configuration settings. Post creation request, GitHub action variables are updated with sandbox details, marking them as "In Progress".

### 2. Sandbox Allocation and Expiry Check (Sandbox To Pool - Allocator)

This step can be started by a cron job or manually.

The system checks the status of sandboxes in DevHub marked "In Progress". If a sandbox is activated and ready, its status is updated to "Available" in GitHub.

**Expiry Eligibility Criteria**

The system evaluates "Available" sandboxes in GitHub to determine their eligibility for expiry based on the following rules:

1. **Unassigned Sandbox**: If a sandbox is not assigned an issue within 24 hours of its creation, it is eligible for expiry.
2. **Assigned Sandbox**:
   * If the sandbox has an issue assigned but is not extended, it becomes eligible for expiry 24 hours after the issue assignment.
   * If the sandbox is extended post-issue assignment, the expiry eligibility extends to 48 hours from the issue assignment time.

**Expiry and Deletion Process**

* Sandboxes meeting the above criteria are marked as "Expired".
* The system attempts to delete all "Expired" sandboxes.
* If deletion fails, the sandbox remains marked as "Expired" and will be re-attempted for deletion in the next run.
* Upon deletion attempt, whether successful or pending, GitHub action variables associated with the expired sandboxes are removed.

###


---

# 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/sfops/environments/review-environments/creation-and-allocation-of-review-sandboxes.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.
