Skip to content

Make Junior primary on GitHub issues and pull requests #780

Closed

Description

@dcramer

Policy

Junior should be the primary GitHub identity for resources it owns and operates. GitHub issues, pull requests, and pull-request branches should be created and maintained as Junior using the GitHub App installation/service-principal identity, not by borrowing the requesting user's OAuth identity.

This must not turn the installation token into a generic GitHub write credential. Bot writes are deny-by-default and selected only for explicit operation families. Delegated user credentials remain the exception for operations that inherently represent a human or require user-private access.

Humans are credited through attribution metadata rather than borrowed execution identity:

Junior-owned GitHub workflows

Junior should act as the primary identity for:

  • Creating and maintaining issues: title/body edits, comments, labels, assignment, close, and reopen
  • Creating and maintaining pull requests: title/body/base/draft edits, comments, labels, assignment, and close
  • Authoring commits and pushing PR branches, with human run actors credited as co-authors

Human reviews, approvals, and change requests continue to use delegated human identity. Merge, REST ref mutation, repository administration, and other non-allowlisted API writes require separate policy.

Authorization boundary

Do not add a generic installation-write grant. Use explicit grants:

  • installation-issues-write
  • installation-pull-requests-write
  • installation-pr-branch-write

Issue and pull-request grants are selected only for allowlisted API routes. Raw creation must use the typed tools so Junior retains idempotency and requester attribution. Unknown REST writes and GraphQL mutations are denied rather than falling back to user OAuth.

Git smart HTTP has a distinct git-receive-pack surface and target repository. Pushes may therefore use installation-pr-branch-write, restricted to that repository with Contents: write and optional configured Workflows: write.

This is intentionally repository-scoped rather than branch-scoped. Junior does not add a second policy engine to identify "Junior-managed" branches or independently detect force updates. Operators should use GitHub branch protection/rulesets and constrain the App installation to repositories where Junior may push. This is a documented limitation, not a reason to keep ordinary pushes on a human token.

Scope

  • Move typed issue and pull request creation to repository-scoped installation grants.
  • Add explicit bot-owned lifecycle classifications for issues and pull requests without enabling arbitrary API writes.
  • Move Git smart-HTTP pushes to the repository-scoped branch-write installation grant.
  • Keep reviews and other inherently human operations on explicit delegated identity.
  • Make Junior the Git author and committer; credit resolvable humans with Co-Authored-By trailers.
  • Add runtime-owned requester attribution to issue and pull request bodies.
  • Isolate credential leases by grant family and repository.
  • Update identity, credential, GitHub setup, skills, and tests for the service-principal model and its branch-policy limitation.

Acceptance criteria

  • Issues and pull requests created through Junior show the GitHub App bot as creator.
  • Allowlisted issue and pull request maintenance uses scoped installation credentials.
  • git push uses a repository-scoped installation credential rather than user OAuth.
  • Reviews continue to use delegated human credentials.
  • Unknown REST writes, GraphQL mutations, merges, and REST ref writes are denied without OAuth fallback.
  • Installation write tokens request only the target repository and required permission family.
  • Human attribution appears in Requested by metadata and Co-Authored-By trailers.
  • Documentation states that branch ownership and force-update controls rely on GitHub branch protection/rulesets and installation scope.

Related

Activity

  1. changed the title [-]github: create resources as Junior, not as the user; prefer Junior's own identity for side effects[/-] [+]Make Junior primary on GitHub issues and pull requests[/+] on Jul 9, 2026
  2. added a commit that references this issue on Jul 10, 2026
    e5f7485
  3. added a commit that references this issue on Jul 10, 2026
    2bc40df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions