Builds, investigations, prototypes, and remote Planners on paired machines connect to GitHub as Chopin's GitHub App (<slug>[bot]), never as a person's personal account.
For each job, Chopin checks that the requester has push access to the repository, mints a 1-hour GitHub App installation token limited to that single repository, and revokes it at GitHub as soon as the run ends, its Planner leaves the machine, or its machine is revoked. Pull requests credit the requester. A launch running on someone else's machine or a pool machine gets nothing of the machine owner's (see Guest launches). Because GitHub mints these tokens only for requests signed with the App's private key, Chopin's server needs your App ID and private key.
This guide explains how to configure that identity. It assumes your GitHub App is already registered and installed (see Register the GitHub App).
- For an organization-owned App: an organization owner or a GitHub App manager for that App.
- For a personal App: the account owner.
You also need permission to edit your Chopin server's configuration and restart the server.
Every machine token requests only these repository permissions. Your App must declare each required permission, and every installation must accept it.
| Permission | Access | How the token uses it |
|---|---|---|
| Contents | Read and write | Required. Fetches code and pushes branches. Prototype tokens request read-only access. |
| Pull requests | Read and write | Required. Opens and updates pull requests and requests reviewers. |
| Metadata | Read-only | Granted automatically to every GitHub App. Lets Chopin verify whether a user can push. |
| Workflows | Read and write | Optional. Lets builds modify .github/workflows. Requested only when the installation grants it; without it, GitHub blocks pushes to workflow files. |
| Actions | Read-only | Optional. Lets a build see its pull request's workflow runs, including one that failed before it created a check (gh run list, gh run view). Requested read-only, only when the installation grants it. |
| Checks | Read-only | Optional. Lets a build see its pull request's check runs (gh pr checks). Requested read-only, only when the installation grants it. |
| Commit statuses | Read-only | Optional. Lets a build see its pull request's commit statuses. Requested read-only, only when the installation grants it. |
Missing optional permissions are omitted from the token and do not block launches. However, without Actions, Checks, and Commit statuses, GitHub refuses CI queries with Resource not accessible by integration, so builds cannot check whether their pull request's CI ran or passed.
Permissions granted per job type:
| Launch | Token permissions | Credited user |
|---|---|---|
| A build, rebuild or investigation | Contents and Pull requests write, Metadata read, Workflows write if given, Actions, Checks and Commit statuses read if given | The person who started it |
| A prototype | Contents read, Metadata read | The person who started it |
| A Planner running on a machine | Contents and Pull requests write, Metadata read, Workflows write if given, Actions, Checks and Commit statuses read if given | Whoever first opened or asked for the Planner while it had no host |
Signed-in users in the browser use Checks and Commit statuses as well, and Issues, which machine tokens never request. See Repository permissions.
-
Open your GitHub App settings. On GitHub, click your profile picture and choose:
- Settings for a personal App; or
- Your organizations, then Settings next to the organization for an organization App.
Go to Developer settings > GitHub Apps, then click Edit next to your App (
https://github.com/settings/apps/<slug>orhttps://github.com/organizations/<org>/settings/apps/<slug>). -
Open Permissions & events and confirm Contents and Pull requests are set to Read and write. So builds can see their pull requests' CI, also set Actions, Checks and Commit statuses to at least Read-only. If you change any permission, click Save changes and have each installed account accept the updated permissions on GitHub.
-
Open General. Under About, copy the numeric App ID. Do not confuse it with the Client ID next to it (which goes in
GITHUB_APP_CLIENT_ID). -
Open Credentials > Key pairs and click New key (or click Generate a private key under Private keys at the bottom of General). Your browser downloads a
.pemfile named<slug>.<date>.private-key.pem. GitHub keeps only the public key, so if you lose the file you must generate a new key. -
Verify the downloaded file matches the fingerprint GitHub displays for the new key:
openssl rsa -in <downloaded>.pem -pubout -outform DER | openssl sha256 -binary | openssl base64
-
Copy the
.pemfile to your Chopin server (for example withscp), store it readable only by the user running Chopin, and remove the temporary upload:sudo install -D -m 0600 -o <service-user> <uploaded>.pem /etc/chopin/github-app.pem rm <uploaded>.pem
Chopin's Docker image runs as user ID
1000, so use-o 1000 -g 1000for Docker deployments. Delete the downloaded copy on your laptop too. If your hosting platform mounts secrets from a secret manager, store the key there instead. Never commit the private key, paste it into chat or issues, or log it. Chopin never prints the key or its path. -
Add these two settings to your server's environment file (such as
/etc/chopin/chopin.env):GITHUB_APP_ID=<App ID from step 3> GITHUB_APP_PRIVATE_KEY_FILE=/etc/chopin/github-app.pem
For Docker, set
GITHUB_APP_PRIVATE_KEY_FILE=/run/secrets/github-app.pemand mount the host file read-only into the container:--volume /etc/chopin/github-app.pem:/run/secrets/github-app.pem:ro
If your hosting platform only accepts inline environment variables, use
GITHUB_APP_PRIVATE_KEYinstead, with line breaks written as\n. Set eitherGITHUB_APP_PRIVATE_KEY_FILEorGITHUB_APP_PRIVATE_KEY, never both.Also ensure
GITHUB_APP_SLUGmatches your App's URL slug so Chopin can look up<GITHUB_APP_SLUG>[bot]. -
Restart Chopin (for Docker, recreate the container with the new volume mount). Both the server and
bun run migrateread the key once at startup.
At startup. If the configuration is invalid, Chopin and bun run migrate stop immediately with a clear error:
| Error | How to fix it |
|---|---|
GITHUB_APP_ID must be the GitHub App's numeric ID |
Use the numeric App ID from step 3, not the Client ID. |
GITHUB_APP_ID needs GITHUB_APP_PRIVATE_KEY or GITHUB_APP_PRIVATE_KEY_FILE |
Provide the private key file or inline key from step 7. |
Set GITHUB_APP_PRIVATE_KEY or GITHUB_APP_PRIVATE_KEY_FILE, not both |
Keep only one of the two variables. |
GITHUB_APP_PRIVATE_KEY_FILE can't be read |
Fix the file path or permissions. Inside Docker, use the path inside the container. |
The GitHub App private key must be a PEM private key |
Provide the entire .pem file, including the -----BEGIN and -----END lines. |
The GitHub App private key must be an RSA key |
Use a private key generated by GitHub for this App. |
Startup checks only the format of the key and does not call GitHub, so step 5's fingerprint check is the fastest way to catch a mismatched key.
From a paired machine. On a paired machine that has a checkout registered with chopin connect --checkout <path>, run:
chopin status --jsonConfirm that plain chopin status prints connector protocol 7 or later on its first line (older connectors do not run this check). In the JSON output, inspect the github field, which shows whether Chopin can mint a token for each registered repository:
"github": { "octo-org/score": "ok" }| Result | Meaning |
|---|---|
ok |
Chopin can issue a GitHub App token for this repository. No token was minted during the check. |
| A refusal | One of the codes under Refusals. Plain chopin status also prints a sentence explaining the problem next to that checkout. |
unknown |
Chopin could not verify access: the machine is unpaired or rejected, the server is unreachable or outdated, or GitHub rejected the App key. |
In the server log. Every token issued writes one log line without exposing the token value:
chopin: GitHub App token (run build) for machine <machine-id> in octo-org/score, run <run-id>, document <document-id>, for mona
A guest launch is any Planner, build, or investigation whose requester is not the machine's owner—a teammate's work on your machine, or any launch on a server-owned pool machine. It runs under the requester's identity and never lends yours:
- Token credits the requester: For a build or investigation, the requester is whoever pressed Build plan, Build, Retry, or Run. For a Planner, it is whoever first opened or asked for it while it had no host.
- Rechecked on every mint and renewal: The requester must still be admitted to Chopin and able to push to the repository (checked with the App). On a user-owned machine, the machine owner must also be able to push there (checked with the machine's authorization) so a user's machine never holds a repository its owner cannot reach. If a fresh GitHub check on a guest token renewal, run call, build claim, or Planner credential renewal finds the owner can no longer push, Chopin drops the cached check at once and withdraws the machine's guest work at its next poll. A guest Planner kept for a machine that went quiet returns there only while its owner can still push; otherwise its copy there ends and another eligible machine takes it. Pool machines have no owner.
- Admission confirmed, never assumed: A live Chopin sign-in or
GITHUB_ALLOWED_USERSconfirms admission. Otherwise Chopin checks active membership in an allowed organization through the App (requiring Organization permissions > Members: Read-only on that organization's installation). If it cannot check, no token issues and the requester is asked to sign in again. - Guest Planners use the requester's sign-in: Chopin attaches a guest Planner through the requester's own live Chopin sign-in, never the owner's authorization. It starts only while they are signed in and ends when they sign out or lose access. It requires a Planner backend that runs each turn on that turn's person's AI accounts (see Whose account each model call runs on).
- Tokens revoke when work leaves: Planner tokens revoke at GitHub when Chopin withdraws the Planner or assigns it for another requester; run tokens revoke when the run ends or when Chopin takes the run from the machine to run it elsewhere.
- Server reads use the requester's role: When Chopin checks start commits, PR state, or tool calls for a guest launch, it uses a server-held read-only App token (Contents, Metadata, and Pull requests read) paired with the requester's GitHub role.
- Builds start from GitHub, never a local unpushed
HEAD: With the GitHub App configured, every build starts from what is on GitHub—the plan's pushed commit, or else the default-branch head—so any eligible machine can take it. If the plan's commit is not on GitHub, Chopin refuses the build (plan-source-unavailable:"Push it, or rebuild the plan.") and never falls back to the branch head. Without the App (or where the App cannot read the repository), builds start from the requester's own checkout on their own machines only. Rebuilds start from the first build's base. - Document-scoped Planner tokens: The machine passes the document ID when requesting a Planner token and receives one only while Chopin runs that document's Planner there for that requester. Once Chopin withdraws a guest Planner, neither its token nor its Planner credential falls back to the owner.
If Chopin refuses to issue a token, the job or Planner does not start. The machine never silently falls back to the owner's personal GitHub login. Every refusal names the affected repository.
| Code | Why it happened | How to fix it |
|---|---|---|
no-grant |
The server is missing GITHUB_APP_ID or the private key. |
Follow Set it up. |
app-cannot-push |
The App is not installed on the repository, its installation is suspended, it lacks required permissions, or <GITHUB_APP_SLUG>[bot] could not be found. |
Install the App on the repository, approve pending permission updates, or fix GITHUB_APP_SLUG. |
starter-cannot-push |
The user who triggered the job (or the machine owner for chopin status, or the requester of a Planner) does not have push access, their GitHub username now belongs to another account, or Chopin no longer admits them. |
Grant that user write access to the repository, then retry. |
repository-forbidden |
The machine owner cannot access the repository through the App installation, or cannot push to it for a guest launch on a user-owned machine. | Install the App on the repository or grant the machine owner access. |
run-unknown |
The run already finished, moved to another machine, or targets another repository. | Start the build or investigation again. |
- Connectors on protocol 7 or later receive
no-grant, so builds, investigations, prototypes, and remote Planners do not start. - Older connectors temporarily fall back to the owner's personal GitHub token and log
chopin: legacy GitHub token for machine <machine-id> in octo-org/score: its connector predates App installation tokens. - Under
AUTH_MODE=local, Chopin never issues GitHub tokens to machines, with or without a key.
Configure the App key on your server before users upgrade to newer chopin CLI releases.
A GitHub App can hold up to 25 keys at once, so always add the replacement key before deleting the old one.
- Generate and install the new key by repeating steps 4 to 6 of Set it up, replacing
/etc/chopin/github-app.pem. - Restart Chopin (for Docker, start a fresh container so it mounts the new key).
- Confirm it works under Check it works.
- In the App's GitHub settings, open Credentials > Key pairs, click Delete next to the old key's fingerprint, and confirm.
If a key ever leaks, follow the same steps immediately. Deleting the key prevents any new tokens from being minted, and any token already issued expires within one hour.
- Pull requests and commits are authored by the bot account
<slug>[bot]with the email<bot-id>+<slug>[bot]@users.noreply.github.com. - The pull request description ends with a line such as
Requested by @mona in https://chopin.example/... Built by a coding agent with Chopin's GitHub App. - Chopin asks the coding agent to request a review from the person who started the build.
- Every commit includes a trailer crediting the requester as a GitHub co-author:
Co-authored-by: Mona Lisa <583231+mona@users.noreply.github.com>.
The coding agent adds the last three items based on Chopin's prompt; if one is missing, the agent omitted it.