> ## Documentation Index
> Fetch the complete documentation index at: https://docs.p2hs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Codegen lifecycle

> Track planning, generation, validation, and revision output as a codegen run.

Codegen is an asynchronous project operation. The API exposes run creation, execution, cancellation, retry, user-input supply, status, timeline, and changes through the authenticated project workflow.

```mermaid theme={null}
stateDiagram-v2
  [*] --> created
  created --> waiting_for_input
  created --> running
  waiting_for_input --> running
  running --> succeeded
  running --> failed
  failed --> retrying
  retrying --> running
  running --> canceled
```

## What to monitor

* run status and timestamps;
* timeline events and requested inputs;
* capability approvals, if the run requires them;
* changes associated with the run or resulting revision;
* the preview result before deployment.

Heavy work is executed asynchronously so request handlers do not block on code generation, builds, or external retries.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.