# Connect GitHub: reviewed copy, 2026-11-23

The controller supplied Luna's verdict on 2026-11-23. These are the final
values for A, B, C and the native handoff: 39 keys, including the split pending hint and the later
already-connected and repository-limit verdicts. No runtime copy is added by this branch.
When implementing, use each exact value and mark it
`// COPY ACCEPTED BY DELEGATION (Luna, 2026-11-23)` with the usual inventory
and bounded release-test list. Send any later additions or changes separately.
Use "GitHub App" throughout, GitHub's spelling "Organization", "repositories"
for GitHub's side, and "projects" for Equipo's own.
Existing generic cancel, retry, owner-only and project controls are reused.
All values are standalone labels or sentences, not work.reason fragments.

## A. Owner-only GitHub section and manifest flow

| Key | Reviewed value | Use |
| --- | --- | --- |
| `github.title` | GitHub | Owner-only Settings section, separate from model connections. |
| `github.connect` | Connect GitHub | Start setup. |
| `github.account` | GitHub account | Input for intended account login. |
| `github.account_type` | Account type | Choice label. |
| `github.organization` | Organization | Account type. |
| `github.personal_account` | Personal account | Account type. |
| `github.create_app` | Create a GitHub App | Manifest form submission. |
| `github.create_hint` | GitHub will ask you to create a GitHub App and choose the repositories Equipo can access. | Before the external form. |
| `github.confirm_account` | Connect %s | Verified account login, not submitted/model text. |
| `github.repository_count` | Repositories: %d | Verified complete count; never substitute zero on error. |
| `github.confirm` | Connect | Explicit activation tap. |
| `github.connected` | GitHub is connected | Connection state. |
| `github.already_connected` | GitHub is already connected for %s. | Duplicate start/Connect; %s is the verified account login. Luna OK, 2026-11-23. |
| `github.disconnect` | Disconnect | Owner action. |
| `github.disconnect_hint` | Disconnecting stops Equipo from reading these GitHub repositories. These projects stay listed. | Step-4 disconnect form. |
| `github.pending` | The GitHub App is not connected yet. | Created, awaiting installation or owner confirmation. |
| `github.pending_hint` | You can check again for up to 24 hours after creating the GitHub App. | All account types; separate from redirect deadline. |
| `github.pending_approval` | If approval is needed, ask a GitHub organization owner to approve it. | Organizations only; never show for a personal account. |
| `github.check_again` | Check again | JWT installation recheck, no redirect required. |
| `github.redirect_expired` | This GitHub setup link has expired. If you created the GitHub App, select Check again. Otherwise, start again. | Installation-stage ten-minute expiry only, while the key is held. Never use for manifest-stage expiry. |
| `github.pending_expired` | The 24-hour setup window has ended. Connect GitHub again to create a new GitHub App. | Key removed after pending lifetime. |
| `github.setup_failed` | GitHub setup could not be completed. Start again to create a new GitHub App. | Failed conversion or verification, and manifest-stage expiry; no raw error. |
| `github.app_remains` | The GitHub App still exists on GitHub. You can delete it in GitHub App settings. | Expiry, failed conversion, superseded pending setup or Disconnect. Use the account's Apps settings list if the slug is unverified. |
| `github.app_settings` | Open GitHub App settings | Cleanup link; never automatic deletion. |
| `github.reconnect` | Connect GitHub again | Typed reconnect state action. |
| `github.reconnect_hint` | Equipo can no longer use this GitHub App. Connect GitHub again to create a new one. | Sealed key cannot be read; no decrypt details. |
| `github.check_failed` | Equipo could not check GitHub right now. Try again later. | Retryable check failure, distinct from lost access. |

## B. Reachable repositories and the read-only boundary

