Skip to content

takeover mode: agents cannot auto-open PRs — GitHub App missing pull_requests / actions / secrets permissions #7

Description

@nicgzlfly

Problem

When running wanman takeover against a GitHub-hosted repo, agents (dev, cto) follow the documented git workflow:

feature branch → write code → push → gh pr create → notify CTO

However, the gh pr create call fails (or silently skips) because the GitHub App / installation token that wanman provisions does not include the required scopes/permissions.

Observed in: takeover of nicgzlfly/-_the-crowd (2026-04-30)


Missing permissions

Permission Needed for Observed state
pull_requests: write gh pr create — agents opening PRs ❌ missing
actions: write (or read) Agents reading CI run status via gh run list / triggering re-runs ❌ missing
secrets: read Workflows that reference ${{ secrets.* }} (deploy pipeline uses SSH_PRIVATE_KEY, SERVER_HOST, etc.) ❌ not accessible to App token

Reproduction

  1. Install wanman and run wanman takeover /path/to/repo against a private GitHub repo.
  2. Assign a dev task with a feature branch target.
  3. Dev agent pushes branch and calls gh pr create.
  4. PR creation fails or is skipped because the GitHub App installation token lacks pull_requests: write.

Expected behavior

  • wanman takeover setup flow (or docs) should verify that the configured GitHub App installation has at minimum:
    • pull_requests: write
    • actions: read (so agents can poll CI status)
    • contents: write (branch push)
  • If permissions are insufficient, wanman should surface a clear error at startup rather than silently failing mid-task.

Suggested fix / detection

Add a pre-flight check in takeover-local.ts (or takeover-project.ts) that calls:

gh api repos/{owner}/{repo}/actions/permissions
gh api repos/{owner}/{repo} --jq '.permissions'

...and warns the user if pull_requests permission is absent before agents start working.

Alternatively, document the exact GitHub App permission set that must be granted before running wanman takeover.


Environment

  • wanman CLI built from local source (packages/cli/dist/index.js)
  • Runtime: claude (Claude Code subprocess)
  • Repo type: GitHub public/private
  • Auth: personal gh token with repo, workflow scopes (agents inherit this; App token is separate)

References

  • packages/cli/src/takeover-project.ts lines 773–787 (CTO PR review workflow)
  • packages/cli/src/takeover-local.ts detectPullRequestUrl() (assumes PR already exists)
  • Skill doc: wanman/<task-slug> branch → gh pr create documented as required dev step

cc @chekusu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions