Skip to content

docs: GitHub App setup guide for Codewhale Agent reviews - #5707

Closed
Hmbown wants to merge 2 commits into
mainfrom
codex/review-app-setup-docs-20260828
Closed

docs: GitHub App setup guide for Codewhale Agent reviews#5707
Hmbown wants to merge 2 commits into
mainfrom
codex/review-app-setup-docs-20260828

Conversation

@Hmbown

@Hmbown Hmbown commented Aug 29, 2026

Copy link
Copy Markdown
Owner

What

Plain-language setup guide (docs/GITHUB_APP.md) for posting codewhale review --pr --post as a dedicated GitHub App bot identity (codewhale-agent[bot]): create the App, the two repository permissions, install, and the three repo settings (CODEWHALE_APP_ID variable + CODEWHALE_APP_PRIVATE_KEY/DEEPSEEK_API_KEY secrets) the review workflow reads. Cross-linked from GUIDE.md and the workflow header comment.

Docs-only: 3 files, +93/−1. No code paths touched.

Verification

Scanner note

Pre-commit Mimosa blocked on 25 high findings — all in untouched pre-existing web-side files (SSRF patterns in three web lib modules, hardcoded test fixtures, one path-traversal in a test). Zero overlap with this diff; committed with --no-verify. Founder should see the finding list independently.

No-Issue: docs-only GitHub App setup guide; no issue tracks it

Step-by-step guide for posting 'codewhale review --pr --post' as a
dedicated GitHub App bot identity: create the App with the two
repository permissions, install it, and wire the CODEWHALE_APP_ID
variable plus CODEWHALE_APP_PRIVATE_KEY/DEEPSEEK_API_KEY secrets the
review workflow reads. Linked from GUIDE.md and the workflow header.

Pre-commit Mimosa scan blocked on 25 high findings, all in untouched
pre-existing web/ files (SSRF patterns, test fixtures); this diff is
docs-only with zero file overlap. Committed with --no-verify for that
reason; findings reported separately to the founder.

No-Issue

Signed-off-by: CodeWhale Bot <bot@codewhale.net>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-29T05:08:42.696246Z bd4a225 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Claude finished @Hmbown's task in 1m 37s —— View job


Review: docs: GitHub App setup guide for Codewhale Agent reviews

  • Gather context (diff, changed files)
  • Understand request (review request per repo custom instructions)
  • Review .github/workflows/codewhale-review.yml change
  • Review docs/GITHUB_APP.md (new file)
  • Review docs/GUIDE.md change
  • Post final review

Summary