| Key | Reviewed value | Use |
| --- | --- | --- |
| `github.group` | GitHub, %s | Verified account group in Projects. |
| `github.not_connected` | GitHub is not connected | Disconnected or uninstalled state. |
| `github.suspended` | GitHub access is suspended | Verified installation suspension. |
| `github.stale` | Equipo could not refresh GitHub. This list may be out of date. | Network or rate-limit failure; not revocation. |
| `github.too_many` | Equipo can list up to %s repositories from this GitHub account. Choose fewer repositories on GitHub. | Above 1000 repositories; %s is the bound formatted through Rastrillo's locale number formatting, never hard-coded "1,000". Luna OK, 2026-11-23. |
| `github.not_reachable` | This repository is not available to Equipo. | Explicit GitHub miss or deselection. |
| `github.choose_repositories` | Choose repositories on GitHub | Verified installation settings link. |
| `github.read_only` | Equipo can read this GitHub project, but cannot change it yet. | Every GitHub task is refused, including moves and flag-off requests, before dispatch. |

## C. Read authorization and protocol

| Key | Reviewed value | Use |
| --- | --- | --- |
| `github.runner_update` | Your runner needs an update to read GitHub projects. | Old-protocol refusal. |
| `github.read_unavailable` | Equipo cannot read this GitHub project right now. Check its connection in Projects. | Flag-off read refusal, or safe read refusal when a more specific state is unavailable. |

## Native follow-up

| Key | Reviewed value | Use |
| --- | --- | --- |
| `github.setup_web` | Set up GitHub on the web | Owner web setup link, also reusable by the web not-connected card. |
| `github.setup_owner` | Ask a team owner to connect GitHub. | Member sees the state but has no owner setup controls. |

The native apps reuse the same state values. Owners get the setup link;
members get the owner notice. All links come from validated instance or
GitHub identity, never repository prose. The final device API section will
be sent verbatim to Luna when its concrete wire changes are ready in C.

## State-to-string contract

These are the exact rendering cases for the plan, including action labels.
The shared shell adds `github.title` on the owner GitHub page and
`github.group` on an account's Projects group. Account names are verified
logins; counts are known complete counts. Cleanup always pairs
`github.app_remains` with `github.app_settings`, using the validated old App
settings URL or the account's Apps settings list when its slug is unverified.
No cleanup link silently points to a replacement App.

