Repository navigation
Description
Problem or Motivation
service.github_app.installation_id holds one ID. Repos under two accounts need two installations. A public App can be installed by any account.
Order 12 of the plan in #5311. The owner approved the plan on 2026-11-13.
Proposed Solution & Architectural Design
Add a map from owner to installation ID. Token minting selects by RepoRef.owner. The Service refuses events and tokens for an installation that is not in the map. Update the ConfigMap example, and apply the live ConfigMap before the image rolls out.
Target Subsystem
SDLC, Git & PR Governance
Existing Tool Considered
GitHub App installations (one for each account) and the existing token minting in app_installation.py over gidgethub 6.0.0. No new library.
Cost: Build: about 1.0M tokens, 1.5 days. Keep: about 10k tokens a month. Fix: about 120k tokens.
Acceptance Criteria
- Tests show that two owners mint tokens from two installations and that an unknown installation is refused.
- The start check from feat(github): check the App grant at start and record the App identity #5252 runs for each owner.
Dependencies
Owner decision 8 in #5311; related to #5252 and #4417. Part of #5311.
Source: #5311
Alternatives check of 2026-11-28: in-use.
The repository already uses this tool.
Tool: gidgethub (https://pypi.org/project/gidgethub), Apache-2.0 AND MIT, last activity 2026-11-20, maintained.
Reason: Searches found no library that maps owners to App installations; gidgethub, already used for the token mint, covers the installation-token call but the map, refusals and per-installation identity stay project code.
Covers:
- Installation access token mint for a given installation ID
- GitHub App JWT and REST request plumbing
- Async client the existing token mint already uses
Lacks:
- Map from owner to installation ID with lookup by RepoRef.owner
- Typed refusal for an owner or installation the map lacks
- Identity, quota ledger and session keyed per installation
- ConfigMap example and generated config docs for installation_ids
- Start check run for each owner in the map
Proposed design
Problem statement
The Service holds one GitHub App installation ID in service.github_app.installation_id. Repositories under a second owner cannot mint a token from their own installation. The change adds a map from owner to installation ID, selects the installation from RepoRef.owner, keys identity, ledger and session by installation, and refuses an installation that the map lacks.
Acceptance criteria
Requirement: Owner installation map
The service settings SHALL hold a map from each repository owner to that owner's GitHub App installation ID.
Scenario: Two owners in the map
- WHEN a test loads settings whose
service.github_app.installation_idsgives an installation ID to each of two owners - THEN the settings return each owner's own ID, matched case-insensitively, and return no ID for an owner that the map does not hold
Requirement: Token minted from the owner's installation
The installation token mint SHALL select the installation ID from the owner of the RepoRef it is given.
Scenario: Two owners mint tokens
- WHEN a test mints a token for a
RepoRefof each of two owners over a stub session - THEN each request path names the installation ID of that repo's owner and no other
Requirement: Identity, ledger and session keyed by installation
The process's GitHub identity, quota ledger and session MUST be keyed by the installation of the repository's owner.
Scenario: Two owners in one process
- WHEN a test asks the GitHub identity for a
RepoRefof each of two owners in one process - THEN the two identities hold different ledger keys, each naming that owner's installation ID, and the session of one owner is not replaced by the other
Requirement: Unknown installation refuses the token
The token mint MUST refuse a request for an owner that the map does not hold.
Scenario: Owner not in the map
- WHEN a test mints a token for an owner that the map does not hold
- THEN the mint raises the typed refusal error and sends no request to GitHub
Requirement: Unknown installation refuses the event
The Service MUST refuse a webhook event whose installation.id the map does not hold.
Scenario: Event from an unknown installation
- WHEN a test delivers an event whose
installation.idno owner in the map holds - THEN the route returns the refusal result, logs the installation ID and starts no job
Requirement: ConfigMap example holds each owner
The ConfigMap example SHALL give one installation ID for each owner that its service.repos names.
Scenario: ConfigMap example validates
- WHEN the change runs
uv run devops ci --check --only k8s - THEN the k8s check passes with
k8s/devops/configmap.example.yamlparsed as a ConfigMap whosedevops-cli.yamlholds theservice.github_app.installation_idsmap
Requirement: Generated config docs name the map
The generated configuration documents SHALL list service.github_app.installation_ids and SHALL NOT list service.github_app.installation_id.
Scenario: Generated docs are current
- WHEN the change runs
uv run devops ci --check --only docs - THEN the check passes with
docs/ENV_VARS.mdanddocs/CONFIGURATION.mdgenerated from the new settings
Requirement: Start check runs for each owner
The service start check SHALL run for each owner in the installation map.
Scenario: Two owners at start
- WHEN a test runs the start check with two owners in the map over a stub GitHub API
- THEN the check requests a token for each owner's installation and reports one result for each owner
Requirement: Pending a person after the merge
The live ConfigMap MUST hold the service.github_app.installation_ids map for each owner before the image rolls out.
Scenario: Live ConfigMap before rollout
- WHEN the image is about to roll out
- THEN a person has applied the live ConfigMap with the
service.github_app.installation_idsmap for each owner
Existing Tool Considered
Use gidgethub (Apache-2.0 AND MIT, last activity 2026-11-20, maintained). The alternatives check of 2026-11-22 in the issue body gives the verdict in-use. The check records what the tool covers and lacks. The change adds the owner-to-installation map, the selection by RepoRef.owner, the per-installation identity, ledger and session, the refusals, and the ConfigMap example. The written cost for that code is about 1.0M tokens to build, 1.5 days, about 10k tokens a month to keep, and about 120k tokens to fix.
Key questions
- Does the change keep one App with an installation for each owner, or one App for each owner?: Keep one App with one installation for each owner. One App ID and one private key serve every owner. The map holds installation IDs only. (best practice) [sources: docs/adr/0015-roadmap-jobs-act-as-a-github-app-on-the-personal-account.md, docs/CLUSTER.md]
- Chosen: One App with an installation for each owner. ADR 0015 records one App. A public App can be installed by any account.
- Rejected: One App for each owner. It needs a private key and a secret for each owner. ADR 0015 records one App.
- What config shape holds the map from owner to installation ID?: Add the YAML mapping
service.github_app.installation_idswith one entry for each owner. The settings parse it at load. The token mint reads it byRepoRef.owner. (best practice) [sources: CONTEXT.md, src/devops_cli/config/settings.py, k8s/devops/configmap.example.yaml]- Chosen: YAML mapping
service.github_app.installation_ids. The settings already declare mapping values withdict[str, int]. A mapping gives one key for each owner and a parse error for a bad ID. - Rejected: List of owner and installation ID objects. It needs a scan and a duplicate check at each mint.
- Rejected: JSON in an environment variable. It has no example in the ConfigMap and no check at load.
- Rejected: One service deployment for each owner. It doubles the deployments and the webhook routes.
- Chosen: YAML mapping
- Where does the code select the installation for a repo?: The token mint resolves the installation ID from
RepoRef.ownerthrough the map. A caller passes only theRepoRef. (best practice) [sources: src/devops_cli/github/app_installation.py, src/devops_cli/github/repo_ref.py, docs/adr/0015-roadmap-jobs-act-as-a-github-app-on-the-personal-account.md]- Chosen: In the mint, from
RepoRef.owner. One place reads the map, so every caller gets the same selection. ADR 0015 makes the installation the identity. - Rejected: In each caller, which passes the installation ID. Each caller repeats the lookup and can pass the wrong ID.
- Rejected: From the installation ID of the webhook payload only. A token mint for a roadmap job has no webhook payload.
- Chosen: In the mint, from
- How does the lookup match an owner key?: Store each owner key casefolded and look it up casefolded. GitHub treats a login as case-insensitive.
RepoRef.keyis already the casefoldedowner/name. (best practice) [sources: src/devops_cli/github/repo_ref.py, docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md]- Chosen: Case-insensitive match. ADR 0022 records that GitHub names ignore case.
RepoRef.keyis the casefolded form, so a repo full name with a different case still finds its installation. - Rejected: Exact match on the login. A repo full name with a different case misses the map and is refused.
- Chosen: Case-insensitive match. ADR 0022 records that GitHub names ignore case.
- What does the Service do with a token request or an event for an installation that the map does not hold?: Refuse it. The mint raises a typed refusal error and sends no request. The event handler logs a warning with the installation ID and starts no job. (best practice) [sources: docs/CLUSTER.md, src/devops_cli/server/routes/webhooks.py]
- Chosen: Refuse with a typed error and no request. The Service fails at once. The log names the installation that the map lacks. It matches the existing refusal of a repository that is not in
service.repos. - Rejected: Fall back to the one installation in the map. It mints a token from the wrong installation.
- Rejected: Send the request and log the API failure. The failure comes late and names no owner.
- Chosen: Refuse with a typed error and no request. The Service fails at once. The log names the installation that the map lacks. It matches the existing refusal of a repository that is not in
- Do we keep the single
service.github_app.installation_idsetting?: Remove it and hold only the map. The map has one entry for a repository set of one owner. Add one dated line to ADR 0015'sStatus Historythat records the map. (best practice) [sources: docs/adr/0015-roadmap-jobs-act-as-a-github-app-on-the-personal-account.md, docs/adr/README.md, src/devops_cli/config/settings.py]- Chosen: Remove the single ID and hold the map only. A fallback can mint a token from the wrong installation. One key holds one fact.
- Rejected: Keep it as a fallback for an owner that the map lacks. A missing entry then succeeds with the wrong installation.
- Rejected: Keep it as a deprecated alias for one owner. Two keys hold one fact, and they drift.
- Is the process's GitHub identity, quota ledger and session keyed by the installation of the repo's owner?: Yes.
github_identitytakes theRepoRefand resolves that owner's installation. It keys the identity, the quota ledger directory and the session by it. Two owners keep two ledgers and two sessions in one process. (best practice) [sources: docs/adr/0015-roadmap-jobs-act-as-a-github-app-on-the-personal-account.md, src/devops_cli/github/rate_limiter.py, src/devops_cli/github/session.py, src/devops_cli/core/process.py]- Chosen: Key the identity, ledger and session by the owner's installation. ADR 0015 records that the installation is the identity and that the quota ledger and the GitHub session are keyed by the installation. The quota cache directory is already named by the identity key.
- Rejected: Keep one process-wide identity and one token cache. The second owner's request would send the first owner's installation token. The two ledgers would share one quota.
- Does the change amend ADR 0015?: Yes, with one dated line at the end of the
Status Historysection. The body of the accepted record and itsbody-hashstay as they are. (best practice) [sources: docs/adr/README.md, docs/adr/0015-roadmap-jobs-act-as-a-github-app-on-the-personal-account.md]- Chosen: Add one dated Status History line to ADR 0015. An accepted record changes only in a front-matter status key, one dated Status History line, or a broken link target. The settings line of ADR 0015 is now out of date.
- Rejected: Edit the settings line of the ADR body. The body of an accepted record does not change. Its
body-hashwould fail. - Rejected: Supersede ADR 0015 with a new record. The decision is unchanged. Only one setting shape changes.
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Nov 13, 2026
Both deal with App installation identity, but #5252 checks one grant at start while the candidate maps multiple owners to their own installations.devops-cli-service commentedon Nov 16, 2026
Alternatives check: in-use
Reason: The searches found no library that maps several GitHub App installations to repository owners; the only tool in play is gidgethub, which the issue already uses for the existing token minting in app_installation.py. gidgethub covers GitHub App authentication and the API call that mints an installation access token, but it does not hold the owner-to-installation map, the RepoRef.owner selection, or the refusal of unknown installations that this issue adds.
The repository already uses this tool.
Tool: gidgethub/gidgethub (https://github.com/gidgethub/gidgethub)
Covers:
Lacks:
Tools considered:
Searches run:
Sources:
Checked on 2026-11-16. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 17, 2026
Owner question: Who installs the App on the second owner's account and gives its installation ID? (a person decides)
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 21, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.
devops-cli-service commentedon Nov 22, 2026
The result in the alternatives block of the issue body changed. Before this check:
in-use, tool https://github.com/gidgethub/gidgethub. A person decides what the new result means for the item.Searches (6)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 27, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.