# Development checkout

1. **Commit on dev**
2. `openprogram dev deploy`
3. **Development** port 18200 data `~/.openprogram-dev`

1. **GitHub Release**
2. Check for updates
3. **Stable, the official App** port 18100 data `~/.openprogram`

| Command | Effect |
| --- | --- |
| `openprogram dev deploy` (`[ref]` default `dev`) | Builds into `~/.openprogram-dev/runtime`; on macOS also updates `/Applications/OpenProgram Dev.app`. The stable App keeps running. |
| `openprogram dev open` | Opens it in the default browser, signed in. Each deploy signs browsers out again; OpenProgram Dev signs itself back in. |
| `openprogram dev copy-models` | Copies stable provider settings, API keys and CLI-delegated logins. OAuth logins are signed in separately. |
| `openprogram dev status` | The stable App's release, the development instance's commit, and the `dev` commits not deployed yet |

An Agent in the development instance does the same with `self_update(action="prepare")`: after the turn, the commit lands on `dev`, deploys, and the result comes back to the conversation. A failed change stays on `dev` for the next commit to fix.

Full rules: [Stable and development instances](https://fzkuji.github.io/OpenProgram/docs/reference/design/distribution/dev-instance.html). Architecture and trust boundaries: [Automatic updates](https://fzkuji.github.io/OpenProgram/docs/reference/design/distribution/automatic-updates.html).

**`openprogram upgrade` in a source checkout**

Validates a Git target, updates dependencies and built assets only when their sources changed, probes the new checkout, and restarts the worker only after the probe succeeds. `openprogram update` (`--check`, `--force`) is a separate leftover that currently raises `ImportError`; `upgrade` is the update command.

```
openprogram upgrade --check
openprogram upgrade --dry-run
openprogram upgrade
```

[Source checkout recovery](https://fzkuji.github.io/OpenProgram/docs/server/upgrading.html)

**macOS signing and public releases**

| Mode | What happens |
| --- | --- |
| Development App | `scripts/local-instances/install-dev-app.sh` signs `OpenProgram Dev.app` with a persistent local certificate and sends nothing to Apple. Keep its signing state outside the repository; do not delete it to fix a permission prompt. |
| Public release | The `Release` workflow runs for a `v*` tag or manually for an existing immutable tag. It signs the App and native components with Developer ID, waits for notarization, staples and validates tickets, runs the packaged-runtime checks, then publishes checksummed artifacts. Branch pushes do not trigger it. |

- Repository Secrets: `MAC_CSC_LINK` (base64 encrypted PKCS#12), `MAC_CSC_KEY_PASSWORD`, `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD`, `APPLE_TEAM_ID`. Repository variable: `MAC_SIGNING_IDENTITY`. Keep them in GitHub settings, never in source. CI imports them into a temporary keychain removed when signing exits.
- Rebuild a reviewed tag with **Release → Run workflow** or `gh workflow run release.yml -f tag=vX.Y.Z`. Tag, package versions and release notes must agree.
- Do not recreate a certificate or app password per release. If one expires or is revoked, update its Secret and retry.
- The submission ID is in the signing job log. `In Progress`: Apple is not done. `Accepted`: publication allowed. Anything else stops publication. The 45-minute wait timeout does not cancel the submission.
- Inspect with `xcrun notarytool info SUBMISSION_ID --keychain-profile PROFILE` and `xcrun notarytool log SUBMISSION_ID --keychain-profile PROFILE`. After fixing the cause, rerun the failed workflow for the same tag; a new build may create a new submission.
- The official App carries the Developer ID identity and the development App the local one, so macOS permissions are granted to each separately. Agent bypass settings do not control macOS permissions.