| State or surface | Exact keys and conditions |
| --- | --- |
| Owner GitHub section, no setup | `github.title`, `github.not_connected`, `github.connect`. |
| Start/account form | `github.account`, `github.account_type`, `github.organization`, `github.personal_account`, `github.create_app`, `github.create_hint`. |
| Awaiting manifest callback, within ten minutes | The manifest surface retains `github.create_app`, `github.create_hint`; do not show the created-App pending state before conversion. |
| Created, unconnected, key held under 24 hours | `github.pending`, `github.pending_hint`, `github.check_again`; add `github.pending_approval` only for organizations awaiting approval. |
| Verified installation, awaiting explicit Connect | `github.confirm_account`, `github.repository_count`, `github.confirm`. |
| Manifest-stage expiry, no conversion and no key | `github.setup_failed`, `github.app_remains`, `github.app_settings`, `github.connect`. Never `github.redirect_expired` or `github.check_again`. |
| Installation-stage redirect expiry, key still held under 24 hours | `github.redirect_expired`, `github.check_again`. |
| Created-but-unconnected key expires at 24 hours | `github.pending_expired`, `github.app_remains`, `github.app_settings`, `github.reconnect`. No Check again. |
| Conversion/verification fails for this valid attempt | `github.setup_failed`, `github.app_remains`, `github.app_settings`, `github.connect`. |
| Invalid, wrong-stage, replayed or wrong-session callback | `github.setup_failed`, `github.connect`. Reveal no other owner's setup, settings URL or secret; do not delete another valid attempt. |
| Session no longer belongs to a current owner | Existing owner-forbidden copy; no GitHub account details or actions. The transaction roster check denies the write. |
| The team's single pending setup superseded by any current owner, for any account | `github.app_remains`, `github.app_settings` for the discarded App, followed by the new Start/account form keys. |
| Connected | `github.connected`, `github.disconnect`, `github.disconnect_hint`. |
| Already connected, duplicate start or Connect | `github.already_connected`, with verified login; the existing connected surface remains and the team's pending setup is untouched. |
| Owner Disconnect | `github.not_connected`, `github.app_remains`, `github.app_settings`, `github.reconnect`. |
| Uninstalled, key retained for seven days from first observation | `github.not_connected`, `github.check_again`. Never the 24-hour pending hint or a second Connect confirmation. |
| Same-App/account reinstall verified within seven days | `github.connected`, `github.disconnect`, `github.disconnect_hint`; existing projects revive by IDs. |
| Uninstall key retention expires after seven days | `github.not_connected`, `github.app_remains`, `github.app_settings`, `github.reconnect`. No Check again. |
| Unreadable sealed key, typed reconnect | `github.reconnect_hint`, `github.reconnect`, `github.app_remains`, `github.app_settings`. |
| Retryable installation check/network/rate-limit failure | `github.check_failed`, `github.check_again` while a valid key is held; without one, the failed-setup case applies. |
| Verified suspension | `github.suspended`; an owner with a held key also gets `github.check_again`. |
| Projects group down after Disconnect or uninstall (branch B) | `github.group`, `github.not_connected`. |
| Projects group suspended (branch B) | `github.group`, `github.suspended`. |
| Pending Connect with more than 1000 repositories | `github.too_many`, `github.choose_repositories`, `github.check_again`. No `github.confirm` or count; recheck enables Connect only after a complete count within the limit. |
| Projects account group, complete current inventory | `github.group`; existing project controls and Available to add copy are reused. |
| Inventory stale or unknown after network or rate-limit failure | `github.group`, `github.stale`; no fake zero count or lost-access message. |
| Installation above 1000 repositories, snapshot unknown | `github.group`, `github.too_many`, `github.choose_repositories`; include `github.stale` if displaying an older snapshot. Never a partial current list. |
| Explicit GitHub miss or repository deselection, verified installation exists | `github.not_reachable`, `github.choose_repositories`. |
| Explicit GitHub miss, no verified installation | `github.not_connected`; owners get `github.setup_web`, members get `github.setup_owner`. |
| Valid rename/transfer with verified reach | `github.group` and the ordinary project row; no new notice. Invalidate the old read binding before re-cloning. |
| Transfer without verified destination reach | `github.not_reachable`; use the matching miss case above for its action. |
| Removed project or lost queued selection | Existing `projects.selection_lost`; if a subsequent explicit GitHub read is refused, `github.read_unavailable`. No GitHub settings action is invented for project deletion. |
| Any GitHub task, including move, retry, each specialist/worker and flag-off | `github.read_only`. No task is recorded, moved or dispatched. |
| Read with the instance flag off after data exists | `github.read_unavailable`. The setup section may be hidden, but the request still receives this refusal. |
| Old runner protocol | `github.runner_update`. |
| Other refused read or temporarily unavailable authorization | `github.read_unavailable`, unless a specific not-connected, suspended or not-reachable state above is known. |
| Native owner setup link | `github.setup_web`, plus the current state keys. |
| Native member without a connection | `github.not_connected`, `github.setup_owner`; no owner controls. |

Implementation tests enumerate every typed state and these presentation cases,
assert their exact required key sets and nonempty rendering, and assert that
the union covers all 39 new keys with none unused. Existing reused keys are
listed separately. New typed states must add an explicit fixture rather than
fall through a generic default. Remove a state mapping to prove the contract
fails. Independently exchange the two redirect-expiry mappings and require
both the rendering assertions and conversion-count tests to fail. Include
personal-account and organization variants, any-current-owner actions,
flag-off data, the seven-day boundary and a 1001-repository fake response.
