# Self-update rollback

## Post-rollback diagnosis

| Aspect | Rule |
| --- | --- |
| Job | One read-only Job in the original session, created by the restored worker, with the approved model and profile. Reports a cause and corrections. |
| Cannot | Edit source, run shell commands, install or authorize. Original verdicts stand. |
| Time | At most five minutes after rollback, shortened by an earlier approved deadline. Restart neither resets it nor repeats a terminal Job. |
| Stop | The Job cancel action or `self_update(action="cancel")`. A new update supersedes it. |
| Cannot run | Unavailable models or invalid evidence stop diagnosis without restricting the service. |
| Result | `diagnosis_result` in `self-update status --json`, when one exists. |

## Post-rollback source repair

| Aspect | Rule |
| --- | --- |
| Approval | Initial approval covers isolated repair and the listed `required_tests`. Default mode needs separate approval before another installation; explicitly approved `bounded_auto` permits later installations within its limits. |
| Trigger | An implementation or test diagnosis can start one read-only model Job proposing text edits. |
| Applying | The controller validates each edit, creates a new linked worktree and commit, and runs the frozen tests in a native sandbox with no network or App write access. Your worktree is unchanged. |
| Scope | The original changed files, or `bounded_auto`'s approved patterns. Files your candidate changed and the repair leaves alone stay as approved. |
| Never edited automatically | Protected runtime, approval, installer, dependency and Git files. Invalid paths or non-unique old text stop repair. |
| Time | Repair and tests share at most ten minutes after rollback, shortened by an earlier deadline. A new update, cancellation or expiry stops them. Restart replays nothing. |
| Cancel | The Job cancel action during the model; `self_update(action="cancel", update_id=…)` in the original conversation for tests. Failed worktrees and evidence stay for inspection. |

| Repair state | Meaning |
| --- | --- |
| `candidate_ready` | New commit and all configured tests passed |
| `awaiting_tests` | No required tests were configured; cannot be retried, start a new owner request with explicit tests |
| `failed` | Missing or failed tests, or source drift |
| `cancelled`, `expired` | Cancellation or expiry |

None of these means installed. Requests from before these stages keep their old behavior and do not gain them.

## Retry and iteration

| Aspect | Rule |
| --- | --- |
| `retry` | `self_update(action="retry", update_id, candidate_sha)` from any of the owner's conversations. In a mode that asks, approval shows SHA, changed paths, tests and remaining budget. Git contents and test logs are rechecked afterward; a change invalidates submission. |
| `bounded_auto` | Needs a future total `deadline`, allowed path patterns and non-empty `required_tests`. Only requests with the frozen iteration authorization submit automatically; the mode field alone grants nothing. |
| Attempts | At most three counting the first. Reserving a child consumes one, even if submission fails. Each child keeps goal, assertions, source baseline, model, profile and policy. Restart reuses the same child and deadline. |
| Cancel | Stops the sequence, including pending approval, diagnosis, repair and tests. A child already activating or verifying finishes its transaction or safe rollback, and no further attempt follows. Unrelated Jobs are untouched. |
| Status | The `iteration` section shows root, parent, attempt limits, deadline and submission status. `submitted` means handed to the external supervisor; the child still goes through packaging, system checks, a new verification Job, and commit or rollback. |

[Update from chat](https://fzkuji.github.io/OpenProgram/docs/install/conversational-self-update.html)