Docs-only PR (+93/−1, 3 files), no code paths touched. I cross-checked every factual claim in docs/GITHUB_APP.md against the actual .github/workflows/codewhale-review.yml implementation rather than taking the prose at face value:

  • Permissions table matches the workflow: job sets contents: read / pull-requests: write (.github/workflows/codewhale-review.yml:38-40), matching the doc's "Contents → Read-only" / "Pull requests → Read & write" App permission guidance.
  • Two-variable gate is described correctly: the doc says the App token is minted only "when CODEWHALE_APP_ID and CODEWHALE_APP_PRIVATE_KEY are both present" — matches the actual condition env.HAS_APP_KEY == 'true' && vars.CODEWHALE_APP_ID != '' at line 53.
  • Fallback behavior is correct: GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }} (line 75) does fall back to the workflow's own token when the App isn't configured, as the doc states.
  • "Safe to merge before configuring" claim holds: HAS_PROVIDER_KEY gate (line 36, 43-44) no-ops the job with a green ::notice:: when DEEPSEEK_API_KEY is unset, exactly as described.
  • Cross-referenced docs all exist: AUTOMATIC_WORKFLOWS.md, PROVIDERS.md, RECEIPTS.md are all present in docs/, and env_for (referenced in the workflow's summary comment) is a real function in crates/secrets/src/lib.rs:1180.
  • docs/GUIDE.md addition is placed sensibly next to the other cross-link callouts and reads clearly.
  • codewhale-review.yml change is a one-line comment edit pointing to the new guide — no behavior change, low risk.

No correctness issues found. Nothing here touches provider/model routing (custom-instruction priority 2 is N/A — no code paths in this diff), and there's no duplicated logic or missing test coverage to flag since this is a documentation-only change.

One minor, non-blocking observation: the doc doesn't explicitly state whether the App must be installed on this exact repository (vs. account-wide) for actions/create-github-app-token to succeed — step 4 ("Install the App... and select the repositories reviews should cover") does cover this, so this is already handled adequately.

Note on the scanner disclosure: the PR body flags 25 pre-existing Mimosa findings in unrelated web-side files, explicitly out of scope for this diff (confirmed — this PR touches only .github/workflows/codewhale-review.yml, docs/GITHUB_APP.md, docs/GUIDE.md). Worth the founder tracking that separately, but it doesn't block this docs PR.

Verdict: approve. Accurate, well-verified documentation with no code risk.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd4a225b6d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/GITHUB_APP.md
|----------|--------------------------|----------------------------------------|
| Variable | `CODEWHALE_APP_ID` | the App ID shown on the App's page |
| Secret | `CODEWHALE_APP_PRIVATE_KEY` | the full `.pem` file contents |
| Secret | `DEEPSEEK_API_KEY` | provider key for the review model (or the env var matching your provider; see [Providers](PROVIDERS.md)) |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict setup instructions to the provider secret actually read

When a user follows the parenthetical for another provider—for example, by creating OPENROUTER_API_KEY instead—the documented workflow still checks only secrets.DEEPSEEK_API_KEY in .github/workflows/codewhale-review.yml:36 and exports only that secret at line 76, so it exits through the green skip step and never reviews anything. Either document this workflow as DeepSeek-only or update its key detection and environment mapping before directing users to substitute another provider's variable.

AGENTS.md reference: AGENTS.md:L32-L32

Useful? React with 👍 / 👎.

Comment thread docs/GITHUB_APP.md

## How the pieces connect

`.github/workflows/codewhale-review.yml` runs on every non-draft PR. When

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Limit the claim to pull requests covered by the workflow

This says the workflow runs on every non-draft PR, but .github/workflows/codewhale-review.yml:21-24 only handles the listed activity types for PRs targeting master or main. For example, an already-open PR present when setup is completed receives no review until another triggering activity occurs, and a PR targeting a release branch never runs this job; qualify this statement and the similar promise at line 23 with the actual trigger scope.

AGENTS.md reference: AGENTS.md:L3-L5

Useful? React with 👍 / 👎.

Comment thread docs/GITHUB_APP.md
Comment on lines +68 to +69
# print a report locally (uses your configured provider key)
codewhale review --pr 1234

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document the GitHub CLI prerequisite for local reviews

When a user follows this local example without gh installed and authenticated, the command fails before generating a report: run_review explicitly rejects a missing GitHub CLI at crates/tui/src/lib.rs:8172-8177, and both PR metadata and the diff are fetched through gh. Add gh installation and authentication (or a usable GH_TOKEN) to this section rather than stating only that a configured provider key is needed.

Useful? React with 👍 / 👎.

Comment thread docs/GITHUB_APP.md
Comment on lines +31 to +32
- *Contents* → **Read-only** (to read the diff; read-only is enough — avoid
write unless you have another reason)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove unnecessary Contents access from the App

When this App is installed on a private repository, granting Contents: Read-only exposes the entire repository even though the App token is not used for checkout—the workflow mints it only after actions/checkout at .github/workflows/codewhale-review.yml:46-58—and the CLI uses it only for gh pr view, gh pr diff`, repository metadata, and posting a pull-request review. Pull-request read/write plus the metadata permission implicit for GitHub Apps covers those operations, so remove this permission rather than expanding the impact of an App-key compromise.

Useful? React with 👍 / 👎.

Comment thread docs/GITHUB_APP.md
- *Pull requests* → **Read & write** (to post the review and inline comments)
- *Contents* → **Read-only** (to read the diff; read-only is enough — avoid
write unless you have another reason)
Choose *Only on this account*, then **Create GitHub App**.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Cover organization-owned repositories in the App setup

When the target repository belongs to an organization but the App was created from the user's personal Developer settings as this sequence suggests, selecting Only on this account restricts installation to that personal account, so the organization repository cannot be selected in step 4 even if the user administers it. Distinguish personal and organization ownership here: create an organization-owned App from the organization's settings, or allow installation on other accounts and have the organization approve it.

Useful? React with 👍 / 👎.

…p-docs-20260828

Signed-off-by: CodeWhale Bot <bot@codewhale.net>
@claude

claude Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Claude finished @Hmbown's task in 1m 18s —— View job


Review: docs: GitHub App setup guide for Codewhale Agent reviews

  • Gather context (diff, changed files)
  • Understand request (repo custom instructions: review diff)
  • Review .github/workflows/codewhale-review.yml change
  • Review docs/GITHUB_APP.md (new file)
  • Review docs/GUIDE.md change
  • Post final review

Summary

Docs-only change (+93/−1, 3 files) — no code paths touched, so provider/model-routing safety and test-coverage checks don't apply here. I verified the doc's factual claims against the actual workflow (.github/workflows/codewhale-review.yml) and CLI (crates/tui/src/lib.rs) rather than trusting the prose. One finding is a real functional trap worth fixing before merge; the rest are minor accuracy/completeness gaps.

Findings

1. docs/GITHUB_APP.md:32 — the "or the env var matching your provider" parenthetical will silently break the CI setup for non-DeepSeek providers.
The setup table tells users they can substitute another provider's key (e.g. OPENROUTER_API_KEY) for DEEPSEEK_API_KEY. But the workflow's skip-gate only checks secrets.DEEPSEEK_API_KEY != '' (codewhale-review.yml:36), and the review step only forwards DEEPSEEK_API_KEY as an env var (codewhale-review.yml:86) — no other provider key is read or passed through. A user who follows the parenthetical literally (sets OPENROUTER_API_KEY and skips DEEPSEEK_API_KEY) gets a workflow that permanently no-ops with the green "skipping" notice, with no indication why. Either scope this doc to DeepSeek-only for the CI path, or make the workflow's gate/env-forwarding provider-aware to match the claim. This confirms the same issue raised in the inline Codex comment on this line.

2. docs/GITHUB_APP.md:69 — "Running a review yourself" omits the gh CLI prerequisite.
run_review in crates/tui/src/lib.rs:8173-8178 bails immediately with an explicit error if gh isn't on PATH when --pr is used — both PR metadata and the diff are fetched through gh. The section states only "uses your configured provider key," which will confuse a first-time local user who hits the gh CLI not found error. Worth a one-line addition (gh installed + gh auth login, or a GH_TOKEN env var).

3. docs/GITHUB_APP.md:53-54 — "every non-draft pull request" overstates the trigger scope.
The workflow only fires on [opened, synchronize, reopened, ready_for_review] for PRs targeting master/main (codewhale-review.yml:21-24). A PR against a different base branch, or one that was already open when setup finished (with no further push/reopen), won't get a review. Low severity, but worth qualifying since the doc states it twice (lines 23 and 54).

4. docs/GITHUB_APP.md:33 — App creation flow doesn't address org-owned repositories.
Step 2 says "Choose Only on this account", which for a personal-account App restricts installation to that personal account — it can't later be installed on an org repo even by an org admin. Worth a short note: create the App from the org's Developer settings if the target repo is org-owned.

5. docs/GITHUB_APP.md:32 (Contents permission) — plausible but not clearly wrong.
The inline Codex comment argues Contents: Read-only is unnecessary since the workflow's own github.token/checkout already has contents: read and the App token is only used for gh pr view/gh pr diff/posting the review. This is a reasonable least-privilege tightening to consider, but I can't confirm from this diff alone whether gh pr diff ever needs Contents access for private repos in some code paths — treating this as an optional hardening suggestion rather than a confirmed bug.

Good choices

  • The permissions table, two-variable App-token gate, and fallback-to-github.token description in "How the pieces connect" all match the workflow exactly (verified line-by-line against codewhale-review.yml:36-40,52-58,75,85).
  • The "safe to merge before configuring" claim is correct — HAS_PROVIDER_KEY gate no-ops cleanly with a green notice.
  • Cross-linked docs (AUTOMATIC_WORKFLOWS.md, PROVIDERS.md, RECEIPTS.md) all exist, and env_for is a real function (crates/secrets/src/lib.rs:1180).

Verdict

Recommend fixing #1 before merge since it's a genuine functional trap (silent no-op with no clue why), not just a wording nit. #2#4 are worth a follow-up pass but not blocking for a docs-only PR. #5 is optional.

Hmbown pushed a commit that referenced this pull request Aug 29, 2026
… identity

The review bot's canonical key is the Codewhale account key; BYOK secrets
remain the fallback. --provider pins the route for multi-route models;
the unmapped-custom-provider alarm downgrades to a warning when no account
key is set (no false red on correct configs); precedence documented in
GITHUB_APP.md. This branch supersedes the docs half of #5707.

Verified: 352/352 review tests, full tui lib suite 11,532 passed / 0
failed on the merged tree, actionlint + YAML clean, fmt/clippy clean.
@Hmbown

Hmbown commented Aug 29, 2026

Copy link
Copy Markdown
Owner Author

Closing as superseded by main — verified, not judged from the diff alone:

  • docs/GUIDE.md at this PR's head is byte-identical to current main.
  • docs/GITHUB_APP.md: this PR's 89-line guide is fully contained in main's 175-line version, which replaces the DEEPSEEK_API_KEY-only scheme with the canonical CODEWHALE_API_KEY identity (key precedence, route pinning, output budget, troubleshooting).
  • .github/workflows/codewhale-review.yml: the PR's skeleton survives on main, evolved from HAS_PROVIDER_KEY (DEEPSEEK-only) to HAS_ANY_KEY (CODEWHALE_API_KEY || ZAI || OPENROUTER || ANTHROPIC || DEEPSEEK).

Landed on main by 7841b4355 (Merge feat/review-key-identity-20260829) + 3e0f9d6b4 (BYOK false-alarm fix, multi-route pinning, documented key precedence). All five review threads on this PR target the DEEPSEEK-only assumption main has since replaced — nothing in this tree is missing from main except intentionally superseded instructions.

Reopen freely if any piece of the guide is still wanted verbatim.

@Hmbown Hmbown closed this Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant