feat(skill): offer Action or GitHub App mode, and check the permission first - #31
Merged
Conversation
…n first
The App exists at github.com/apps/orcacode-review but the skill only knew
about the Action. Now it asks which, and routes.
The ordering is the point. It probes the user's actual rights BEFORE
offering the choice:
gh api /repos/<o>/<n> --jq .permissions.admin
gh api /orgs/<o>/memberships/<user> --jq .role
Installing a GitHub App is a permission grant, so GitHub requires a human to
approve it on an authorization page — there is no REST endpoint that does it
on someone's behalf, by design. Offering App mode to a plain org member
walks them to a page that stops them. Verified against this very repo: the
account running it is `member`, `admin: false`, and could not complete it.
App mode therefore hands over a link rather than pretending to automate:
https://github.com/apps/orcacode-review/installations/new
It prints the URL and only optionally opens it. A tool that silently calls
`open` in an SSH session, a container or CI leaves the user waiting on a
browser that will never appear.
Verification is honest about its limits. /repos/{o}/{r}/installation needs
the App's own JWT, which no user token can produce; /orgs/{o}/installations
needs admin:org, which is not worth asking for just to read a flag. So the
fallback is to open a PR and look for the bot — the thing the user cares
about anyway.
Also documents the failure mode this choice creates: both installed means
two reviews per PR and double spend. Recorded in the skill and in
troubleshooting, with the note that removing the Action is the reversible
half.
Renames Action step 5 from "Enable the app" — it means the OrcaRouter
console, which now reads as the GitHub App and would send people to the
wrong place.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The App exists at
github.com/apps/orcacode-review, but the skill only knew about the Action. Now it asks which, and routes.The ordering is the point
It probes what the user can actually do before offering the choice:
Installing a GitHub App is a permission grant — GitHub requires a human to approve it on an authorization page, and there is no REST endpoint that does it on someone's behalf. Deliberate, not a gap.
So offering App mode to a plain org member walks them to a page that stops them. Verified against this repo:
The account we've been running all day could not complete App mode. The skill now says that up front instead of finding out three steps in.
App mode hands over a link
It prints the URL and only optionally opens it. A tool that silently calls
openin an SSH session, a container, or CI leaves the user waiting on a browser that never appears.It also says to pick this repository rather than "all repositories" — a much larger grant, and on a paid plan a much larger bill.
Verification is honest about its limits
GET /repos/{o}/{r}/installationGET /orgs/{o}/installationsadmin:org. Not worth asking for write-level org scope to read one flag.Fallback: open a PR and look for the bot review — the thing the user actually cares about.
The failure mode this choice creates
Both installed → two reviews per PR, double spend. Documented in the skill and in
troubleshooting.md, with the note that removing the Action is the reversible half — revoking an App installation is a permission change only an admin can make.Also
Renames Action step 5 from "Enable the app". It means the OrcaRouter console, which now reads as the GitHub App and would send people to the wrong place.
Tests
Four new, pinning what would rot quietly: both modes present and linked, the permission warning ordered before the routing line, no claim the install is automatable, the print-don't-just-open rule, and the conflict documented in both files.
393 passing on top of #28. 1.3.0 — merging publishes it.