# Installation-token takeover proof

Target: [#21184](https://github.com/pingdotgg/t3code/pull/21184), based on [1451e7cb23](https://github.com/pingdotgg/t3code/commit/1451e7cb23034d29774338608368a15d8845df36). Proved local head: `3d5dcadb8c03da9329ee056eda0cb61db357440a`.

## Before and after

The contributor implementation passed 590 selected tests in eight files. A separate fresh test agent reduced 34 added cases in seven files to 11 cases in two existing files while preserving 556 baseline cases. Its integrated human/Bot activity case then failed because a human sharing a Bot slug was suffixed and marked as a bot. The rebuilt implementation canonicalizes actual GraphQL Bot actors at the decoder boundary and removes cross-actor inference. A negative control temporarily restored the main API implementation: the installation-identity case failed on REST 403; after byte-checked restoration it passed.

Independent whole-PR reviews found requested-reviewer identity collisions, ownerless App automatic publishing, saved Enterprise identity displacing valid public CLI authentication, hidden GitHub creation-refusal details, and an overcorrection that discarded Enterprise-only authentication. Separate test and implementation runs repaired them. A shared publish-host guard was removed after review showed it changed existing human Enterprise and self-hosted GitLab behavior. The final single eight-file run passes 570/570 cases: all 556 baseline cases and 14 added cases in two existing GitHub files, with existing client/provider cases extended. No cases are skipped. Scoped GitHub/server/client-runtime/web typechecks, targeted lint, formatting and GitHub export checks passed. The latest scoped lint check has no errors and one existing array-find warning.

## Running server

The primary agent launched the actual server in an isolated worktree home. The proof used real HTTP browser-session authentication, a real WebSocket ticket, project HTTP commands, and production discovery/list/activity/reviewer-candidate RPCs. Only external GitHub fetch and gh subprocess boundaries were synthetic. Every GitHub request had to use the captured public fixture credential. No real GitHub account or repository was mutated.

Sixteen assertions passed on the recorded head. Discovery recognizes the App viewer after REST 403 and typed GraphQL fallback. A repository-list fallback containing the App and a same-slug human returns only the App-authored row. The PR author, reviewer, activity comment and thread comment stay human while the Bot reply remains example[bot]. Reviewer-candidate RPC returns the requested Bot and same-slug human with distinct canonical IDs and correct requested states. REST and GraphQL identity reads use the same captured fixture credential. The server was stopped and its port checked free afterward.

Clone/create/fork behavior is covered by service tests: explicit Enterprise destination host, pinned credentials under source rotation, paginated installation-owner resolution, empty-installation explicit owner, human versus App fork flags, verified personal/organization owner, actual REST reviewer payload, and partial creation with access guidance and no repeated mutation.

## Limits and human verification

This proves application integration with controlled external responses. It does not prove a fresh live installation token, GHES, real GitHub App search qualifiers, expiry/renewal, or Git credential-helper behavior. The contributor's live claims were not reused. App automatic new-project publishing is omitted; manual publishing requires an explicit destination when installation ownership cannot be inferred, and its owner prefill stays empty. Human publishing behavior is preserved. The pre-existing generic host-selection ambiguity for a human Enterprise login without GH_HOST is outside this token change; this PR makes no new host-selection guarantee. With no public credential, that automatic publish attempt fails authentication. A newly discoverable saved human Enterprise token can expose the same limitation; use an explicit Enterprise destination. Two accepted nonblocking limits remain: saved-token identities can be labeled as gh logins in web Settings, and the manual publish prefill now follows the existing provider owner rule for all providers (including blank Bitbucket/Azure prefills).

No screenshot or visual verification is claimed. Earlier T3 browser attempts failed with `Preview automation snapshot timed out after 15000ms.` and `Preview automation navigate timed out after 15000ms.` The explicitly authorized API/test fallback was used.

A maintainer with App installation credentials should exercise listing/detail, reviewer requests, fork PR creation, clone, and repository creation under permitted personal/organization owners; check repository-limited token partial-creation recovery; replace an expired saved token and restart for an environment-token replacement. Git HTTPS/SSH authentication remains separate. Web, desktop and mobile share provider behavior, but macOS, Windows, iOS, Android and the Electron shell were not verified here. Authentication scope still needs human review. No merge was performed.

Model/harness: fresh Codex GPT-6-Astra tests, Codex GPT-6.1-Sol implementation, independent Claude Opus 5.5 and Codex GPT-6-Sol whole-PR reviews through T3 Code; primary integration through the Codex harness. Final review and published CI status are recorded in the PR body separately.
